A one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
TypeScript agent-skillsaidsh-pluginhacktoberfestjavascriptmcp-serverreactresume-builderself-hostedtypescript
test(tooling): cover GHCR-only image promotion
Amruth Pillaifb555c3079c0
diff --git a/tooling/docker-publishing.test.ts b/tooling/docker-publishing.test.tsindex 5a2b7c3f6..b69ec0416 100644--- a/tooling/docker-publishing.test.ts+++ b/tooling/docker-publishing.test.ts@@ -86,15 +86,13 @@ it("validates release tags against the built version and distinguishes prereleas});it.each([- ["both registries", "", false, false, false, 0, 2],- ["GHCR only", "", false, true, false, 0, 1],- ["missing GHCR source", "ghcr.io/example/app", false, false, false, 1, 0],- ["incomplete Docker Hub index", "", true, false, false, 1, 0],- ["registry changes copied digest", "", false, false, true, 1, 1],-])("promotes complete SHA indexes: %s", (_name, missing, incomplete, ghcrOnly, changed, status, copies) => {+ ["complete GHCR index", "", false, false, 0, 1],+ ["missing GHCR source", "ghcr.io/example/app", false, false, 1, 0],+ ["incomplete GHCR index", "", true, false, 1, 0],+ ["registry changes copied digest", "", false, true, 1, 1],+])("promotes complete SHA indexes: %s", (_name, missing, incomplete, changed, status, copies) => {const directory = mkdtempSync(join(tmpdir(), "docker-promotion-"));const ghcr = "ghcr.io/example/app";- const hub = "docker.io/example/app";const commit = "a".repeat(40);const digest = `sha256:${"b".repeat(64)}`;const log = join(directory, "copies");@@ -119,7 +117,7 @@ case "$3" ininspect)[[ -z "$MISSING" || "$4" != "$MISSING:sha-$COMMIT_SHA" ]] || exit 1if [[ "$5" == "--raw" ]]; then- if [[ "$INCOMPLETE" == true && "$4" == docker.io/* ]]; then+ if [[ "$INCOMPLETE" == true ]]; thencat "$FIXTURE/incomplete.json"elsecat "$FIXTURE/complete.json"@@ -142,7 +140,6 @@ esac`,{ mode: 0o755 },);- const images = ghcrOnly ? [ghcr] : [hub, ghcr];const result = spawnSync("bash", [new URL("./docker/promote.sh", import.meta.url).pathname], {encoding: "utf8",env: {@@ -152,7 +149,7 @@ esacGHCR_IMAGE: ghcr,GITHUB_OUTPUT: output,DOCKER_METADATA_OUTPUT_JSON: JSON.stringify({- tags: images.flatMap((image) => [`${image}:latest`, `${image}:v6.0.0`]),+ tags: [`${ghcr}:latest`, `${ghcr}:v6.0.0`],}),MISSING: missing,INCOMPLETE: String(incomplete),@@ -172,10 +169,8 @@ esacexpect(result.stdout).toContain("Digest changed while promoting");expect(readFileSync(output, "utf8")).toBe("");} else {- expect(copied).toEqual(images.flatMap((image) => [`${image}@${digest}`, `${image}:latest`, `${image}:v6.0.0`]));- expect(readFileSync(output, "utf8")).toBe(- `${ghcrOnly ? "" : `docker_digest=${digest}\n`}ghcr_digest=${digest}\n`,- );+ expect(copied).toEqual([`${ghcr}@${digest}`, `${ghcr}:latest`, `${ghcr}:v6.0.0`]);+ expect(readFileSync(output, "utf8")).toBe(`ghcr_digest=${digest}\n`);}} finally {rmSync(directory, { recursive: true, force: true });