Skip to content

chore(release): publish multi-arch CUDA images to GHCR - #3550

Merged
inureyes merged 6 commits into
mainfrom
chore/issue-3485-ghcr-cuda-images
Nov 28, 2026
Merged

inureyes merged 6 commits into
mainfrom
chore/issue-3485-ghcr-cuda-images

Conversation

@inureyes

@inureyes inureyes commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Summary

  • New publish-images job in release.yml: after both Linux CUDA build jobs succeed it builds docker/Dockerfile.cuda (runtime, debug) for linux/amd64,linux/arm64 from the release zips those jobs just uploaded and pushes one manifest list per target to ghcr.io/lablup/mlxcel, with BuildKit SBOM, provenance: mode=max, and an actions/attest provenance attestation pushed to the registry. Only this job gets packages, id-token and attestations write; every action in it is SHA-pinned. No QEMU: every RUN executes on the build platform.
  • Versioned tags (vX.Y.Z-cuda13, -debug) are pushed first. Moving tags are added last with imagetools create, re-decided from a fresh release list at that point, so a failed debug build cannot leave latest moved alone and an older release finishing last cannot take it. The job condition uses !cancelled(), so a cancelled run does not publish.
  • scripts/ci/docker_image_tags.sh holds the tag rule: moving tags only for a release event of a stable vX.Y.Z that is a full release and the newest of its line. Any hyphen suffix counts as a prerelease (not only alpha|beta|rc), because betas are promoted to full releases and the release flag cannot tell them apart. Dispatches, betas, backports and re-runs of older tags never move latest. Beyond the issue's tag contract, vX.Y-cuda13 (and -debug) is added under the same rule.
  • A tag without the Dockerfile or these scripts is skipped with a notice.
  • ci.yml: docker-build (on docker/**, .dockerignore, the header allow-list or the disk script) builds both targets for both platforms from the newest release with all four CUDA zips, no login or push; docker-image-tags runs the tag tests.
  • scripts/ci/free_docker_disk.sh removes preinstalled SDKs and moves Docker's data root to /mnt when that disk is larger; it refuses to run unless RUNNER_ENVIRONMENT is github-hosted.

Validation

  • actionlint 1.7.7 with CI's shellcheck floor passes; full-severity finding count unchanged from main. check_cuda_arch_lists.py passes.
  • docker_image_tags_test.sh: 20 cases pass on macOS and Linux; a mutation of the event gate is caught. With the real release list, v0.9.0 gets the moving tags and a beta gets none.
  • spark1 (arm64) dry run of the job's build flags, pushing v0.9.0-beta.3 into a loopback registry:2: both indexes list linux/amd64, linux/arm64 and two attestation manifests, with SPDX SBOM and provenance for both platforms and the index annotations. imagetools create for latest-cuda13, v0.9-cuda13 and latest-cuda13-debug kept the same index digests. Builder storage peaked at 28.9 GB (runtime) and 47.5 GB (debug).
  • docker-build on this PR passed on a hosted amd64 runner in 12 minutes: both targets for both platforms from v0.9.0-beta.3, so the amd64-host arm64 cross build works. Root had 113 GB free after cleanup, so the /mnt move did not trigger.
  • GPU smoke of the pulled arm64 image did not pass, for a reason outside this PR: v0.9.0-beta.3 predates fix(cuda): make NVRTC JIT need only redistributable CUDA headers #3540, so the CLI fails on cooperative_groups.h. Every tag that has the Dockerfile contains fix(cuda): make NVRTC JIT need only redistributable CUDA headers #3540 (15e63955 precedes 66c13292).

Not validated

  • The real GHCR push, GITHUB_TOKEN package permissions, gh attestation verify, SBOM and attestation push on a hosted runner (docker-build neither pushes nor attests), and the /mnt relocation branch.
  • A passing GPU smoke of a published image on either arch.
  • Left open from feat(docker): Add CUDA container image with mlxcel and mlxcel-server #3484: base images are pinned by tag, not digest, and the chisel .sha384 is fetched from the same release. mode=max provenance records the resolved base digests.

The first push creates the GHCR package as private; set it public once in the package settings.

Closes #3485

Every release now gets a container image that matches its binaries. A new publish-images job in release.yml runs after both Linux CUDA build jobs succeed, builds docker/Dockerfile.cuda for linux/amd64 and linux/arm64 from the release zips just uploaded (the Dockerfile checks each against its .sha256), and pushes one manifest list per target to ghcr.io/lablup/mlxcel with BuildKit SBOM and max provenance plus a GitHub build provenance attestation. Only this job gets packages, id-token and attestations write. No QEMU is used: every RUN in the Dockerfile executes on the build platform.

Versioned tags (vX.Y.Z-cuda13, -debug) are pushed first. The moving tags (vX.Y-cuda13, latest-cuda13 and their -debug twins) are added with imagetools create only after both images are pushed and attested, so a failed debug build cannot leave latest moved alone. scripts/ci/docker_image_tags.sh holds the rule: moving tags only for a release event of a stable vX.Y.Z (any hyphen suffix counts as a prerelease) that is a full release and the newest of its line, so dispatches, betas, backports and re-runs of older tags leave latest alone. A tag without docker/Dockerfile.cuda is skipped with a notice.

ci.yml gains docker-build (runtime for both platforms, debug for amd64, from the newest release with all four CUDA zips, no login or push) on docker/** changes, and docker-image-tags running the tag rule's tests.

Refs #3485
The spark1 dry run measured the buildx builder at 28.9 GB after the two-platform runtime build and 47.5 GB after the two-platform debug build. scripts/ci/free_docker_disk.sh now removes the preinstalled SDKs for both publish-images and docker-build and moves the Docker data root to /mnt when that disk has more room. docker-build now builds debug for both platforms as well, so that disk peak and the amd64-host arm64 build meet a hosted runner before a release does.

publish-images skips with a notice when the tag predates the Dockerfile or the publish scripts, instead of failing on a self-healing dispatch of an older tag.

Refs #3485
@inureyes inureyes added status:review Under review type:chore Maintenance tasks (build, CI, etc.) priority:medium Medium priority platform:linux Linux (CUDA / packaging) specific labels Nov 28, 2026
@inureyes

Copy link
Copy Markdown
Member Author

Implementation Review Summary

Intent

Publish the runtime and debug CUDA images of docker/Dockerfile.cuda to ghcr.io/lablup/mlxcel as one amd64+arm64 manifest list per release, with gated moving tags and a no-push PR build check.

Findings Addressed

None needed. No CRITICAL or HIGH findings.

Remaining Items

  • publish-images uses always(), so a run cancelled after both Linux builds succeed still starts publishing; !cancelled() would avoid it. Kept because the issue text and promote-release use always() (MEDIUM)
  • The alias tags are computed at the start of the job and applied after the two builds. If two stable releases land inside one image build window and finish out of order, latest-cuda13 can end on the older one. Re-reading gh release list just before the move step would close this (MEDIUM)
  • A stable tag that stays a prerelease (promotion failed) still counts as newest, so later lower stable tags do not move latest-cuda13. This is the side of the trade-off that avoids the race above (LOW)
  • The docker path filter does not include ci.yml, so an edit to the docker-build job alone does not run it (LOW)
  • The dispatch push, gh attestation verify, the GPU smoke test and GHCR package visibility need a real workflow_dispatch with a test tag; they cannot be checked before merge (unverified)

Verification

  • All stated requirements implemented
  • No placeholder/mock code remaining
  • Integrated into project code flow
  • Project conventions followed
  • Existing modules reused where applicable
  • No unintended structural changes
  • Tests pass (actionlint on both workflows, docker_image_tags_test.sh, shellcheck; CI Docker image build built both targets for both platforms from v0.9.0-beta.3 in 12 min with no QEMU; the binary assets failure is the known speech.flac breakage on main)

publish-images computed latest-cuda13 and vX.Y-cuda13 at the start of the job and applied them after two image builds of about an hour, so two stable releases finishing out of order could leave latest on the older one. The move step now re-reads the release list and re-runs docker_image_tags.sh right before imagetools create. The job condition uses !cancelled() instead of always(), so a cancelled run does not start publishing.

Refs #3485
@inureyes

Copy link
Copy Markdown
Member Author

Security and performance review (head 186ae67)

No CRITICAL or HIGH findings, so no commits. actionlint (shellcheck severity=error) is clean on both workflows, docker_image_tags_test.sh passes, and all five SHA pins in publish-images (checkout v7.0.1, setup-buildx v4.4.1, login v4.8.0, build-push v7.4.0, attest v4.2.2) match their upstream tags.

Checked and fine: permissions are default-deny at the top and job-scoped. release_tag reaches shell only through env, and docker_image_tags.sh validates it before build-args, labels and annotations use it. The context is a path context, so build-push-action passes no GIT_AUTH_TOKEN, and provenance mode=max records only MLXCEL_VERSION and Dockerfile defaults. There is no GHA cache, so a fork PR cannot poison a release build. The ci.yml jobs run on pull_request with a read-only token and no secrets. Moving tags are applied last from a fresh release list.

MEDIUM / LOW, report only:

  • MEDIUM: the tag-tree copies of docker_image_tags.sh and free_docker_disk.sh (the latter with sudo) run in a job holding packages:write and id-token:write, and that script's regex is the only validation of RELEASE_TAG before the newline-delimited build-args. The trust boundary (write access) is the same as the existing build jobs.
  • LOW: ref: takes an unqualified tag name, the existing pattern across release.yml. The repository has only a main branch ruleset, so a branch named vX.Y.Z could shadow the tag. This is a workflow-wide follow-up (refs/tags/ prefix or a tag ruleset).
  • LOW: setup-buildx pulls the BuildKit daemon image (which handles the push credential) by floating tag, and sbom: true pulls the syft scanner image the same way. Neither is pinned.
  • LOW: free_docker_disk.sh runs sudo rm -rf and docker system prune -af without checking that the runner is hosted. A RUNNER_ENVIRONMENT == github-hosted guard would protect the self-hosted pool if the script is ever reused there.
  • Dockerfile scope, note only: the release zip .sha256 is fetched from the same release as the zip, the same shape as the known chisel item.

Not yet run (in addition to the known /mnt path): CI docker-build does not push and enables no sbom or provenance. The arm64 SBOM scan without QEMU, the attestation push, and the disk peak while pushing will first run on a real release.

free_docker_disk.sh deletes system directories with sudo and prunes every Docker object. Security review noted nothing stops it from running on a self-hosted runner if the script is reused, so it now exits unless RUNNER_ENVIRONMENT is github-hosted.

Refs #3485
The CUDA container image paragraph now states the behavior the final workflow has: publishing needs both Linux CUDA builds to succeed even when an unrelated job fails, tags without the Dockerfile or scripts are skipped with a notice, and moving tags are re-decided after the images and attestations are pushed.

Validation: tag-rule test, shellcheck, actionlint 1.7.7 on both workflows, cross-repo refs and CUDA arch list checks pass.

Refs #3485
Resolves the ci.yml conflict with #3549 by keeping both sides: the docker and docker_tags filters and jobs from this branch and the helm_chart filter and helm-chart job from main.
@inureyes inureyes added status:done Completed and removed status:review Under review labels Nov 28, 2026
@inureyes
inureyes marked this pull request as ready for review November 28, 2026 23:52
@inureyes
inureyes merged commit 29b2d65 into main Nov 28, 2026
35 of 36 checks passed
@inureyes
inureyes deleted the chore/issue-3485-ghcr-cuda-images branch November 28, 2026 23:53
inureyes added a commit that referenced this pull request Nov 30, 2026
Bilingual reports for the eight PRs of epic #3488: #3508 (graceful drain), #3509 (CUDA PTX cache trust), #3530 (ROCm hsaco cache trust), #3540 (NVRTC redistributable headers), #3543 (CUDA container image), #3549 (Helm chart), #3550 (GHCR image publishing) and #3554 (chart OCI publishing and docs).

Each report names what the PR record leaves unvalidated: a real GHCR push, a GPU pod on a cluster, the amd64 and debug images. The HuggingFace cache follow-up is #3570.
@inureyes inureyes added this to the 0.9 milestone Nov 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform:linux Linux (CUDA / packaging) specific priority:medium Medium priority status:done Completed type:chore Maintenance tasks (build, CI, etc.)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chore(release): Build and publish multi-arch CUDA images to GHCR

1 participant