Skip to content

Publish a tested service image from CI and make the image start - #2

Merged
yablokolabs merged 1 commit into
mainfrom
add-container-image-cd
Oct 7, 2026
Merged

yablokolabs merged 1 commit into
mainfrom
add-container-image-cd

Conversation

@yablokolabs

Copy link
Copy Markdown
Owner

Summary

  • Delivery. A new CI job, image, publishes the service image to ghcr.io/yablokolabs/mender after the checks job passes: tags main and sha-<short> for a push to main; X.Y.Z, X.Y and latest for a tag vX.Y.Z.
  • Build check on pull requests. The same job builds the image, starts it and calls GET /healthz on each pull request, without a push.
  • Bug fix. The image from the old Dockerfile did not start: mender serve reads mender.yaml at startup, and the image did not contain it (config file not found: mender.yaml, exit 1). The Dockerfile now copies the file. It holds no secrets.
  • Action versions. actions/checkout v4 to v7 and astral-sh/setup-uv v5 to v10.2.0. setup-uv publishes exact version tags only, so it is pinned to one.

How it works

Event checks image: build and smoke test image: push
pull request yes yes no
push to main yes yes main, sha-<short>
tag vX.Y.Z yes yes X.Y.Z, X.Y, latest

The job uses the built-in GITHUB_TOKEN. Write permission for packages is declared on the image job only; no new secret is necessary.

Notes for the reviewer

  • The push steps run for the first time after this PR is merged. That run on main is their first real test.
  • A new package on GitHub Container Registry can start as private. If it does, make it public one time in the package settings.
  • The image is linux/amd64 only, because the Dockerfile downloads the amd64 kubectl binary.
  • The smoke test proves that the service starts and answers. A full run also needs the Docker socket and access to a cluster.

Test Plan

  • .github/workflows/image-smoke.sh fails on the image from the old Dockerfile (container exits, the log shows the missing config file)
  • make image passes on the new image
  • make test: ruff, ruff format, mypy, pytest (84 tests)
  • CI on this pull request: checks, then image (build and smoke test)
  • After the merge: the run on main pushes the image, and docker pull ghcr.io/yablokolabs/mender:main works

The repository had CI but no delivery, and the image that the Dockerfile built
did not start: `mender serve` reads mender.yaml at startup and the image did not
contain it ("config file not found: mender.yaml", exit 1).

The Dockerfile now copies mender.yaml. The file holds no secrets, and a
different one can be mounted at /app/mender.yaml.

.github/workflows/image-smoke.sh starts an image on a port that Docker chooses
and waits for GET /healthz to answer with status ok. It fails on the image from
the old Dockerfile and passes on the new one. `make image` builds and runs it.

ci.yml has a new job, image, that runs after the checks job. It builds the
image and runs the smoke test on each pull request. On main and on version tags
it then pushes the same build to ghcr.io/yablokolabs/mender: main and
sha-<short> for main; X.Y.Z, X.Y and latest for a tag vX.Y.Z. It uses the
built-in token with packages write permission on that job only.

The existing steps move to actions/checkout v7 and setup-uv v10.2.0. setup-uv
publishes exact version tags only, so it is pinned to one.
@yablokolabs
yablokolabs merged commit 8e4f90a into main Oct 7, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant