You are reading the docs for v0.0.1-beta-8. Latest (main) →

Upgrading Xcode or macOS images

View .mdEdit on GitHub

How to move your macOS runners to a new Xcode or macOS version without breaking workflows, and how to try a beta first.

← Back to README

A macOS runner is a fresh clone of a prepared image, so an upgrade means baking a new image and pointing jobs at it. The one decision that matters is whether the image keeps its name, because on GitHub the image name is the label a workflow asks for.

Pick a name that survives upgrades#

On a GitHub scale set, each named images: entry that has labels: gets a scale set called <scale_set.name>-<name>, and that name is the runs-on: label. An entry without labels: gets no scale set. The examples here assume scale_set.name: kinhin (the default), so the label is kinhin-<name>. kinhin does not derive the name from the Xcode or macOS version. It is whatever you typed. If you called the entry xcode-27, workflows say runs-on: kinhin-xcode-27, and they say it forever.

You doWorkflows must change?What is left behind
Rebuild the same entry on a new base_imageNoNothing
Add a new entry (xcode-28) and move jobs to itYes, every runs-on:The old scale set on GitHub, and the old VM on disk
Rename an entryYes, every runs-on:The old scale set on GitHub, and the old VM on disk

Prefer an unversioned name such as xcode, so the label stays kinhin-xcode and an upgrade is a rebuild. Keep a version in the name only if you want old and new Xcode side by side on purpose.

Renaming strands jobs without an error. kinhin creates a scale set when an image appears and never deletes one when it goes. A job that still asks for the old name matches no scale set that kinhin is listening on, so it stays queued with an empty runner name and nothing in the log. Update the workflows before you rename. This is the failure described in Troubleshooting.

A new entry also needs a restart. kinhin creates scale sets when it starts, so a job on a label whose image was added later matches nothing until you restart. Check that the new name appears in the listens on scale sets: … log line. On beta 2, wait until no jobs are running before you add the entry or restart: a restart re-runs registration on each VM it re-adopts and can fail the job on it (Restarts, GitHub). From beta 3 kinhin checks the forge first.

Move from a versioned name to a stable one#

If your entry is already called xcode-27, rename it without a gap by adding the new name first:

  1. Add an entry named xcode with the base image you want and a labels: list (see the examples below), and run kinhin image prepare --image xcode.
  2. Restart kinhin and confirm kinhin-xcode appears in listens on scale sets: ….
  3. Change every workflow to runs-on: kinhin-xcode, then run one workflow_dispatch job and confirm it lands.
  4. Remove the xcode-27 entry and run tart delete xcode-27. Its scale set stays on the forge, unused.

