feat(chart): Added configuration parameter to specify extra environment variables for the act-runner container (#63)

<!--
 Before you open the request please review the following guidelines and tips to help it be more easily integrated:

 - Describe the scope of your change - i.e. what the change does.
 - Describe any known limitations with your change.
 - Please run any tests or examples that can exercise your modified code.

 Thank you for contributing! We will try to review, test and integrate the change as soon as we can.
 -->

### Description of the change

<!-- Describe the scope of your change - i.e. what the change does. -->

This patch adds a new configuration option, statefulset.actRunner.extraEnvs, to the Gitea act runner Helm chart. This new parameter is an array that allows users to define custom environment variables for the act-runner container within the StatefulSet.

### Benefits

<!-- What benefits will be realized by the code change? -->

Enables users of the chart to specify additional environment variables for the act-runner container.
This can be useful for cases where a user may want to customize the act-runner via environment variables.

### Possible drawbacks

<!-- Describe any known limitations with your change -->

### Applicable issues

<!-- Enter any applicable Issues here (You can reference an issue using #). Please remove this section if there is no referenced issue. -->
- Fixes #

### Additional information

<!-- If there's anything else that's important and relevant to your pull request, mention that information here. Please remove this section if it remains empty. -->

### ⚠ BREAKING

<!-- If there's a breaking change, please shortly describe in which way users are affected and how they can mitigate it. If there are no breakings, please remove this section. -->

### Checklist

<!-- [Place an '[X]' (no spaces) in all applicable fields. Please remove unrelated fields.] -->

- [X] Parameters are documented in the `values.yaml` and added to the `README.md` using [readme-generator-for-helm](https://github.com/bitnami-labs/readme-generator-for-helm)
- [X] Helm templating unittests are added (required when changing anything in `templates` folder)
- [X] All added template resources MUST render a namespace in metadata

Reviewed-on: https://gitea.com/gitea/helm-actions/pulls/63
Reviewed-by: DaanSelen <daanselen@noreply.gitea.com>
Co-authored-by: Stephen Sullivan <sjsullivan7@gmail.com>
Co-committed-by: Stephen Sullivan <sjsullivan7@gmail.com>
This commit is contained in:
Stephen Sullivan
2025-09-22 06:43:25 +00:00
committed by DaanSelen
parent 887211f153
commit 6ad4d5cee6
4 changed files with 44 additions and 0 deletions

View File

@@ -66,6 +66,7 @@ You should be good to go!
| `statefulset.actRunner.extraVolumeMounts` | Allows mounting extra volumes in the act runner container | `[]` |
| `statefulset.actRunner.config` | Act runner custom configuration. See [Act Runner documentation](https://docs.gitea.com/usage/actions/act-runner#configuration) for details. | `Too complex. See values.yaml` |
| `statefulset.dind.registry` | image registry, e.g. gcr.io,docker.io | `""` |
| `statefulset.actRunner.extraEnvs` | Allows adding custom environment variables | `[]` |
| `statefulset.dind.repository` | The Docker-in-Docker image | `docker` |
| `statefulset.dind.tag` | The Docker-in-Docker image tag | `28.3.3-dind` |
| `statefulset.dind.digest` | Image digest. Allows to pin the given image tag. Useful for having control over mutable tags like `latest` | `""` |

View File

@@ -66,6 +66,9 @@ spec:
value: /actrunner/config.yaml
- name: TZ
value: {{ .Values.statefulset.timezone | default "Etc/UTC" }}
{{- if .Values.statefulset.actRunner.extraEnvs }}
{{- toYaml .Values.statefulset.actRunner.extraEnvs | nindent 12 }}
{{- end }}
resources:
{{- toYaml .Values.statefulset.resources | nindent 12 }}
volumeMounts:

View File

@@ -129,6 +129,39 @@ tests:
- equal:
path: spec.template.spec.initContainers[0].image
value: test.io/busybox:1.37.0
- it: renders additional environment variables for act-runner container in StatefulSet
template: templates/statefulset.yaml
set:
enabled: true
existingSecret: "my-secret"
existingSecretKey: "my-secret-key"
statefulset:
actRunner:
extraEnvs:
- name: "CUSTOM_ENV"
value: "1"
- name: "GITEA_RUNNER_NAME"
valueFrom:
fieldRef:
fieldPath: metadata.name
asserts:
- hasDocuments:
count: 1
- containsDocument:
kind: StatefulSet
apiVersion: apps/v1
name: gitea-unittests-actions-act-runner
- equal:
path: spec.template.spec.containers[0].env[7]
value:
name: CUSTOM_ENV
value: "1"
- matchRegex:
path: spec.template.spec.containers[0].env[8].valueFrom.fieldRef.fieldPath
pattern: "metadata\\.name"
- matchRegex:
path: spec.template.spec.containers[0].env[8].name
pattern: "GITEA_RUNNER_NAME"
- it: doesn't renders a StatefulSet by default
template: templates/statefulset.yaml
asserts:

View File

@@ -22,6 +22,7 @@
## @param statefulset.actRunner.extraVolumeMounts Allows mounting extra volumes in the act runner container
## @param statefulset.actRunner.config [default: Too complex. See values.yaml] Act runner custom configuration. See [Act Runner documentation](https://docs.gitea.com/usage/actions/act-runner#configuration) for details.
## @param statefulset.dind.registry image registry, e.g. gcr.io,docker.io
## @param statefulset.actRunner.extraEnvs Allows adding custom environment variables
## @param statefulset.dind.repository The Docker-in-Docker image
## @param statefulset.dind.tag The Docker-in-Docker image tag
## @param statefulset.dind.digest Image digest. Allows to pin the given image tag. Useful for having control over mutable tags like `latest`
@@ -53,6 +54,12 @@ statefulset:
pullPolicy: IfNotPresent
fullOverride: ""
extraVolumeMounts: []
extraEnvs:
[]
# - name: "GITEA_RUNNER_NAME"
# valueFrom:
# fieldRef:
# fieldPath: metadata.name
# See full example here: https://gitea.com/gitea/act_runner/src/branch/main/internal/pkg/config/config.example.yaml
config: |