Skip to content

fix(ci): lowercase image ref before push-by-digest#41

Merged
strausmann merged 1 commit into
mainfrom
fix/docker-publish-lowercase-image-ref
May 10, 2026
Merged

fix(ci): lowercase image ref before push-by-digest#41
strausmann merged 1 commit into
mainfrom
fix/docker-publish-lowercase-image-ref

Conversation

@strausmann
Copy link
Copy Markdown
Owner

What broke

After #40 was merged, the first run on the native-arm64 pipeline failed in all four build legs with:

ERROR: failed to build: failed to solve: failed to parse ref
  \"ghcr.io/strausmann/Label-Printer-Hub-frontend\":
  invalid reference format: repository name
  (strausmann/Label-Printer-Hub-frontend) must be lowercase

Root cause

The GitHub repository is named Label-Printer-Hub (mixed case). \${{ github.repository }} keeps that casing, but OCI/Docker registry refs must be all-lowercase. The old single-phase workflow accidentally side-stepped this because docker/metadata-action lowercases the values it emits in outputs.tags / outputs.labels. The new two-phase workflow pushes by digest via build-push-action's outputs: name=… field, which is a raw passthrough — the mixed-case repo path reached buildx unchanged.

Fix

Both phases get an early Compute lowercase image ref step that does:

repo_lc=\"\${REPO,,}\"
echo \"ref=\${{ env.REGISTRY_GHCR }}/\${repo_lc}-\${{ matrix.service }}\" >> \"\$GITHUB_OUTPUT\"

(\${VAR,,} is bash's lowercase parameter expansion — POSIX shell would need tr, but the runner is bash.)

Every place the workflow needed a registry ref now uses \${{ steps.image.outputs.ref }}:

  • metadata-action images: (build + merge)
  • build-push-action outputs: name=… (build)
  • DIGEST_REPO env in the merge step

Verification (after merge)

gh workflow run docker-publish.yml -f tag=0.2.0 --ref main
gh run watch <new-run-id>

Expect: 4 native build jobs in ~30-45 s each, 2 merge jobs in ~10 s each, total run ~1:30 (vs. ~3:54 on the QEMU pipeline).

Copilot AI review requested due to automatic review settings May 10, 2026 20:48
@gemini-code-assist
Copy link
Copy Markdown

Note

Gemini is unable to generate a summary for this pull request due to the file types involved not being currently supported.

GitHub stores the repo path with the casing the user picked. Our repo
is `strausmann/Label-Printer-Hub`, so `${{ github.repository }}` keeps
the capital L/P/H. Docker/OCI registry references MUST be all-lowercase,
or buildx rejects the push with:

  ERROR: failed to build: failed to solve: failed to parse ref
  "ghcr.io/strausmann/Label-Printer-Hub-frontend":
  invalid reference format: repository name
  (strausmann/Label-Printer-Hub-frontend) must be lowercase

The old workflow accidentally side-stepped this because
`docker/metadata-action` lowercases `images:` for its own outputs.
The new pipeline pushes by digest via `build-push-action`'s
`outputs: name=…` field, which is a raw passthrough — the casing
from `${{ github.repository }}` reached buildx unchanged.

Both phases (build and merge) now have a `Compute lowercase image ref`
step that uses bash's `${VAR,,}` lowercase expansion, and reference
that step's output everywhere a registry ref appears.
@strausmann strausmann force-pushed the fix/docker-publish-lowercase-image-ref branch from 60cdf7d to 37eb08e Compare May 10, 2026 20:51
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes the Docker publish workflow failing on mixed-case GitHub repo names by normalizing the GHCR image reference to lowercase before using it in push-by-digest and manifest-merge operations.

Changes:

  • Add a Compute lowercase image ref step (in both build + merge phases) and route all GHCR image refs through steps.image.outputs.ref.
  • Update the build phase to use the computed lowercase ref in build-push-action’s outputs: type=image,name=… (push-by-digest).
  • Update metadata/merge steps to also use the computed lowercase image ref when assembling and tagging the multi-arch manifest.
Comments suppressed due to low confidence (1)

.github/workflows/docker-publish.yml:105

  • In the build phase, the Docker Hub login step appears unused now (the build only pushes by digest to the GHCR name=... reference). Consider removing this login from the build job and keeping Docker Hub auth only in the merge job where tags/manifests are pushed.
      - name: Log in to Docker Hub
        env:
          DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
          DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
        if: env.DOCKERHUB_USERNAME != '' && env.DOCKERHUB_TOKEN != ''

Comment on lines 151 to 155
file: ./${{ matrix.service }}/Dockerfile
platforms: ${{ matrix.platform }}
labels: ${{ steps.meta.outputs.labels }}
# `push-by-digest=true` skips the tag write and returns digest in
# `steps.build.outputs.digest`. `name-canonical=true` makes the
@strausmann strausmann merged commit 9dd954e into main May 10, 2026
9 checks passed
github-actions Bot pushed a commit that referenced this pull request May 11, 2026
## <small>0.2.1 (2026-05-11)</small>

* fix(ci): emit GHCR package description as index annotation (#39) ([12c6b6c](12c6b6c)), closes [#39](#39)
* fix(ci): lowercase image ref before push-by-digest (#41) ([9dd954e](9dd954e)), closes [#41](#41)
* fix(ci): repair docker-publish.yml startup failure (#37) ([fb7cb59](fb7cb59)), closes [#37](#37)
* fix(ci): repair Verify multi-arch manifest step + drop fail-fast (#38) ([5d2ff7d](5d2ff7d)), closes [#38](#38)
* refactor(ci): split docker-publish into native-arch matrix + manifest merge (#40) ([8cd824d](8cd824d)), closes [#40](#40)
* chore(deps): bump github.com/go-chi/chi/v5 from 5.1.0 to 5.2.2 in /frontend (#36) ([a5971b9](a5971b9)), closes [#36](#36)

[skip ci]
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