Skip to content

Commit 79e59b0

Browse files
committed
fix(ci): lowercase image name in push-by-digest and merge paths
[github.repository] preserves owner casing — for this repo it's "Builder106/ocaml_limit", which Docker rejects as a repository name. The previous single-job workflow worked around this implicitly because [docker/metadata-action] lowercases its [images:] input when emitting [outputs.tags]; the new push-by-digest path constructs the image name directly via [outputs: type=image,name=...] and never goes through metadata action's auto-lowercasing. Bash parameter expansion [${VAR,,}] does the lowercase locally in a small prep step. Applied to both the build matrix (per-arch push-by-digest) and the merge job (manifest-create + inspect).
1 parent 11eda40 commit 79e59b0

1 file changed

Lines changed: 28 additions & 10 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,22 @@ jobs:
9797
steps:
9898
- uses: actions/checkout@v4
9999

100-
# Sanitize the platform string for filenames / artifact names:
101-
# "linux/amd64" → "linux-amd64". Used below for both the GHA
102-
# cache scope (so amd64 + arm64 builds don't fight over cache
103-
# entries) and the digest-artifact name.
104-
- name: Sanitize platform name
105-
run: echo "PLATFORM_PAIR=${platform//\//-}" >> "$GITHUB_ENV"
100+
# Two small env preps:
101+
# IMAGE_NAME_LC — Docker rejects mixed-case repo names, but
102+
# ${{ github.repository }} preserves owner casing
103+
# ("Builder106/ocaml_limit"). The old workflow leaned on
104+
# [docker/metadata-action] silently lowercasing its
105+
# [images:] input; the push-by-digest path doesn't go
106+
# through metadata-action, so do it here.
107+
# PLATFORM_PAIR — "linux/amd64" → "linux-amd64". Used as the
108+
# GHA cache scope (so amd64 + arm64 builds don't fight over
109+
# cache entries) and the digest-artifact name.
110+
- name: Prep env
111+
run: |
112+
echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >> "$GITHUB_ENV"
113+
echo "PLATFORM_PAIR=${platform//\//-}" >> "$GITHUB_ENV"
106114
env:
115+
IMAGE_NAME: ${{ env.IMAGE_NAME }}
107116
platform: ${{ matrix.platform }}
108117

109118
- name: Set up Docker Buildx
@@ -128,7 +137,7 @@ jobs:
128137
with:
129138
context: .
130139
platforms: ${{ matrix.platform }}
131-
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }},push-by-digest=true,name-canonical=true,push=true
140+
outputs: type=image,name=${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }},push-by-digest=true,name-canonical=true,push=true
132141
cache-from: type=gha,scope=${{ env.PLATFORM_PAIR }}
133142
cache-to: type=gha,mode=max,scope=${{ env.PLATFORM_PAIR }}
134143
# See merge job below for why these stay off.
@@ -163,6 +172,15 @@ jobs:
163172
packages: write
164173

165174
steps:
175+
# Same lowercase prep as the build job — Docker rejects
176+
# mixed-case repo names, and we reference the image directly
177+
# in the manifest-create shell pipeline (which doesn't go
178+
# through metadata-action's auto-lowercasing).
179+
- name: Prep env
180+
run: echo "IMAGE_NAME_LC=${IMAGE_NAME,,}" >> "$GITHUB_ENV"
181+
env:
182+
IMAGE_NAME: ${{ env.IMAGE_NAME }}
183+
166184
- name: Download digests
167185
uses: actions/download-artifact@v4
168186
with:
@@ -184,7 +202,7 @@ jobs:
184202
id: meta
185203
uses: docker/metadata-action@v5
186204
with:
187-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
205+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}
188206
tags: |
189207
type=raw,value=latest,enable={{is_default_branch}}
190208
type=sha,prefix=sha-,format=short
@@ -201,12 +219,12 @@ jobs:
201219
run: |
202220
docker buildx imagetools create \
203221
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
204-
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@sha256:%s ' *)
222+
$(printf '${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}@sha256:%s ' *)
205223
206224
- name: Inspect resulting manifest
207225
run: |
208226
docker buildx imagetools inspect \
209-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }}
227+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LC }}:${{ steps.meta.outputs.version }}
210228
211229
deploy:
212230
needs: merge

0 commit comments

Comments
 (0)