Skip to content

ci: add CI to create OCI image on release - #156

Merged
maddie merged 3 commits into
librespeed:masterfrom
iTrooz:ghcr-container-publishing
Nov 20, 2026
Merged

maddie merged 3 commits into
librespeed:masterfrom
iTrooz:ghcr-container-publishing

Conversation

@iTrooz

@iTrooz iTrooz commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

This adds a CI that will push ghcr.io/librespeed/speedtest-cli:latest to track the latest git tag, and additionally push an image dedicated to this tag (e.g. ghcr.io/librespeed/speedtest-cli:v1.2.3)

The CI will also run in PRs to test building the image

@iTrooz iTrooz changed the title ci: add CI to create image on every commit ci: add CI to create OCI image on release Oct 24, 2026
@iTrooz
iTrooz marked this pull request as draft October 24, 2026 17:28
@iTrooz
iTrooz force-pushed the ghcr-container-publishing branch from fd89f8e to 2f31977 Compare October 24, 2026 18:59
@iTrooz iTrooz mentioned this pull request Oct 24, 2026
@iTrooz
iTrooz marked this pull request as ready for review October 24, 2026 18:59

@maddie maddie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding release image publishing. The workflow is structurally valid (actionlint passes), but I found two issues that should be fixed before this can be merged.

❌ .github/workflows/container.yml:18-20 — publishing privilege is granted to the PR job

The single container job has packages: write and also runs on pull_request (container.yml:9). Fork PRs get a read-only token, but a same-repository PR can modify this workflow and use github.token to publish or overwrite the GHCR package before review. The build job does not need package-write access.

Please split the workflow into:

  • a pull_request / master build job with contents: read only, load: true, and the smoke test;
  • a tag-only publish workflow (on.push.tags: ['v*']) with packages: write, GHCR login, metadata, and push: true.

A tag-only workflow cannot be triggered by PR code, which closes this path.

❌ .github/workflows/container.yml:50-52 — latest moves for every v* tag

type=raw,value=latest is applied to every tag, including prereleases and backfilled maintenance tags. A v2.0.0-rc1 push or an older tag pushed later will move latest to the wrong image; concurrent tag pushes also race on the last writer.

type=ref,event=tag already produces the exact release tag. Please either remove the floating latest tag, or enable it only when the pushed tag is the highest stable semver tag (the checkout already uses fetch-depth: 0). If “latest = most recently pushed tag” is intentional, please document that instead of implying “latest release.”

💡 .github/workflows/container.yml:64-66 — the published image is never smoke-tested

The smoke test is skipped on tags, so the multi-arch image that actually ships is not run. Consider running the pushed amd64 image (and optionally arm64) with --version after the tag build.

💡 .github/workflows/container.yml:22,30,34,38,47,55 — actions use mutable major tags

These actions run in a job with package-write access. Pinning to full commit SHAs (with the version in a comment) would reduce supply-chain risk and is compatible with Dependabot's action updates.

💡 .github/workflows/container.yml:30-32 — QEMU is set up for PR builds

PR and master builds use only linux/amd64 (line 58), so QEMU is unnecessary there. Add if: github.ref_type == 'tag' to the QEMU step.

The trigger split, load/push handling, image-name lowercasing, and removal of the old Docker job otherwise look correct. I did not run Docker; validation was YAML parsing plus actionlint, so the workflow still needs a real Actions run after the changes.

Assisted-by: GPT-6.1 Terra
@iTrooz

iTrooz commented Nov 18, 2026

Copy link
Copy Markdown
Contributor Author

I fixed everything in your review message

@maddie maddie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review at dd02e4c — approved

Both ❌ findings from the previous review are resolved:

  • .github/workflows/container.yml:9-10 keeps the PR/master build read-only (contents: read), and publishing moved to the tag-only .github/workflows/container-publish.yml:3-10 with packages: write. PR code can no longer reach the publishing token.
  • .github/workflows/container-publish.yml:42-50 enables latest only when the pushed tag is the highest stable vX.Y.Z tag. Prerelease and backfilled tags no longer move it, and concurrency: container-publish serializes tag runs.

The 💡 nits are also addressed: the published image is smoke-tested by digest at .github/workflows/container-publish.yml:72-73, every action is pinned to a commit SHA that matches its release tag, and QEMU is limited to the tag build.

Validation: actionlint passes on both workflows; go test -count=1 ./... and go vet ./... pass at dd02e4c with Go 1.26.8; the PR checks Build container and Go build pass. The tag-push publish path cannot run on a PR, so it remains unverified until the first release. I checked the tag-selection shell logic locally against the existing v1.0.x tags; it resolves v1.0.15.

No remaining ❌ findings. Approved — ready for merge.

@maddie

maddie commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Approved — ready for merge. The merge itself is blocked by this session's GitHub credential, which lacks the workflow scope required for a PR that edits .github/workflows/*. Please squash-merge with a workflow-scoped credential; the PR is otherwise clean and both checks pass.

@maddie
maddie merged commit 096d72a into librespeed:master Nov 20, 2026
2 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.

2 participants