Skip to content

Pin the macOS base image and publish it with a workflow - #575

Closed
chruffins wants to merge 2 commits into
mainfrom
hypeman/macos-pinned-base
Closed

chruffins wants to merge 2 commits into
mainfrom
hypeman/macos-pinned-base

Conversation

@chruffins

@chruffins chruffins commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Building a macOS image needed three inputs nobody had written down: a Tart base reference, the same base in hypeman's registry, and an image name tied to the registry token. The base also had to be pushed to a private Tart registry first. Neither the base's source nor its macOS version was recorded, so it was easy to conclude no Tart image for macOS 27.2 existed. Cirrus Labs publishes one, under its "Golden Gate" name: ghcr.io/cirruslabs/macos-golden-gate-vanilla:27.2. It is public, has an ASIF disk, an admin/admin user with passwordless sudo and SSH, and logs admin in at the console. Those are this recipe's base requirements.

This PR:

  • pins that image by digest in images/macos/base.env, with the hypeman-registry name and digest of the same disk
  • adds a macOS base workflow that publishes the pinned base to hypeman's registry once per base and prints the digest to pin
  • removes all inputs from the macOS image workflow. It reads base.env and publishes builds/macos-chrome.
  • defaults the Packer template's SSH login to the base's admin/admin, and drops the MACOS_IMAGE_SSH_USERNAME, MACOS_IMAGE_SSH_PASSWORD, TART_REGISTRY_USERNAME and TART_REGISTRY_PASSWORD variable and secrets
  • documents the base and the upgrade path in docs/macos-experimental.md

Existing and new flows

Existing: (by hand) build an ASIF Tart VM -> tart push to a private registry -> import-tart (no base)
          macos-image(tart_base, base, name) -> tart clone --stacked tart_base (registry creds)
            -> packer build (SSH creds from secrets) -> import-tart --name name --base base

New:      macos-base -> tart clone $TART_BASE (public ghcr) -> import-tart --name $BASE_NAME
            -> pin BASE_DIGEST in base.env (once per macOS release)
          macos-image -> load base.env, fail if BASE_DIGEST unset -> tart clone --stacked $TART_BASE
            -> packer build (admin/admin) -> import-tart --name macos-chrome --base <host>/builds/$BASE_NAME@$BASE_DIGEST

Behavior

  • import-tart --base checks that the build's stacked base disk digest equals the one the published base records. The base workflow publishes a plain tart clone of the cached image. That clone shares the cached disk.img, which is the file tart clone --stacked hashes as its base (cloneAsStackedBase in Tart 2.41.1), so the digests should match.
  • The vanilla base turns Gatekeeper's assessments off, so spctl --assess in install-chrome.sh always passes. The codesign verify and Google team ID checks still run.
  • The macOS base workflow uses the same concurrency group as macOS image, so the two never share a runner at once.
  • kernel-images' macOS workflow reads this base.env through its hypeman checkout, in a follow-up PR.

Rollout

  1. Mint HYPEMAN_BASE_REGISTRY_TOKEN with import-tart --mint-token --name macos-27-2 and add it as a secret.
  2. Merge, run macOS base, and pin the printed digest as BASE_DIGEST in a follow-up commit.
  3. Re-mint HYPEMAN_REGISTRY_TOKEN for --name macos-chrome --base <host>/builds/macos-27-2@<digest>.

Testing

Publishing to a local crane registry serve --disk registry:

  • tart pull of the pinned base: 29.9 GB compressed, about 55 minutes. A name:tag@sha256: reference is refused by Tart (failed to parse remote name), so TART_BASE is now name@sha256: only.
  • tart clone (plain) and tart clone --stacked of the base: the plain clone's disk.img sha256 (4e49bbed…e3fd) equals the stacked clone's disk-file-content-digest annotation.
  • import-tart --vm base-flat --name macos-27-2: published in about 15 minutes, and its config records disk-digests=sha256:4e49bbed…e3fd.
  • import-tart --vm build-stacked --name macos-chrome --base 127.0.0.1:5055/builds/macos-27-2@sha256:8de8698f… --guest-agent: passed the base digest check and uploaded only the overlay (0.3 s).
  • packer validate -syntax-only images/macos/browser.pkr.hcl: passed.
  • actionlint on both workflows: only the existing unknown tart runner label warning.

Not verified: packer build against the base. Over SSH as a user without a console session, and as root, Tart failed to boot the VM with VZErrorDomain Code=-9 ... Failed to create new HostKey. That is a property of the session, not of this change. The docs now say the runner must run as the console user. The admin/admin login and the Chrome install still have to be checked on the tart runner.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 34f1848. Configure here.

- uses: actions/setup-go@v6.5.0
with:
go-version-file: go.mod
cache: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

New workflow omitted from actions.lock

Medium Severity

The new macos-base.yml workflow uses actions/checkout@v4.4.0 and actions/setup-go@v6.5.0, but .github/workflows/actions.lock was not updated. That lockfile lists every other workflow, and a missing entry leaves this workflow unpinned. GitHub reports that as not-pinned, and lockfile enforcement would block the job from running.

Fix in Cursor Fix in Web

Triggered by learned rule: Third-party GitHub Actions must be pinned to commit SHAs

Reviewed by Cursor Bugbot for commit 34f1848. Configure here.

Comment thread images/macos/base.env Outdated
#
# TART_BASE is Cirrus Labs' vanilla image, pinned by digest. Cirrus Labs names
# macOS 27 "Golden Gate", so look for macos-golden-gate-vanilla, not macos-27.
TART_BASE=ghcr.io/cirruslabs/macos-golden-gate-vanilla:27.2@sha256:b35695ce30453bcc1db961a476740be72a44c2a2e464b73ece1ff0fcac12a873

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Tart may reject tagged digest pin

High Severity

TART_BASE is set to a Docker-style name:tag@digest reference. Tart’s remote-name grammar treats a reference as a tag or a digest, not both, so tart clone "$TART_BASE" in the base and image workflows can fail to parse the name and never pull the pinned Cirrus image.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 34f1848. Configure here.

@chruffins

Copy link
Copy Markdown
Contributor Author

Closing: superseded. The macOS browser image now builds with import-tart --oci-layout (#576) and is pushed to ECR (kernel/kernel-images-private#620), so publishing a base into Hypeman's registry is no longer needed.

@chruffins chruffins closed this Nov 19, 2026
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.

1 participant