From 0edfe5fba63eee7b8109cb9541e453ffbda9a83c Mon Sep 17 00:00:00 2001 From: Ceddaerrix Date: Fri, 2 Jan 2026 17:57:52 +0000 Subject: [PATCH] feat(chart): add dry support to "gitea.actions.local_root_url" function (#74) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Description of the change Introducing use of the `tpl` function into _"gitea.actions.local_root_url"_ (in `_helpers.tpl`) so templating into the `giteaRootURL` parameter can be interpreted. Hence, it will permit the use of values already set in other parameters. ### Benefits To allow in an umbrella chart referencing to other values for setting the Gitea Root URL ### Possible drawbacks ### Applicable issues - Fixes # ### Additional information ### ⚠ BREAKING - N/A ### Checklist - [x] Helm templating unittests are added (required when changing anything in `templates` folder) Co-authored-by: 212597596 Reviewed-on: https://gitea.com/gitea/helm-actions/pulls/74 Reviewed-by: DaanSelen Co-authored-by: Ceddaerrix Co-committed-by: Ceddaerrix --- templates/_helpers.tpl | 2 +- unittests/helm/statefulset.yaml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/templates/_helpers.tpl b/templates/_helpers.tpl index 3d4216e..1077eda 100644 --- a/templates/_helpers.tpl +++ b/templates/_helpers.tpl @@ -84,7 +84,7 @@ app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} {{- define "gitea.actions.local_root_url" -}} - {{- .Values.giteaRootURL -}} + {{- tpl .Values.giteaRootURL . -}} {{- end -}} {{/* diff --git a/unittests/helm/statefulset.yaml b/unittests/helm/statefulset.yaml index 948bfe8..c863120 100644 --- a/unittests/helm/statefulset.yaml +++ b/unittests/helm/statefulset.yaml @@ -429,3 +429,35 @@ tests: content: mountPath: /mnt name: my-dind-volume + - it: should interpret Gitea Root URL templating + template: templates/statefulset.yaml + set: + global: + gitea: + service: + name: "my-gitea-svc-http" + port: 3210 + enabled: true + giteaRootURL: "http://{{ .Values.global.gitea.service.name }}:{{ .Values.global.gitea.service.port }}" + asserts: + - hasDocuments: + count: 1 + - containsDocument: + kind: StatefulSet + apiVersion: apps/v1 + name: gitea-unittests-actions-act-runner + - equal: + path: spec.template.spec.containers[0].env[1].name + value: "GITEA_INSTANCE_URL" + - equal: + path: spec.template.spec.containers[0].env[1].value + value: "http://my-gitea-svc-http:3210" + - equal: + path: spec.template.spec.initContainers[0].command[2] + value: | + echo 'Trying to reach Gitea on http://my-gitea-svc-http:3210' + until timeout 10 wget --no-check-certificate --spider http://my-gitea-svc-http:3210; do + sleep 3 + echo "Trying again in 3 seconds..." + done + echo "Gitea has been reached!"