Skip to content

Check the tag, version, and latest tags before publishing a release image - #2603

Merged
kmcginnes merged 10 commits into
mainfrom
check-release-image-publish
Nov 17, 2026
Merged

kmcginnes merged 10 commits into
mainfrom
check-release-image-publish

Conversation

@kmcginnes

@kmcginnes kmcginnes commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A release run of build_docker.yml published whatever ref it ran on under that ref's package.json version and always moved latest, so a run on main could push over a published version, and a patch to an older line could move latest back.

Release mode now calls scripts/releaseImage.ts, which has no dependencies and runs on the Node from .node-version:

release run
  plan    (before credentials or any push)
    fail unless package.json version is X.Y.Z
    fail unless the ref is refs/tags/v<version>
    fail if <version> or sagemaker-<version> is in the ECR Public tag list
    tags = <version> sagemaker-<version>
    add latest sagemaker-latest only if <version> is above every published numeric tag
  build once, then tag and push each of the tags
  verify  every pushed tag has the same digest in the registry

"Above every published numeric tag" uses the order of the SageMaker notebook lifecycle script, which pulls sagemaker-<highest numeric tag> and never reads latest. A tag that isn't all numeric parts, such as latest or sagemaker-3.3.2, ranks lowest. So latest always matches what notebooks pull.

Snapshot runs push the same latest-SNAPSHOT and sagemaker-latest-SNAPSHOT tags as before, and skip the new steps.

The script reads the ref from GITHUB_REF, which is refs/tags/<tag> on a release: published event too, so publishing on release later only needs a new trigger.

To publish a release, dispatch on its tag, as the workflow header now says:

gh workflow run build_docker.yml --ref v<version> -f image_tag=release

The script sits next to the release version script in scripts/, in the same Vitest project. The runtime image copies only named paths, so scripts/ stays out of it.

The job sets IMAGE: public.ecr.aws/neptune/graph-explorer once. The push step and the script both read it, so the image is named in one place.

Evidence

Before: nothing checked the ref or the version, and latest moved on every release run.
After: scripts/releaseImage.test.ts covers a run on a branch, a tag that doesn't match package.json, a version already published, a non-X.Y.Z version, an older version (no latest move), the newest version (moves latest), numeric rather than text order, non-numeric tags, mixed or missing digests, a paged tag list, and throttled registry reads.

Verified live: read-only, against the public ECR Public API, with a package.json holding each version. No image was built or pushed, and the workflow was not run.

  • 3.3.2 and 3.3.1 fail as already published
  • 3.3.3 and 3.4.0 plan <version> sagemaker-<version> latest sagemaker-latest
  • a run on refs/heads/main fails the ref check
  • verify 3.3.2 sagemaker-3.3.2 latest sagemaker-latest passes on one digest
  • verify 3.3.2 latest-SNAPSHOT fails with two digests, and verify 3.3.3 fails as missing

actionlint passes on the workflow.

Merge Danger

Door: two-way

Impact: release process

Image consumers see no change. Every release still publishes <version> and sagemaker-<version>, and latest and sagemaker-latest now always point to the highest version.

A release dispatched on a branch now fails. Dispatch on the v<version> tag instead. Two release runs started at once can still both pass the plan before either pushes, so start one release at a time.

Related


🤖 Written by an AI agent on my behalf.

A two-platform build with the arm64 stages under emulation takes about 5 to 7 minutes, so 20 minutes leaves 3x headroom.
The release image checks join the version script in scripts/, with one test project. The runtime image copies only named paths, so scripts/ stays out of it.
@kmcginnes
kmcginnes force-pushed the check-release-image-publish branch from ad8a7ef to 0545909 Compare November 17, 2026 01:42
read -ra splits TAGS explicitly, so the push and verify steps quote every use and need no ShellCheck exception.
The workflow sets IMAGE for the whole job, and scripts/releaseImage.ts reads it instead of its own copy. testing.md goes back to main's wording, which already lists scripts.
Layer: check-release-image-publish
Layer: check-release-image-publish

@kmcginnes kmcginnes left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Approved

@kmcginnes
kmcginnes merged commit 87cf6cb into main Nov 17, 2026
6 checks passed
@kmcginnes
kmcginnes deleted the check-release-image-publish branch November 17, 2026 02:35
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.

Check the tag, version, and latest tags before publishing a release image

1 participant