- Go 74.7%
- Dockerfile 25.3%
|
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
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> |
||
|---|---|---|
| .forgejo/workflows | ||
| tests | ||
| README.md | ||
| renovate.json | ||
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:
versioninput, else the tag without a leadingvon tag builds, elseChart.yaml registry-type: oci(default) pushes tooci://<host>/<owner>/<repo>/charts, so the old GitLab pathjonasled.dev/<owner>/<repo>/chartsstays the same; change it withoci-pathregistry-type: classicpushes to<server>/api/packages/<owner>/helm, consume it withhelm 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 setruns-on).docker-build.ymlneeds a runner that allows privileged job containers: rootless buildkit needs user namespaces. - Forgejo with
workflow_callsupport, 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:packageand pass it as secretREGISTRY_TOKEN(andREGISTRY_USER);secrets: inheritpasses them on. builder-imagedefaults toforgejo.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.