You've already forked helm-actions
							
							chore(core): refactor to make all unit tests pass (#6)
_This is the first time I ever messed with helm and is an experiment to show what prevents the tests to pass and how far it still depends on the gitea chart_ ### Description of the change - Deletes a single test that seems to depend directly on gitea - make all tests pass - Moves all value accesses from `actions` one level up - Copies content of the gitea chart required by the existing test - Reveals all dependencies that needs to be decoupled - Fixes readme generation - add package.json - copy dependent readme section from helm-gitea - Removes all dependencies - giteaRootURL is now required to be provided - consistency check that this value has been provided - added test for consistency failure - nc command no longer uses an hardcoded dns name and is checked in tests - added test - Copied yamllint from helm-gitea - added pnpm lock file exclusion - Installed pnpm in the workflow - Updated make unittest command in CI to unittest-helm ### Benefits The existing tests are passing ### Possible drawbacks The provision job might still not work. ### Applicable issues - Fixes #5 ### Additional information The following usage should now deploy ```yaml existingSecret: "somesecret" existingSecretKey: "key" ## Specify the root URL of the Gitea instance giteaRootURL: "http://somedomain:3000" ``` ### ⚠ BREAKING - giteaRootURL is now required to be provided - Moves all value accesses from `actions` one level up - The values.yml had this change without updating tests / dev Readme Reviewed-on: https://gitea.com/gitea/helm-actions/pulls/6 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: justusbunsi <justusbunsi@noreply.gitea.com> Reviewed-by: volker.raschek <markus.pesch@web.de> Co-authored-by: Christopher Homberger <christopher.homberger@web.de> Co-committed-by: Christopher Homberger <christopher.homberger@web.de>
This commit is contained in:
		
				
					committed by
					
						
						Lunny Xiao
					
				
			
			
				
	
			
			
			
						parent
						
							81716ac783
						
					
				
				
					commit
					5b19636034
				
			@@ -1,15 +1,18 @@
 | 
			
		||||
{{- if .Values.actions.enabled -}}
 | 
			
		||||
    {{- if .Values.actions.provisioning.enabled -}}
 | 
			
		||||
{{- if .Values.enabled -}}
 | 
			
		||||
    {{- if .Values.provisioning.enabled -}}
 | 
			
		||||
        {{- if not (and .Values.persistence.enabled .Values.persistence.mount) -}}
 | 
			
		||||
            {{- fail "persistence.enabled and persistence.mount are required when provisioning is enabled" -}}
 | 
			
		||||
        {{- end -}}
 | 
			
		||||
        {{- if and .Values.persistence.enabled .Values.persistence.mount -}}
 | 
			
		||||
            {{- if .Values.actions.existingSecret -}}
 | 
			
		||||
            {{- if .Values.existingSecret -}}
 | 
			
		||||
                {{- fail "Can't specify both actions.provisioning.enabled and actions.existingSecret" -}}
 | 
			
		||||
            {{- end -}}
 | 
			
		||||
        {{- end -}}
 | 
			
		||||
    {{- end -}}
 | 
			
		||||
    {{- if and (not .Values.actions.provisioning.enabled) (or (empty .Values.actions.existingSecret) (empty .Values.actions.existingSecretKey)) -}}
 | 
			
		||||
        {{- fail "actions.existingSecret and actions.existingSecretKey are required when provisioning is disabled" -}}
 | 
			
		||||
    {{- if and (not .Values.provisioning.enabled) (or (empty .Values.existingSecret) (empty .Values.existingSecretKey)) -}}
 | 
			
		||||
        {{- fail "existingSecret and existingSecretKey are required when provisioning is disabled" -}}
 | 
			
		||||
    {{- end -}}
 | 
			
		||||
    {{- if not .Values.giteaRootURL -}}
 | 
			
		||||
        {{- fail "giteaRootURL is required" -}}
 | 
			
		||||
    {{- end -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										131
									
								
								templates/_helpers.tpl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										131
									
								
								templates/_helpers.tpl
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,131 @@
 | 
			
		||||
{{/* vim: set filetype=mustache: */}}
 | 
			
		||||
{{/*
 | 
			
		||||
Expand the name of the chart.
 | 
			
		||||
*/}}
 | 
			
		||||
 | 
			
		||||
{{- define "gitea.name" -}}
 | 
			
		||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
Create a default fully qualified app name.
 | 
			
		||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
 | 
			
		||||
If release name contains chart name it will be used as a full name.
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "gitea.fullname" -}}
 | 
			
		||||
{{- if .Values.fullnameOverride -}}
 | 
			
		||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
 | 
			
		||||
{{- else -}}
 | 
			
		||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
 | 
			
		||||
{{- if contains $name .Release.Name -}}
 | 
			
		||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
 | 
			
		||||
{{- else -}}
 | 
			
		||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
Create a default worker name.
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "gitea.workername" -}}
 | 
			
		||||
{{- printf "%s-%s" .global.Release.Name .worker | trunc 63 | trimSuffix "-" -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
Create chart name and version as used by the chart label.
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "gitea.chart" -}}
 | 
			
		||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
