Skip to content

Commit 9e03696

Browse files
committed
fix(ibmcloud): preserve runner binary if post-build installer fails
1 parent 753b7ef commit 9e03696

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

pkg/integrations/github/snippet-linux-ppc64le.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@ dnf install -y git-core
66
git clone --depth=1 "{{ .RunnerImageRepo }}" /opt/action-runner-image-pz
77

88
cd /opt/action-runner-image-pz
9-
# Allow build to continue past flaky upstream test failures
9+
# Snapshot the runner binary as soon as it is built; a later installer
10+
# failure (e.g. Docker GPG key) can trigger cleanup that deletes it.
11+
(while [ ! -f /opt/runner-cache/config.sh ]; do sleep 10; done
12+
cp -a /opt/runner-cache /opt/runner-backup) &
13+
WATCHER_PID=$!
14+
1015
bash -c '. scripts/vm.sh rhel 9 minimal --skip-snap-lxd' || true
16+
kill $WATCHER_PID 2>/dev/null || true
17+
18+
if [ ! -f /opt/runner-cache/config.sh ] && [ -d /opt/runner-backup ]; then
19+
mv /opt/runner-backup /opt/runner-cache
20+
fi
1121

1222
if [ ! -f /opt/runner-cache/config.sh ]; then
1323
echo "Runner binary not found after build — check build logs" >&2

pkg/integrations/github/snippet-linux-s390x.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@ apt-get update -y && apt-get install -y software-properties-common
66
git clone --depth=1 "{{ .RunnerImageRepo }}" /opt/action-runner-image-pz
77

88
cd /opt/action-runner-image-pz
9-
# Allow build to continue past flaky upstream test failures
9+
# Snapshot the runner binary as soon as it is built; a later installer
10+
# failure (e.g. Docker GPG key) can trigger cleanup that deletes it.
11+
(while [ ! -f /opt/runner-cache/config.sh ]; do sleep 10; done
12+
cp -a /opt/runner-cache /opt/runner-backup) &
13+
WATCHER_PID=$!
14+
1015
bash -c '. scripts/vm.sh ubuntu 22.04 minimal --skip-snap-lxd' || true
16+
kill $WATCHER_PID 2>/dev/null || true
17+
18+
if [ ! -f /opt/runner-cache/config.sh ] && [ -d /opt/runner-backup ]; then
19+
mv /opt/runner-backup /opt/runner-cache
20+
fi
1121

1222
if [ ! -f /opt/runner-cache/config.sh ]; then
1323
echo "Runner binary not found after build — check build logs" >&2

0 commit comments

Comments
 (0)