Upgrading Xcode or macOS images
How to move your macOS runners to a new Xcode or macOS version without breaking workflows, and how to try a beta first.
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 do | Workflows must change? | What is left behind |
|---|---|---|
Rebuild the same entry on a new base_image | No | Nothing |
Add a new entry (xcode-28) and move jobs to it | Yes, every runs-on: | The old scale set on GitHub, and the old VM on disk |
| Rename an entry | Yes, 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:
- Add an entry named
xcodewith the base image you want and alabels:list (see the examples below), and runkinhin image prepare --image xcode. - Restart kinhin and confirm
kinhin-xcodeappears inlistens on scale sets: …. - Change every workflow to
runs-on: kinhin-xcode, then run oneworkflow_dispatchjob and confirm it lands. - Remove the
xcode-27entry and runtart delete xcode-27. Its scale set stays on the forge, unused.
Upgrade a stable image in place#
-
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. -
Pin the new base. Run
kinhin image digest <ref>for the new image and put the@sha256:reference inbase_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:latestis republished meanwhile:images: - name: xcode labels: [xcode] base_image: "ghcr.io/cirruslabs/macos-golden-gate-xcode:latest@sha256:…" -
Rebuild it.
kinhin image prepare --image xcode, or Rebuild… in the app. A changedbase_imageonly 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). -
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 hasmin_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, setmin_idleto0and 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. -
Watch one job. Run a
workflow_dispatchbuild onruns-on: kinhin-xcode, printxcodebuild -version, and checkkinhin pipelinefor the VM goingready, thenbusy.
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| Mode | What kinhin does when the registry serves a newer version |
|---|---|
off | Nothing. It never asks the registry about this image. |
notify | Raises an image-update warning in kinhin status and the alerts. Changes nothing. The default. |
approve | Queues the rebuild as a healing fix. kinhin heal approve ID (or the app) carries it out. |
auto | Rebuilds 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 percheck_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_imagepinned 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 beforeA 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.
autowaits for a quiet queue, which helps with timing and does nothing about quality. If that worries you, useapprove, 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 preparein 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. Printxcodebuild -versionin 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-betain thelistens 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 doctoraccepts a reference that is a curated image, a digest pin of aghcr.io/cirruslabs/macos-*image, or a local VM, and flags anything else. Get the pin withkinhin 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_imageto 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, withcontinue-on-error: trueif 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 onimage:(Runtimes). With scale sets, the beta set stays separate fromkinhin-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'slabels:and not the scale-set name, soruns-on: kinhin-xcode-betaalone stays queued: list the fleet labels andxcode-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 setbase_imageback 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 thelistens on scale sets: …log line. See Troubleshooting.
Checklist#
- Name the entry without a version, so the label does not change.
kinhin doctor, then check disk. A new entry also needs a restart.- Set the pinned
base_image, runkinhin image prepare --image NAME. - Run one
workflow_dispatchjob and confirmreadytobusy. - Pin the new image with
kinhin image digestbefore the bake, not after. - For a beta, use a second entry and opt-in jobs only. Promote it when it ships.