Reusable Forgejo Actions workflows: docker builder, helm builder
  • Go 74.7%
  • Dockerfile 25.3%
Find a file
Jonas Leder b0e9b75cec
Some checks failed
docker-build.yml / Add reusable docker and helm build workflows (push) Failing after 0s
helm-build.yml / Add reusable docker and helm build workflows (push) Failing after 0s
selftest / docker (push) Has been cancelled
selftest / helm (push) Has been cancelled
selftest / build (push) Has been cancelled
selftest / build-1 (push) Has been cancelled
Add reusable docker and helm build workflows
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-18 00:10:23 +01:00
.forgejo/workflows Add reusable docker and helm build workflows 2026-11-18 00:10:23 +01:00
tests Add reusable docker and helm build workflows 2026-11-18 00:10:23 +01:00
README.md Add reusable docker and helm build workflows 2026-11-18 00:10:23 +01:00
renovate.json Add reusable docker and helm build workflows 2026-11-18 00:10:23 +01:00

ci-snippets

Reusable Forgejo Actions workflows for the infra organization. Other repositories include them with uses:, so a docker or helm build is a few lines.

The repository must stay public: Forgejo only resolves reusable workflows from public repositories.

Workflow Does
docker-build.yml multi-arch image build with rootless buildkit, push, trivy scan (image and repo)
helm-build.yml helm lint, package and optional push (OCI or helm package registry)

Docker image

.forgejo/workflows/build.yml in your repository:

on:
  push:
    branches: ['**']
    tags: ['**']

jobs:
  docker:
    uses: infra/ci-snippets/.forgejo/workflows/docker-build.yml@master
    secrets: inherit

Pushes <registry>/<owner>/<repo>:<branch> and :<commit sha>, latest on the default branch.

Inputs (all optional): image-name, image-tag, dockerfile-path (directory), architectures, push, additional-args, trivy-skip, trivy-timeout, registry-mirror, builder-image, runs-on. Outputs: digest, image. Reports (trivy JSON, SBOM, image-hash.txt) are uploaded as artifact build-reports.

Example that keeps the image name from GitLab, builds one architecture and uses the digest:

jobs:
  docker:
    uses: infra/ci-snippets/.forgejo/workflows/docker-build.yml@master
    with:
      image-name: forgejo.jonasled.dev/infra/some-image
      architectures: amd64
    secrets: inherit
  deploy:
    needs: docker
    runs-on: docker
    steps:
    - run: echo "${{ needs.docker.outputs.digest }}"

Helm chart

jobs:
  chart:
    uses: infra/ci-snippets/.forgejo/workflows/helm-build.yml@master
    with:
      chart-path: chart
      push: ${{ github.ref_type == 'tag' }}
    secrets: inherit
  • version: version input, else the tag without a leading v on tag builds, else Chart.yaml
  • registry-type: oci (default) pushes to oci://<host>/<owner>/<repo>/charts, so the old GitLab path jonasled.dev/<owner>/<repo>/charts stays the same; change it with oci-path
  • registry-type: classic pushes to <server>/api/packages/<owner>/helm, consume it with helm repo add x <server>/api/packages/<owner>/helm
  • other inputs: app-version, lint, runs-on; output: chart-version

Requirements

  • Runner with the label docker (or set runs-on). docker-build.yml needs a runner that allows privileged job containers: rootless buildkit needs user namespaces.
  • Forgejo with workflow_call support, and a runner version that supports it.
  • Push credentials: by default the automatic workflow token. If it cannot write packages in your setup, create a token with write:package and pass it as secret REGISTRY_TOKEN (and REGISTRY_USER); secrets: inherit passes them on.
  • builder-image defaults to forgejo.jonasled.dev/infra/docker-build:master. After the domain cutover change the default here once.

Known behaviour

Forgejo's container registry answers parallel uploads of a new package with HTTP 500 (duplicate package row). Both workflows retry the push, and the builder pushes each tag in its own build to avoid pushing the same blobs twice.

Tests

.forgejo/workflows/selftest.yml calls both workflows against tests/ without pushing.