one image per call, timestamp tag from commit time

Gitea 1.27.0 panics expanding a called workflow whose matrix comes from
inputs, and the caller run is never created. Build one image per call
instead; the commit time keeps the tag identical across calls.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-16 19:29:22 +02:00
co-authored by Claude Opus 5.5
parent 9998d345d7
commit f55707417f
2 changed files with 89 additions and 89 deletions
+41 -18
View File
@@ -1,21 +1,23 @@
# ci
Reusable Gitea Actions workflows for the apps in the cluster. Needs Gitea 1.27 or later, which
expands called workflows on the server, so each image builds as its own job, in parallel across
the runners. The repository is public so every repo can call it.
expands called workflows on the server into their own jobs. The repository is public so every
repo can call it.
## `image.yaml`
Builds and pushes one or more images with a uniform tag set from
Builds and pushes one image with a uniform tag set from
[docker/metadata-action](https://github.com/docker/metadata-action):
| Tag | When |
|---|---|
| `<UTC yyyymmddHHMMSS>-<sha7>` | every build; Flux `ImagePolicy` sorts on the timestamp |
| `<UTC yyyymmddHHMMSS>-<sha7>` | every build; the timestamp is the **commit** time, Flux `ImagePolicy` sorts on it |
| `1.2.3`, `1.2`, `1` | on a `v1.2.3` git tag (`1` is skipped while the major is `0`; pre-releases only get the full version) |
| `latest` | on the default branch |
The tag set is computed once per run, so every image of a multi-image repo gets the same tags.
The tags depend only on the commit, not on when it was built. A repo with several images calls
the workflow once per image (the calls run as separate jobs, in parallel) and every image gets the
same tags; rebuilding a commit re-pushes its tags instead of producing a newer one.
If the `dockerhub-username` and `dockerhub-token` secrets are passed, every image is also pushed with the same tags to `docker.io/<dockerhub-username>/<image>`, e.g. `registry.traberph.de/public/homepage` → `docker.io/traberph/homepage`. Only pass them for public images: Docker Hub creates new repositories as public by default.
@@ -24,7 +26,7 @@ jobs:
test: ...
image:
needs: test
uses: traberph/ci/.gitea/workflows/image.yaml@main
uses: traberph/ci/.gitea/workflows/image.yaml@v1.0.0
with:
project: public
image: homepage
@@ -40,24 +42,45 @@ Inputs:
- `registry`: default `registry.traberph.de`.
- `project` (required): Harbor project, e.g. `public` or `private`.
- `image`: image name, used in Harbor (`<registry>/<project>/<image>`) and on Docker Hub.
- `image` (required): image name, used in Harbor (`<registry>/<project>/<image>`) and on Docker Hub.
- `context`: default `.`.
- `dockerfile`: default `<context>/Dockerfile`.
- `images`: several images instead of `image`/`context`/`dockerfile`, as a JSON array of `{"image", "context", "dockerfile"}`:
```yaml
project: uni-spam
images: |
[
{"image": "inference", "context": "services/inference"},
{"image": "webapp", "context": "services/webapp/frontend"}
]
```
- `platforms`: default `linux/amd64,linux/arm64`. QEMU is set up when an `arm` platform is listed.
- `build-args`: newline-separated `KEY=value`, passed to every image.
- `build-args`: newline-separated `KEY=value`.
- `push`: default `true`.
- `cache`: keep the layer cache in Harbor as `<image>:buildcache` (default `false`).
Outputs: `tag` (the timestamp tag), `version`, `tag-names`.
Outputs: `tag` (the timestamp tag), `version`, `tags` (the full image references).
Several images: one job per image, e.g.
```yaml
jobs:
inference:
uses: traberph/ci/.gitea/workflows/image.yaml@v1.0.0
with: {project: uni-spam, image: inference, context: services/inference}
secrets: ...
webapp:
uses: traberph/ci/.gitea/workflows/image.yaml@v1.0.0
with: {project: uni-spam, image: webapp, context: services/webapp/frontend}
secrets: ...
```
A matrix over images inside the called workflow (`matrix: ${{ fromJSON(inputs.…) }}`) does not
work on Gitea 1.27.0: its parser panics while expanding the call and the run is never created.
## Versions
Callers pin a release tag (`@v1.0.0`). Renovate in the calling repos proposes new tags; it needs
a rule pointing `traberph/ci` at this Gitea:
```json
{
"matchDepNames": ["traberph/ci"],
"overrideDatasource": "gitea-tags",
"registryUrls": ["https://git.traberph.de"]
}
```
## Updates