Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 61 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,9 @@ jobs:
# self-hosted runner is offline — a skip here also skips `release`, which
# needs it.
runs-on: [self-hosted, macOS, ARM64]
timeout-minutes: 45
# 60, not 45: the build takes about 15 minutes, and the notarization
# step below waits on Apple's notary service for three submissions.
timeout-minutes: 60
needs: [assert-version]
if: vars.RUN_MACOS_CI != 'false'
env:
Expand Down Expand Up @@ -561,6 +563,64 @@ jobs:
- name: Re-check minzoned links on the signed artifact
# The last check before upload, on the signed and renamed bytes.
run: scripts/check-zoned-links.sh target/release/minzoned-macos-arm64
- name: Notarize binaries
# Submit each signed binary to Apple's notary service and fail the
# release unless every result is Accepted. Notarization does not
# modify the file, so the uploaded bytes stay the signed, link-gated
# bytes above. notarytool takes a zip, a .pkg or a .dmg, never a
# bare Mach-O, so each binary goes up in a ditto zip that is used
# only for the submission.
#
# No staple: the release ships each binary as a bare Mach-O file,
# and stapler cannot attach a ticket to one (only to an .app, a .pkg
# or a .dmg). Gatekeeper looks the ticket up online instead.
#
# The credentials are a notarytool keychain profile stored in the
# signing keychain; the repository variable MACOS_NOTARY_PROFILE
# names it.
env:
KC_PW: ${{ secrets.KC_PW }}
NOTARY_PROFILE: ${{ vars.MACOS_NOTARY_PROFILE }}
run: |
if [ -z "$NOTARY_PROFILE" ]; then
echo "::error::repository variable MACOS_NOTARY_PROFILE is not set" >&2
exit 1
fi
KC=minimal-signing.keychain-db
security unlock-keychain -p "$KC_PW" "$KC"

work="$RUNNER_TEMP/notarize"
rm -rf "$work"
mkdir -p "$work"
for f in target/release/minvmd-macos-arm64 \
target/release/minimal-macos-arm64 \
target/release/minzoned-macos-arm64; do
name=$(basename "$f")
zip="$work/$name.zip"
result="$work/$name.json"
ditto -c -k --keepParent "$f" "$zip"

echo "Submitting $name for notarization"
xcrun notarytool submit "$zip" \
--keychain-profile "$NOTARY_PROFILE" \
--keychain "$HOME/Library/Keychains/$KC" \
--wait --timeout 15m \
--output-format json >"$result" || true
cat "$result"

status=$(plutil -extract status raw -o - "$result" 2>/dev/null || true)
if [ "$status" != "Accepted" ]; then
echo "::error::notarization of $name ended with status '${status:-none}'" >&2
id=$(plutil -extract id raw -o - "$result" 2>/dev/null || true)
if [ -n "$id" ]; then
xcrun notarytool log "$id" \
--keychain-profile "$NOTARY_PROFILE" \
--keychain "$HOME/Library/Keychains/$KC" || true
fi
exit 1
fi
echo "$name: Accepted"
done
- name: Upload binary (minvmd)
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
Expand Down
39 changes: 35 additions & 4 deletions docs/internal/release-pipeline.md
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,9 @@ whose `package.version` is stale or not above the newest `v*` tag.
`minzoned`, changes the libkrun link path in `minvmd` to `@rpath`
([`scripts/rewrite-macos-linkage.sh`](../../scripts/rewrite-macos-linkage.sh)),
and checks that `min` and `minzoned` link only system libraries. It
signs `minvmd`, `min`, and `minzoned` with the Developer ID, the hardened runtime, and a
timestamp.
signs `minvmd`, `min`, and `minzoned` with the Developer ID, the
hardened runtime, and a timestamp. Then it notarizes all of them. See the
**Notarization** paragraph below.
- `build-libkrun-macos-arm64` builds the `libkrun.1.dylib` for macOS users on
a hosted runner. `sign-macos-artifacts` signs it and the macOS `gvproxy`
with the Developer ID on the self-hosted runner.
Expand Down Expand Up @@ -398,8 +399,8 @@ handles `minzoned` with the same steps that the other binaries have:
signature with the designated requirement that `min` uses.
- After the signature check, the link gate runs again on the signed
artifact, and the job uploads it.
- The workflow does not notarize `minzoned`. The pipeline notarizes no
macOS binary today.
- The job notarizes `minzoned` with the other macOS binaries. See
the **Notarization** paragraph below.
- The release job and the stage-installer job stay the same. They collect
artifacts by the platform-suffixed names, so the new names go into the
GitHub Release, the `components` manifest, and the packages. The SHA-256
Expand All @@ -418,6 +419,36 @@ This section does not close these residuals:
[`scripts/session-e2e.sh`](../../scripts/session-e2e.sh) skips it there. A
privileged macOS e2e runner is still necessary for that proof.

**Notarization.** After the signature checks and the last link gate,
`build-release-macos-arm64` sends `min`, `minvmd`, and `minzoned` to
the Apple notary service before it uploads them. The step puts each binary
in a zip made with `ditto`, because `notarytool` does not take a bare
Mach-O file. It runs `xcrun notarytool submit --wait` on each zip. The
release fails unless each result is `Accepted`. On any other result, the
step prints the notary log for that submission. Notarization does not
change the file, so the job uploads the same signed bytes.

The job does not staple. The release publishes each binary as a bare Mach-O
file, and `stapler` can attach a ticket only to an app bundle, a `.pkg`, or
a `.dmg`. Gatekeeper gets the ticket from Apple online when it checks a
binary.

The step needs two things that the workflow cannot set up:

- A `notarytool` keychain profile in the signing keychain
(`minimal-signing.keychain-db`) on the self-hosted macOS runner. Create it
as the runner user with
`xcrun notarytool store-credentials <profile> --keychain
~/Library/Keychains/minimal-signing.keychain-db`. Give it an App Store
Connect API key (`--key`, `--key-id`, `--issuer`), or an Apple ID with an
app-specific password and team `3G47C5HY64`. The step unlocks the keychain
with the `KC_PW` secret, as the signing steps do.
- The repository variable `MACOS_NOTARY_PROFILE`, set to the profile name.
If the variable is empty, the step fails before it submits anything.

`libkrun.1.dylib` and the macOS `gvproxy`, which `sign-macos-artifacts`
signs, are not notarized.

**release job.** This job downloads all build outputs. It writes the release
notes with `scripts/next-version.sh --notes` and generates shell completions
for `mip`, `min`, and `minimald`. On a versioned run it builds the `.deb`,
Expand Down