diff --git a/templates/gitea/deployment.yaml b/templates/gitea/deployment.yaml index 0af19a1..9444cb9 100644 --- a/templates/gitea/deployment.yaml +++ b/templates/gitea/deployment.yaml @@ -261,6 +261,7 @@ spec: {{- include "gitea.init-additional-mounts" . | nindent 12 }} resources: {{- toYaml .Values.initContainers.resources | nindent 12 }} + {{ if and .Values.gitea.actions.enabled .Values.forgejo.runner.enabled}} - name: add-runner-secret image: "{{ include "gitea.image" . }}" command: ["/usr/sbin/add_runner_secret.sh"] @@ -303,6 +304,7 @@ spec: {{- include "gitea.init-additional-mounts" . | nindent 12 }} resources: {{- toYaml .Values.initContainers.resources | nindent 12 }} + {{ end }} terminationGracePeriodSeconds: {{ .Values.deployment.terminationGracePeriodSeconds }} containers: - name: {{ .Chart.Name }} diff --git a/templates/gitea/init.yaml b/templates/gitea/init.yaml index bd065b5..c117fc8 100644 --- a/templates/gitea/init.yaml +++ b/templates/gitea/init.yaml @@ -224,7 +224,7 @@ stringData: configure_oauth echo '==== END GITEA CONFIGURATION ====' - + {{ if and .Values.gitea.actions.enabled .Values.forgejo.runner.enabled}} add_runner_secret.sh: |- #!/usr/bin/env bash @@ -235,3 +235,4 @@ stringData: forgejo forgejo-cli actions register --name "{{ include "gitea.fullname" . }}-runner" --secret "${RUNNER_SECRET}" echo '==== END ADD RUNNER SECRET ====' + {{ end }} diff --git a/templates/gitea/runner-secret.yaml b/templates/gitea/runner-secret.yaml index 0ead4db..1dc6a6e 100644 --- a/templates/gitea/runner-secret.yaml +++ b/templates/gitea/runner-secret.yaml @@ -9,7 +9,7 @@ while the rest is the actual secret. It is possible to update the secret of an existing runner by running the command again on the Forgejo machine, with the last 24 characters updated. */}} -{{- if and (.Values.forgejo.runner.enabled) (not .Values.forgejo.runner.registrationSecretName) -}} +{{- if and .Values.gitea.actions.enabled .Values.forgejo.runner.enabled (not .Values.forgejo.runner.registrationSecretName) -}} {{- $secretName := printf "%s-%s" (include "gitea.fullname" .) "runner-registration" -}} {{- $secret := lookup "v1" "Secret" .Release.Namespace $secretName -}} {{- if not $secret }} diff --git a/templates/gitea/runner.yaml b/templates/gitea/runner.yaml index ee987c9..562c2a4 100644 --- a/templates/gitea/runner.yaml +++ b/templates/gitea/runner.yaml @@ -1,4 +1,4 @@ -{{- if .Values.forgejo.runner.enabled -}} +{{- if and .Values.gitea.actions.enabled .Values.forgejo.runner.enabled -}} apiVersion: apps/v1 kind: StatefulSet metadata: