Stephen Sullivan 3b5bdc30f5 feat(chart): Added helper functions to generate the container image values (#61)
<!--
 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. -->

The change modifies how container images are managed in the Gitea Helm chart for Gitea Actions. Instead of using a simple string concatenation for image names, the patch introduces a more flexible templating approach. It adds three new templates in `_helpers.tpl`:

  * `gitea.actions.actRunner.image`: Constructs the full image name for the Gitea Actions Act Runner.
  * `gitea.actions.dind.image`: Creates the image name for the DinD (Docker-in-Docker) container.
  * `gitea.actions.init.image`: Generates the image name for the Init container.

These templates build the image name dynamically using values from `values.yaml` and the chart's metadata. The logic prioritizes a full image override, a specified registry, or a default repository and tag.

The patch also updates `statefulset.yaml` to use these new templates for the `init-gitea`, `act-runner`, and `dind` containers. Additionally, `values.yaml` is updated to include new, optional parameters for each image, such as `registry`, `digest`, and `fullOverride`, providing more granular control over the image source.

### Tests and Examples

To test this change, you can use `helm template` with different configurations in a `values.yaml` file to observe the resulting Kubernetes manifest.

#### Example 1: Default configuration

With no changes to the new fields in `values.yaml`, the image names should resolve to the defaults:

  * **Act Runner**: `docker.gitea.com/gitea/act_runner:0.2.13`
  * **DinD**: `docker:28.3.3-dind`
  * **Init**: `busybox:1.37.0`

#### Example 2: Using a `fullOverride`

If you set `fullOverride` for the `actRunner` like this via CLI

```shell
 helm template test . \
    --set giteaRootURL=https://localhost/gitea \
    --set existingSecret=test --set existingSecretKey=test \
    --set enabled=true \
    --set statefulset.actRunner.fullOverride="my.private.registry/custom-gitea-runner:latest"
```

The `statefulset.yaml` for the `act-runner` container will have its image field set to `my.private.registry/custom-gitea-runner:latest`.

```
        - name: act-runner
          image: "my.private.registry/custom-gitea-runner:latest"
```

#### Example 3: Using a custom `registry` and `digest`

```shell
 helm template test . \
    --set giteaRootURL=https://localhost/gitea \
    --set existingSecret=test --set existingSecretKey=test \
    --set enabled=true \
    --set statefulset.dind.registry="quay.io" \
    --set statefulset.dind.digest="sha256:abcdef123456"
```

The `statefulset.yaml` for the `dind` container will have its image field set to `quay.io/docker:28.3.3-dind@sha256:abcdef123456`.

```
      - name: dind
        image: "quay.io/docker:28.3.3-dind@sha256:abcdef123456"

```

#### Example 4: Using the `global.imageRegistry`

If you set global.imageRegistry
```shell
 helm template test . \
    --set giteaRootURL=https://localhost/gitea \
    --set existingSecret=test --set existingSecretKey=test \
    --set enabled=true \
    --set global.imageRegistry=quay.io
```

The `statefulset.yaml` for each container will have the following values

  * **Act Runner**: `quay.io/gitea/act_runner:0.2.13`
  * **DinD**: `quay.io/docker:28.3.3-dind`
  * **Init**: `quay.io/busybox:1.37.0`

### Benefits

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

There are no known limitations with this change. The new templating approach makes the chart more adaptable and configurable, offering more control than the previous method.

### Possible drawbacks

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

Increased configuration complexity

### Applicable issues

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

### 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

Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
Reviewed-on: https://gitea.com/gitea/helm-actions/pulls/61
Reviewed-by: Ross Golder <rossigee@noreply.gitea.com>
Reviewed-by: DaanSelen <daanselen@noreply.gitea.com>
Reviewed-by: Markus Pesch <volker.raschek@noreply.gitea.com>
Reviewed-by: ChristopherHX <christopherhx@noreply.gitea.com>
Co-authored-by: Stephen Sullivan <sjsullivan7@gmail.com>
Co-committed-by: Stephen Sullivan <sjsullivan7@gmail.com>
2025-09-21 15:24:49 +00:00
2025-04-03 17:52:36 +00:00
2025-04-03 17:52:36 +00:00
2025-03-06 21:59:42 +01:00
2025-03-06 21:59:42 +01:00
2025-03-05 00:37:20 +00:00
2025-04-03 17:52:36 +00:00

Gitea Actions Helm Chart

This helm chart serves as the way to deploy the Gitea act-runners alongside a running Gitea instance.
It serves as a standalone chart and does not rely on Gitea to be present in the same environment, however it needs to be able to reach a Gitea instance to function.
The parameters which can be used to customize the deployment are described below, check those out if you want to see if something is supported.

If you want to propose a new feature or mechanism, submit an issue here.

Docs

Docs

Rootless Defaults

If .Values.image.rootless: true, then the following will occur. In case you use .Values.image.fullOverride, check that this works in your image:

  • If .Values.provisioning.enabled: true, then uses the rootless Gitea image, must match helm-Gitea.

Quick-start

To get started, add the Helm repo, assuming you have not already:

helm repo add gitea-charts https://dl.gitea.com/charts/
helm repo update

Then pull the values.yaml file and fill it accordingly.

helm show values gitea-charts/actions > values.yaml

Deploy with your values, make sure the path is correct:

helm upgrade --install gitea-actions gitea-charts/actions -f values.yaml

You should be good to go!

Parameters

Gitea Actions

Name Description Value
enabled Create an act runner StatefulSet. false
init.image.repository The image used for the init containers busybox
init.image.tag The image tag used for the init containers 1.37.0
statefulset.replicas the amount of (replica) runner pods deployed 1
statefulset.timezone is the timezone that will be set in the act_runner image Etc/UTC
statefulset.annotations Act runner annotations {}
statefulset.labels Act runner labels {}
statefulset.resources Act runner resources {}
statefulset.nodeSelector NodeSelector for the statefulset {}
statefulset.tolerations Tolerations for the statefulset []
statefulset.affinity Affinity for the statefulset {}
statefulset.extraVolumes Extra volumes for the statefulset []
statefulset.actRunner.registry image registry, e.g. gcr.io,docker.io docker.gitea.com
statefulset.actRunner.repository The Gitea act runner image gitea/act_runner
statefulset.actRunner.tag The Gitea act runner tag 0.2.13
statefulset.actRunner.digest Image digest. Allows to pin the given image tag. Useful for having control over mutable tags like latest ""
statefulset.actRunner.pullPolicy The Gitea act runner pullPolicy IfNotPresent
statefulset.actRunner.fullOverride Completely overrides the image registry, path/image, tag and digest. ""
statefulset.actRunner.extraVolumeMounts Allows mounting extra volumes in the act runner container []
statefulset.actRunner.config Act runner custom configuration. See Act Runner documentation for details. Too complex. See values.yaml
statefulset.dind.registry image registry, e.g. gcr.io,docker.io ""
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 ""
statefulset.dind.fullOverride Completely overrides the image registry, path/image, tag and digest. ""
statefulset.dind.pullPolicy The Docker-in-Docker pullPolicy IfNotPresent
statefulset.dind.extraVolumeMounts Allows mounting extra volumes in the Docker-in-Docker container []
statefulset.dind.extraEnvs Allows adding custom environment variables, such as DOCKER_IPTABLES_LEGACY []
statefulset.persistence.size Size for persistence to store act runner data 1Gi
existingSecret Secret that contains the token ""
existingSecretKey Secret key ""
giteaRootURL URL the act_runner registers and connect with ""

Gitea Actions Init

Name Description Value
init.image.registry image registry, e.g. gcr.io,docker.io ""
init.image.repository The init image busybox
init.image.tag the init image tag 1.37.0
init.image.digest Image digest. Allows to pin the given image tag. Useful for having control over mutable tags like latest ""
init.image.pullPolicy The init image pullPolicy IfNotPresent
init.image.fullOverride Completely overrides the image registry, path/image, tag and digest. ""

Global

Name Description Value
global.imageRegistry global image registry override ""
global.storageClass global storage class override ""
Description
Helm chart for Gitea Actions
Readme MIT 303 KiB
Languages
Smarty 74.4%
Shell 17.2%
Makefile 8.4%