Create image name and tag used by the deployment.
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "gitea.image" -}}
 | 
			
		||||
{{- $fullOverride := .Values.image.fullOverride | default "" -}}
 | 
			
		||||
{{- $registry := .Values.global.imageRegistry | default .Values.image.registry -}}
 | 
			
		||||
{{- $repository := .Values.image.repository -}}
 | 
			
		||||
{{- $separator := ":" -}}
 | 
			
		||||
{{- $tag := .Values.image.tag | default .Chart.AppVersion | toString -}}
 | 
			
		||||
{{- $rootless := ternary "-rootless" "" (.Values.image.rootless) -}}
 | 
			
		||||
{{- $digest := "" -}}
 | 
			
		||||
{{- if .Values.image.digest }}
 | 
			
		||||
    {{- $digest = (printf "@%s" (.Values.image.digest | toString)) -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
{{- if $fullOverride }}
 | 
			
		||||
    {{- printf "%s" $fullOverride -}}
 | 
			
		||||
{{- else if $registry }}
 | 
			
		||||
    {{- printf "%s/%s%s%s%s%s" $registry $repository $separator $tag $rootless $digest -}}
 | 
			
		||||
{{- else -}}
 | 
			
		||||
    {{- printf "%s%s%s%s%s" $repository $separator $tag $rootless $digest -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
Storage Class
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "gitea.persistence.storageClass" -}}
 | 
			
		||||
{{- $storageClass :=  (tpl ( default "" .Values.persistence.storageClass) .) | default (tpl ( default "" .Values.global.storageClass) .) }}
 | 
			
		||||
{{- if $storageClass }}
 | 
			
		||||
storageClassName: {{ $storageClass | quote }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
Common labels
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "gitea.labels" -}}
 | 
			
		||||
helm.sh/chart: {{ include "gitea.chart" . }}
 | 
			
		||||
app: {{ include "gitea.name" . }}
 | 
			
		||||
{{ include "gitea.selectorLabels" . }}
 | 
			
		||||
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
 | 
			
		||||
version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
 | 
			
		||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{- define "gitea.labels.actRunner" -}}
 | 
			
		||||
helm.sh/chart: {{ include "gitea.chart" . }}
 | 
			
		||||
app: {{ include "gitea.name" . }}-act-runner
 | 
			
		||||
{{ include "gitea.selectorLabels.actRunner" . }}
 | 
			
		||||
app.kubernetes.io/version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
 | 
			
		||||
version: {{ .Values.image.tag | default .Chart.AppVersion | quote }}
 | 
			
		||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
Selector labels
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "gitea.selectorLabels" -}}
 | 
			
		||||
app.kubernetes.io/name: {{ include "gitea.name" . }}
 | 
			
		||||
