Skip to content

Commit 9ac94e6

Browse files
Copilotneilime
andcommitted
Fix test expectations for cosign legacy tags on ghcr.io
Co-authored-by: neilime <314088+neilime@users.noreply.github.com>
1 parent a0361b5 commit 9ac94e6

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

.github/workflows/__test-workflow-docker-build-images.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,19 @@ jobs:
153153
const taggedVersions = versions.filter(version => version.metadata.container.tags.length > 0);
154154
const untaggedVersions = versions.filter(version => version.metadata.container.tags.length === 0);
155155
156-
// Expected tagged version is always 1 (the main tag)
157-
const expectedTaggedVersions = 1;
156+
const platforms = JSON.parse(process.env.PLATFORMS);
157+
const isSinglePlatform = platforms.length === 1;
158+
const isSigned = process.env.SIGN === 'true';
159+
160+
// Expected tagged versions:
161+
// - Always 1 for the main tag
162+
// - Plus 1 for cosign legacy tag (sha256-...) when signed
163+
// Note: ghcr.io doesn't support OCI 1.1 referrers yet, so cosign falls back to legacy attachments
164+
const expectedTaggedVersions = isSigned ? 2 : 1;
158165
159166
// Expected untagged versions:
160167
// - For single platform: 0 (no multiarch manifest created)
161168
// - For multi platform: number of platforms (one per platform)
162-
const platforms = JSON.parse(process.env.PLATFORMS);
163-
const isSinglePlatform = platforms.length === 1;
164169
const expectedUntaggedVersions = isSinglePlatform ? 0 : platforms.length;
165170
166171
assert.equal(

actions/docker/sign-images/action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ runs:
9191
const annotationsArgs = tags.size > 0 ? `-a tag=${Array.from(tags).at(-1)}` : "";
9292
const imagesArgs = Array.from(imagesToSign).join(" ");
9393
// Use OCI 1.1 referrers mode to avoid creating legacy sha256-... tags
94+
// Note: If the registry doesn't support OCI 1.1 referrers (like ghcr.io currently),
95+
// cosign will fall back to legacy attachments and create a sha256-... tag
9496
const signImageCommand = `cosign sign ${annotationsArgs} --registry-referrers-mode=oci-1-1 --yes ${imagesArgs}`;
9597
9698
core.debug(`Signing images with command: "${signImageCommand}"`);

0 commit comments

Comments
 (0)