Skip to content

Commit 3f359b3

Browse files
gitcommit90claude
andauthored
fix(phase4): set the default keychain for the macOS runner job (#78)
* fix(phase4): set the default keychain for the macOS runner job notarytool resolves its credential profile through the session DEFAULT keychain, but a launchd runner job has no default keychain set, so notarization failed with "No Keychain password item found for profile" even though code signing (which uses the search list) succeeded. After the hook's trust validation passes, set the dedicated account's login keychain as the default and search keychain and unlock it, on macOS only. The keychain password is read from a machine-local file owned by the runner account ($HOME/.config/1helm/mac-keychain-password); it is never committed to this repository or exported into the job environment. No sudo, no elevation. Co-Authored-By: Claude <noreply@anthropic.com> * fix(phase4): read the root-owned OCI image store with sudo in Linux acceptance The retained channel-image verification checked /var/lib/1helm-oci-v1/shared-images/sha256/<digest> without sudo, but install-oci-runtime.sh creates that store root-owned and mode 0700. The ordinary runner user cannot traverse it, so the `[[ -d ... && sha256 ... ]]` assertion always failed after an otherwise successful clean install — the exact silent failure the new ERR trap pinpointed at this line. The adjacent state checks already use sudo; this one was the outlier. Run the directory test and the image digest read under sudo, matching the store's ownership. No product change; acceptance-script only. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Joseph Yaksich <gitcommit90@users.noreply.github.com> Co-authored-by: Claude <noreply@anthropic.com>
1 parent b6c17eb commit 3f359b3

2 files changed

Lines changed: 23 additions & 2 deletions

File tree

ops/platform-acceptance/linux.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ sudo systemctl is-active --quiet 1helm.service
7272
curl -fsS http://127.0.0.1:8123/api/setup/status >"$work/clean-health.json"
7373
[[ "$(readlink -f /opt/1helm/current)" == "/opt/1helm/releases/$VERSION-$OFFLINE_DIGEST" ]]
7474
RETAINED_IMAGE="/var/lib/1helm-oci-v1/shared-images/sha256/$IMAGE_DIGEST"
75-
[[ -d "$RETAINED_IMAGE" && "$(find "$RETAINED_IMAGE" -maxdepth 1 -type f -name '*.oci.tar' -exec sha256sum {} \; | awk '{print $1}')" == "$IMAGE_DIGEST" ]]
75+
sudo test -d "$RETAINED_IMAGE"
76+
[[ "$(sudo find "$RETAINED_IMAGE" -maxdepth 1 -type f -name '*.oci.tar' -exec sha256sum {} \; | awk '{print $1}')" == "$IMAGE_DIGEST" ]]
7677

7778
# Resolve the newest immutable public Stable release distinct from this
7879
# candidate version. Candidate versions normally remain unchanged during
@@ -140,7 +141,8 @@ sudo systemctl is-active --quiet 1helm.service
140141
curl -fsS http://127.0.0.1:8123/api/setup/status >"$work/rollback-health.json"
141142
STATE_AFTER="$(sudo sha256sum "$MARKER" | awk '{print $1}')"
142143
[[ "$STATE_BEFORE" == "$STATE_AFTER" ]]
143-
[[ -d "$RETAINED_IMAGE" && "$(find "$RETAINED_IMAGE" -maxdepth 1 -type f -name '*.oci.tar' -exec sha256sum {} \; | awk '{print $1}')" == "$IMAGE_DIGEST" ]]
144+
sudo test -d "$RETAINED_IMAGE"
145+
[[ "$(sudo find "$RETAINED_IMAGE" -maxdepth 1 -type f -name '*.oci.tar' -exec sha256sum {} \; | awk '{print $1}')" == "$IMAGE_DIGEST" ]]
144146
sudo rm -rf -- "$FAILURE_RELEASE"
145147

146148
export HELM_PREVIOUS_VERSION="$PREVIOUS_VERSION"

ops/platform-acceptance/runner-job-started.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,22 @@ if not (
3030
):
3131
raise SystemExit("Phase 4 runner refused an untrusted repository/ref/SHA/CI event.")
3232
PY
33+
34+
# macOS only: prepare the dedicated signing account's login keychain for this
35+
# now-validated, trusted job. Code signing resolves its identity through the
36+
# keychain search list, but notarytool resolves its credential profile through
37+
# the session DEFAULT keychain, and a launchd runner job otherwise has no
38+
# default keychain, so notarization fails with "No Keychain password item
39+
# found". Set login as the default (and search) keychain and unlock it. The
40+
# password is read from a machine-local file owned by the runner account; it is
41+
# never stored in this repository or exported into the job environment.
42+
if [[ "$(uname)" == "Darwin" ]]; then
43+
kc="$HOME/Library/Keychains/login.keychain-db"
44+
kc_pw_file="$HOME/.config/1helm/mac-keychain-password"
45+
if [[ -f "$kc" && -r "$kc_pw_file" ]]; then
46+
security list-keychains -d user -s "$kc" /Library/Keychains/System.keychain >/dev/null 2>&1 || true
47+
security default-keychain -d user -s "$kc" >/dev/null 2>&1 || true
48+
security set-keychain-settings "$kc" >/dev/null 2>&1 || true
49+
security unlock-keychain -p "$(cat "$kc_pw_file")" "$kc" >/dev/null 2>&1 || true
50+
fi
51+
fi

0 commit comments

Comments
 (0)