app.kubernetes.io/instance: {{ .Release.Name }}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{- define "gitea.selectorLabels.actRunner" -}}
 | 
			
		||||
app.kubernetes.io/name: {{ include "gitea.name" . }}-act-runner
 | 
			
		||||
app.kubernetes.io/instance: {{ .Release.Name }}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{- define "gitea.act_runner.local_root_url" -}}
 | 
			
		||||
  {{- .Values.giteaRootURL -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
 | 
			
		||||
{{/*
 | 
			
		||||
Parse the http url to hostname + port separated by space for the nc command
 | 
			
		||||
*/}}
 | 
			
		||||
{{- define "gitea.act_runner.nc" -}}
 | 
			
		||||
{{- $url := include "gitea.act_runner.local_root_url" . | urlParse -}}
 | 
			
		||||
{{- $host := get $url "host" -}}
 | 
			
		||||
{{- $scheme := get $url "scheme" -}}
 | 
			
		||||
{{- $port := "80" -}}
 | 
			
		||||
{{- if contains ":" $host -}}
 | 
			
		||||
    {{- $hostAndPort := regexSplit ":" $host 2 -}}
 | 
			
		||||
    {{- $host = index $hostAndPort 0 -}}
 | 
			
		||||
    {{- $port = index $hostAndPort 1 -}}
 | 
			
		||||
{{- else if eq $scheme "https" -}}
 | 
			
		||||
    {{- $port = "443" -}}
 | 
			
		||||
{{- else if eq $scheme "http" -}}
 | 
			
		||||
    {{- $port = "80" -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
{{- printf "%s %s" $host $port -}}
 | 
			
		||||
{{- end -}}
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
{{- if .Values.actions.enabled }}
 | 
			
		||||
{{- if .Values.enabled }}
 | 
			
		||||
---
 | 
			
		||||
apiVersion: v1
 | 
			
		||||
kind: ConfigMap
 | 
			
		||||
@@ -9,7 +9,7 @@ metadata:
 | 
			
		||||
    {{- include "gitea.labels" . | nindent 4 }}
 | 
			
		||||
data:
 | 
			
		||||
  config.yaml: |
 | 
			
		||||
    {{- with .Values.actions.statefulset.actRunner.config -}}
 | 
			
		||||
    {{- with .Values.statefulset.actRunner.config -}}
 | 
			
		||||
    {{ . | nindent 4}}
 | 
			
		||||
    {{- end -}}
 | 
			
		||||
{{- end }}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
{{- if .Values.actions.enabled }}
 | 
			
		||||
{{- if and (and .Values.actions.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
 | 
			
		||||
{{- if .Values.enabled }}
 | 
			
		||||
{{- if and (and .Values.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
 | 
			
		||||
---
 | 
			
		||||
apiVersion: v1
 | 
			
		||||
kind: ConfigMap
 | 
			
		||||
@@ -9,6 +9,6 @@ metadata:
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "gitea.labels" . | nindent 4 }}
 | 
			
		||||
data:
 | 
			
		||||
{{ (.Files.Glob "scripts/act_runner/*.sh").AsConfig | indent 2 }}
 | 
			
		||||
{{ (.Files.Glob "scripts/*.sh").AsConfig | indent 2 }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
{{- end }}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
{{- if .Values.actions.enabled }}
 | 
			
		||||
{{- if and (and .Values.actions.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
 | 
			
		||||
{{- if .Values.enabled }}
 | 
			
		||||
{{- if and (and .Values.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
 | 
			
		||||
{{- $name := include "gitea.workername" (dict "global" . "worker" "actions-token-job") }}
 | 
			
		||||
{{- $secretName := include "gitea.workername" (dict "global" . "worker" "actions-token") }}
 | 
			
		||||
---
 | 
			
		||||
@@ -10,33 +10,33 @@ metadata:
 | 
			
		||||
  namespace: {{ .Values.namespace | default .Release.Namespace }}
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "gitea.labels" . | nindent 4 }}
 | 
			
		||||
    {{- with .Values.actions.provisioning.labels }}
 | 
			
		||||
    {{- with .Values.provisioning.labels }}
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
    app.kubernetes.io/component: token-job
 | 
			
		||||
  annotations:
 | 
			
		||||
    {{- with .Values.actions.provisioning.annotations }}
 | 
			
		||||
    {{- with .Values.provisioning.annotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
spec:
 | 
			
		||||
  ttlSecondsAfterFinished: {{ .Values.actions.provisioning.ttlSecondsAfterFinished }}
 | 
			
		||||
  ttlSecondsAfterFinished: {{ .Values.provisioning.ttlSecondsAfterFinished }}
 | 
			
		||||
  template:
 | 
			
		||||
    metadata:
 | 
			
		||||
      labels:
 | 
			
		||||
        {{- include "gitea.labels" . | nindent 8 }}
 | 
			
		||||
        {{- with .Values.actions.provisioning.labels }}
 | 
			
		||||
        {{- with .Values.provisioning.labels }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
        app.kubernetes.io/component: token-job
 | 
			
		||||
    spec:
 | 
			
		||||
      initContainers:
 | 
			
		||||
        - name: init-gitea
 | 
			
		||||
          image: "{{ .Values.actions.init.image.repository }}:{{ .Values.actions.init.image.tag }}"
 | 
			
		||||
          image: "{{ .Values.init.image.repository }}:{{ .Values.init.image.tag }}"
 | 
			
		||||
          command:
 | 
			
		||||
            - sh
 | 
			
		||||
            - -c
 | 
			
		||||
            - |
 | 
			
		||||
              while ! nc -z {{ include "gitea.fullname" . }}-http {{ .Values.service.http.port }}; do
 | 
			
		||||
              while ! nc -z {{ include "gitea.act_runner.nc" . }}; do
 | 
			
		||||
                sleep 5
 | 
			
		||||
              done
 | 
			
		||||
      containers:
 | 
			
		||||
@@ -54,7 +54,7 @@ spec:
 | 
			
		||||
              mkdir -p /data/actions/
 | 
			
		||||
              gitea actions generate-runner-token | grep -E '^.{40}$' | tr -d '\n' > /data/actions/token
 | 
			
		||||
          resources:
 | 
			
		||||
            {{- toYaml .Values.actions.provisioning.resources | nindent 12 }}
 | 
			
		||||
            {{- toYaml .Values.provisioning.resources | nindent 12 }}
 | 
			
		||||
          volumeMounts:
 | 
			
		||||
            - name: data
 | 
			
		||||
              mountPath: /data
 | 
			
		||||
@@ -62,8 +62,8 @@ spec:
 | 
			
		||||
              subPath: {{ .Values.persistence.subPath }}
 | 
			
		||||
              {{- end }}
 | 
			
		||||
        - name: actions-token-upload
 | 
			
		||||
          image: "{{ .Values.actions.provisioning.publish.repository }}:{{ .Values.actions.provisioning.publish.tag }}"
 | 
			
		||||
          imagePullPolicy: {{ .Values.actions.provisioning.publish.pullPolicy }}
 | 
			
		||||
          image: "{{ .Values.provisioning.publish.repository }}:{{ .Values.provisioning.publish.tag }}"
 | 
			
		||||
          imagePullPolicy: {{ .Values.provisioning.publish.pullPolicy }}
 | 
			
		||||
          env:
 | 
			
		||||
            - name: SECRET_NAME
 | 
			
		||||
              value: {{ $secretName }}
 | 
			
		||||
@@ -75,7 +75,7 @@ spec:
 | 
			
		||||
              kubectl auth can-i update secret/${SECRET_NAME}
 | 
			
		||||
              /scripts/token.sh
 | 
			
		||||
          resources:
 | 
			
		||||
            {{- toYaml .Values.actions.provisioning.resources | nindent 12 }}
 | 
			
		||||
            {{- toYaml .Values.provisioning.resources | nindent 12 }}
 | 
			
		||||
          volumeMounts:
 | 
			
		||||
            - mountPath: /scripts
 | 
			
		||||
              name: scripts
 | 
			
		||||
@@ -86,15 +86,15 @@ spec:
 | 
			
		||||
              {{- if .Values.persistence.subPath }}
 | 
			
		||||
              subPath: {{ .Values.persistence.subPath }}
 | 
			
		||||
              {{- end }}
 | 
			
		||||
      {{- range $key, $value := .Values.actions.provisioning.nodeSelector }}
 | 
			
		||||
      {{- range $key, $value := .Values.provisioning.nodeSelector }}
 | 
			
		||||
      nodeSelector:
 | 
			
		||||
        {{ $key }}: {{ $value | quote }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.actions.provisioning.affinity }}
 | 
			
		||||
      {{- with .Values.provisioning.affinity }}
 | 
			
		||||
      affinity:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.actions.provisioning.tolerations }}
 | 
			
		||||
      {{- with .Values.provisioning.tolerations }}
 | 
			
		||||
      tolerations:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
{{- if .Values.actions.enabled }}
 | 
			
		||||
{{- if and (and .Values.actions.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
 | 
			
		||||
{{- if .Values.enabled }}
 | 
			
		||||
{{- if and (and .Values.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
 | 
			
		||||
{{- $name := include "gitea.workername" (dict "global" . "worker" "actions-token-job") }}
 | 
			
		||||
{{- $secretName := include "gitea.workername" (dict "global" . "worker" "actions-token") }}
 | 
			
		||||
---
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
{{- if .Values.actions.enabled }}
 | 
			
		||||
{{- if and (and .Values.actions.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
 | 
			
		||||
{{- if .Values.enabled }}
 | 
			
		||||
{{- if and (and .Values.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
 | 
			
		||||
{{- $name := include "gitea.workername" (dict "global" . "worker" "actions-token-job") }}
 | 
			
		||||
{{- $secretName := include "gitea.workername" (dict "global" . "worker" "actions-token") }}
 | 
			
		||||
---
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
{{- if .Values.actions.enabled }}
 | 
			
		||||
{{- if and (and .Values.actions.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
 | 
			
		||||
{{- if .Values.enabled }}
 | 
			
		||||
{{- if and (and .Values.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
 | 
			
		||||
{{- $name := include "gitea.workername" (dict "global" . "worker" "actions-token-job") }}
 | 
			
		||||
{{- $secretName := include "gitea.workername" (dict "global" . "worker" "actions-token") }}
 | 
			
		||||
---
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
{{- if .Values.actions.enabled }}
 | 
			
		||||
{{- if and (and .Values.actions.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
 | 
			
		||||
{{- if .Values.enabled }}
 | 
			
		||||
{{- if and (and .Values.provisioning.enabled .Values.persistence.enabled) .Values.persistence.mount }}
 | 
			
		||||
{{- $name := include "gitea.workername" (dict "global" . "worker" "actions-token-job") }}
 | 
			
		||||
---
 | 
			
		||||
apiVersion: v1
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
{{- if .Values.actions.enabled }}
 | 
			
		||||
{{- if .Values.enabled }}
 | 
			
		||||
{{- $secretName := include "gitea.workername" (dict "global" . "worker" "actions-token") }}
 | 
			
		||||
---
 | 
			
		||||
apiVersion: apps/v1
 | 
			
		||||
@@ -6,11 +6,11 @@ kind: StatefulSet
 | 
			
		||||
metadata:
 | 
			
		||||
  labels:
 | 
			
		||||
    {{- include "gitea.labels.actRunner" . | nindent 4 }}
 | 
			
		||||
    {{- with .Values.actions.statefulset.labels }}
 | 
			
		||||
    {{- with .Values.statefulset.labels }}
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
  annotations:
 | 
			
		||||
    {{- with .Values.actions.statefulset.annotations }}
 | 
			
		||||
    {{- with .Values.statefulset.annotations }}
 | 
			
		||||
    {{- toYaml . | nindent 4 }}
 | 
			
		||||
    {{- end }}
 | 
			
		||||
  name: {{ include "gitea.fullname" . }}-act-runner
 | 
			
		||||
@@ -22,27 +22,27 @@ spec:
 | 
			
		||||
  template:
 | 
			
		||||
    metadata:
 | 
			
		||||
      annotations:
 | 
			
		||||
        checksum/config: {{ include (print $.Template.BasePath "/gitea/act_runner/config-act-runner.yaml") . | sha256sum }}
 | 
			
		||||
        checksum/config: {{ include (print $.Template.BasePath "/config-act-runner.yaml") . | sha256sum }}
 | 
			
		||||
      labels:
 | 
			
		||||
        {{- include "gitea.labels.actRunner" . | nindent 8 }}
 | 
			
		||||
        {{- with .Values.actions.statefulset.labels }}
 | 
			
		||||
        {{- with .Values.statefulset.labels }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
    spec:
 | 
			
		||||
      initContainers:
 | 
			
		||||
        - name: init-gitea
 | 
			
		||||
          image: "{{ .Values.actions.init.image.repository }}:{{ .Values.actions.init.image.tag }}"
 | 
			
		||||
          image: "{{ .Values.init.image.repository }}:{{ .Values.init.image.tag }}"
 | 
			
		||||
          command:
 | 
			
		||||
            - sh
 | 
			
		||||
            - -c
 | 
			
		||||
            - |
 | 
			
		||||
              while ! nc -z {{ include "gitea.fullname" . }}-http {{ .Values.service.http.port }}; do
 | 
			
		||||
              while ! nc -z {{ include "gitea.act_runner.nc" . }}; do
 | 
			
		||||
                sleep 5
 | 
			
		||||
              done
 | 
			
		||||
      containers:
 | 
			
		||||
        - name: act-runner
 | 
			
		||||
          image: "{{ .Values.actions.statefulset.actRunner.repository }}:{{ .Values.actions.statefulset.actRunner.tag }}"
 | 
			
		||||
          imagePullPolicy: {{ .Values.actions.statefulset.actRunner.pullPolicy }}
 | 
			
		||||
          image: "{{ .Values.statefulset.actRunner.repository }}:{{ .Values.statefulset.actRunner.tag }}"
 | 
			
		||||
          imagePullPolicy: {{ .Values.statefulset.actRunner.pullPolicy }}
 | 
			
		||||
          workingDir: /data
 | 
			
		||||
          env:
 | 
			
		||||
            - name: DOCKER_HOST
 | 
			
		||||
@@ -54,14 +54,14 @@ spec:
 | 
			
		||||
            - name: GITEA_RUNNER_REGISTRATION_TOKEN
 | 
			
		||||
              valueFrom:
 | 
			
		||||
                secretKeyRef:
 | 
			
		||||
                  name: "{{ .Values.actions.existingSecret | default $secretName }}"
 | 
			
		||||
                  key: "{{ .Values.actions.existingSecretKey | default "token" }}"
 | 
			
		||||
                  name: "{{ .Values.existingSecret | default $secretName }}"
 | 
			
		||||
                  key: "{{ .Values.existingSecretKey | default "token" }}"
 | 
			
		||||
            - name: GITEA_INSTANCE_URL
 | 
			
		||||
              value: {{ include "gitea.act_runner.local_root_url" . }}
 | 
			
		||||
            - name: CONFIG_FILE
 | 
			
		||||
              value: /actrunner/config.yaml
 | 
			
		||||
          resources:
 | 
			
		||||
            {{- toYaml .Values.actions.statefulset.resources | nindent 12 }}
 | 
			
		||||
            {{- toYaml .Values.statefulset.resources | nindent 12 }}
 | 
			
		||||
          volumeMounts:
 | 
			
		||||
            - mountPath: /actrunner/config.yaml
 | 
			
		||||
              name: act-runner-config
 | 
			
		||||
@@ -70,12 +70,12 @@ spec:
 | 
			
		||||
              name: docker-certs
 | 
			
		||||
            - mountPath: /data
 | 
			
		||||
              name: data-act-runner
 | 
			
		||||
            {{- with .Values.actions.statefulset.actRunner.extraVolumeMounts }}
 | 
			
		||||
            {{- with .Values.statefulset.actRunner.extraVolumeMounts }}
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
        - name: dind
 | 
			
		||||
          image: "{{ .Values.actions.statefulset.dind.repository }}:{{ .Values.actions.statefulset.dind.tag }}"
 | 
			
		||||
          imagePullPolicy: {{ .Values.actions.statefulset.dind.pullPolicy }}
 | 
			
		||||
          image: "{{ .Values.statefulset.dind.repository }}:{{ .Values.statefulset.dind.tag }}"
 | 
			
		||||
          imagePullPolicy: {{ .Values.statefulset.dind.pullPolicy }}
 | 
			
		||||
          env:
 | 
			
		||||
            - name: DOCKER_HOST
 | 
			
		||||
              value: tcp://127.0.0.1:2376
 | 
			
		||||
@@ -83,28 +83,28 @@ spec:
 | 
			
		||||
              value: "1"
 | 
			
		||||
            - name: DOCKER_CERT_PATH
 | 
			
		||||
              value: /certs/server
 | 
			
		||||
            {{- if .Values.actions.statefulset.dind.extraEnvs }}
 | 
			
		||||
            {{- toYaml .Values.actions.statefulset.dind.extraEnvs | nindent 12 }}
 | 
			
		||||
            {{- if .Values.statefulset.dind.extraEnvs }}
 | 
			
		||||
            {{- toYaml .Values.statefulset.dind.extraEnvs | nindent 12 }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
          securityContext:
 | 
			
		||||
            privileged: true
 | 
			
		||||
          resources:
 | 
			
		||||
            {{- toYaml .Values.actions.statefulset.resources | nindent 12 }}
 | 
			
		||||
            {{- toYaml .Values.statefulset.resources | nindent 12 }}
 | 
			
		||||
          volumeMounts:
 | 
			
		||||
            - mountPath: /certs/server
 | 
			
		||||
              name: docker-certs
 | 
			
		||||
            {{- with .Values.actions.statefulset.dind.extraVolumeMounts }}
 | 
			
		||||
            {{- with .Values.statefulset.dind.extraVolumeMounts }}
 | 
			
		||||
            {{- toYaml . | nindent 12 }}
 | 
			
		||||
            {{- end }}
 | 
			
		||||
      {{- range $key, $value := .Values.actions.statefulset.nodeSelector }}
 | 
			
		||||
      {{- range $key, $value := .Values.statefulset.nodeSelector }}
 | 
			
		||||
      nodeSelector:
 | 
			
		||||
        {{ $key }}: {{ $value | quote }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.actions.statefulset.affinity }}
 | 
			
		||||
      {{- with .Values.statefulset.affinity }}
 | 
			
		||||
      affinity:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
      {{- with .Values.actions.statefulset.tolerations }}
 | 
			
		||||
      {{- with .Values.statefulset.tolerations }}
 | 
			
		||||
      tolerations:
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
      {{- end }}
 | 
			
		||||
@@ -114,7 +114,7 @@ spec:
 | 
			
		||||
            name: {{ include "gitea.fullname" . }}-act-runner-config
 | 
			
		||||
        - name: docker-certs
 | 
			
		||||
          emptyDir: {}
 | 
			
		||||
        {{- with .Values.actions.statefulset.extraVolumes }}
 | 
			
		||||
        {{- with .Values.statefulset.extraVolumes }}
 | 
			
		||||
        {{- toYaml . | nindent 8 }}
 | 
			
		||||
        {{- end }}
 | 
			
		||||
  volumeClaimTemplates:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user