Upgrade a stable image in place#

  1. Check disk. An image is 40-60 GB, more with Xcode, and the bake needs room for a scratch VM next to the old image (Hardware & sizing). Run kinhin doctor.

  2. Pin the new base. Run kinhin image digest <ref> for the new image and put the @sha256: reference in base_image (or pick the base in the app's macOS card, then pin it). Pinning before the bake means the image you build is the image you recorded, even if :latest is republished meanwhile:

    images:
      - name: xcode
        labels: [xcode]
        base_image: "ghcr.io/cirruslabs/macos-golden-gate-xcode:latest@sha256:…"
  3. Rebuild it. kinhin image prepare --image xcode, or Rebuild… in the app. A changed base_image only takes effect after a rebuild. The bake runs in a scratch VM and replaces the old image only at the end, so a failed or cancelled bake leaves the old image working (Cancelling a build).

  4. Mind the warm VMs. If the entry has warm_pool, VMs already cloned from the old image stay in the pool until they age out (warm_max_age_minutes, default 60), so the first jobs after a rebuild can still run on the old Xcode (Warm pool). If the entry has min_idle, its idle runners stay registered on the old image until a job takes them, so the first job routed to those labels can also run on the old Xcode. To clear them, set min_idle to 0 and reload so scale-down removes idle runners no floor needs, then restore the floor after the rebuild. Check the Xcode version inside the job before you trust the upgrade.

  5. Watch one job. Run a workflow_dispatch build on runs-on: kinhin-xcode, print xcodebuild -version, and check kinhin pipeline for the VM going ready, then busy.

A pin never moves on its own, so for the next upgrade repeat steps 2 and 3 with the new digest. Rebuilding the main image: also discards the per-project toolchain images derived from it; named images: entries have none.

Only two macOS VMs run at once (Scaling), so a rebuild competes with jobs for those slots. Rebuild when the queue is quiet.

Let kinhin follow the registry#

Everything above is manual. kinhin can also notice a newer upstream image for you, and rebuild it. It is set with image_updates:, and an images: entry can override it with update::

image_updates:
  mode: notify # off | notify | approve | auto
  check_interval_hours: 24
  quiet_minutes: 10 # auto only
images:
  - name: xcode
    base_image: "ghcr.io/cirruslabs/macos-tahoe-xcode:latest"
    update: approve # this image only
ModeWhat kinhin does when the registry serves a newer version
offNothing. It never asks the registry about this image.
notifyRaises an image-update warning in kinhin status and the alerts. Changes nothing. The default.
approveQueues the rebuild as a healing fix. kinhin heal approve ID (or the app) carries it out.
autoRebuilds on its own once nothing has been queued or running for quiet_minutes, one image at a time.

How it decides:

  • Every bake records the digest it was made from in baked-images.json, and clones from exactly that digest. A check asks the registry what the tag serves now and compares it with the record. It is one anonymous registry request per image per check_interval_hours, and nothing else leaves your Mac.
  • An image baked before digests were recorded has no record. Its first check takes the registry's current digest as the baseline and flags nothing. kinhin does not guess what is on disk.
  • A base_image pinned to a digest is never checked or touched. A pin is how you opt an image out.
  • A local VM name has no registry, so it is never checked. If the registry cannot be reached, kinhin tries again at the next check and says nothing.

By hand, with the same checker and the same rebuild:

kinhin image update                 # report: up to date, baseline taken, or newer version available
kinhin image update --apply         # rebuild each image that has a newer version
kinhin image update --image xcode   # one image, whatever its update mode
kinhin image rollback --image xcode # rebuild from the digest it was baked from before

A rollback needs the registry to still serve that earlier digest, which a registry may not keep forever.

Linux images#

The Apple container and Docker images follow the registry too, under the global image_updates.mode (they have no per-image update:). They are tracked as container:<image> and docker:<image>, and kinhin image update --image NAME takes the plain name. Their base is usually a Docker Hub name like ubuntu:24.04, which kinhin resolves against Docker Hub the way docker pull would. The same rules apply: a base pinned with @sha256: is never touched, and the first check takes a baseline.

One difference matters. A plain kinhin image prepare (or the app's Rebuild) of a Linux image starts from the previous bake, so it stays incremental and never picks up a newer base. An update bakes on the registry base at the digest it just resolved, which is what brings in the new base layers. kinhin image rollback is for macOS images only.

What to know before turning on auto:

  • A bad upstream image reaches your CI. auto waits for a quiet queue, which helps with timing and does nothing about quality. If that worries you, use approve, or keep the production image pinned and let a separate beta-style entry (see below) follow the tag.
  • While an image is rebuilt, spawns of that image wait a few seconds for the final swap. This is within the daemon (or the app running the fleet). A kinhin image prepare in another terminal cannot see it.
  • Warm VMs cloned from the old image stay in the pool until warm_max_age_minutes, so the first jobs after an update can still run on the old Xcode. Print xcodebuild -version in a job if it matters.
  • Renaming is unchanged: following the registry rebuilds an image under its own name, so no runs-on: changes. Keep the version out of the name (above).

Try a beta first#

kinhin has no beta channel. Its curated base images are all :latest tags of released Xcode and macOS versions. You can still run a beta, safely, as a separate image that only opted-in jobs use. Give a beta entry update: auto if you want it to follow its tag; leave the stable entry on notify or approve:

images:
  - name: xcode # stable: runs-on: kinhin-xcode
    labels: [xcode]
    base_image: "ghcr.io/cirruslabs/macos-golden-gate-xcode:latest@sha256:…"
  - name: xcode-beta # beta: runs-on: kinhin-xcode-beta
    labels: [xcode-beta]
    base_image: "<beta image reference>"
  • Give each entry its own label. An entry without labels: creates no scale set, and the two entries cannot share a label (Runtimes).
  • Prepare it first. Add the entry, then run kinhin image prepare --image xcode-beta (check disk first). A job for an image that was never prepared cannot clone it and fails with a clone error.
  • Restart. Restart kinhin after adding the entry, so its scale set exists, and check for kinhin-xcode-beta in the listens on scale sets: … log line. Until then a job on that label stays queued with no error.
  • A registry image. Use a published Cirrus Labs macos-* reference. kinhin doctor accepts a reference that is a curated image, a digest pin of a ghcr.io/cirruslabs/macos-* image, or a local VM, and flags anything else. Get the pin with kinhin image digest <ref>. A mutable tag gets a reproducibility warning.
  • A local VM. Build a Tart VM from the beta IPSW yourself with Tart (Tart's documentation), then set base_image to the VM's name. kinhin only bakes the runner agents into it. Creating the VM is outside kinhin.
  • Opt in per workflow. In scale-set mode, add a separate job or workflow on runs-on: kinhin-xcode-beta, with continue-on-error: true if you do not want a beta failure to turn the build red. This works on GitHub only: other forges register runners with the fleet labels, so their jobs always run on image: (Runtimes). With scale sets, the beta set stays separate from kinhin-xcode. With the classic poller, a runner with extra labels can also pick up a plain job, so prefer scale-set mode for a beta. In classic mode a runner registers with the fleet labels plus the image's labels: and not the scale-set name, so runs-on: kinhin-xcode-beta alone stays queued: list the fleet labels and xcode-beta.
  • Use the disk deliberately. A beta image is a second 40-60 GB image, and it counts against the same two macOS VMs.

When the beta ships, promote it: set the stable entry's base_image to the release image, pin it and rebuild (as above), and remove the beta entry. Removing an entry leaves its VM on disk (tart delete xcode-beta), and its scale set stays on GitHub unused. Delete the beta workflow first.

Roll back#

  • A bake that failed or was cancelled left the previous image in place. Nothing to do.
  • A promoted image that misbehaves: run kinhin image rollback --image NAME, or set base_image back to the previous digest pin and rebuild. kinhin keeps the last three digests it baked each image from.
  • A stuck queue after any change: compare each workflow's runs-on: with the names in the listens on scale sets: … log line. See Troubleshooting.

Checklist#

  1. Name the entry without a version, so the label does not change.
  2. kinhin doctor, then check disk. A new entry also needs a restart.
  3. Set the pinned base_image, run kinhin image prepare --image NAME.
  4. Run one workflow_dispatch job and confirm ready to busy.
  5. Pin the new image with kinhin image digest before the bake, not after.
  6. For a beta, use a second entry and opt-in jobs only. Promote it when it ships.