Skip to content

Commit 5f7f1bc

Browse files
committed
use machine-config-osimagestream to avoid hard-coding image tag names
Assisted-By: Claude Sonnet 4.5
1 parent ac6111f commit 5f7f1bc

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

data/data/bootstrap/files/usr/local/bin/node-image-pull.sh.template

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,37 @@ set -euo pipefail
44
# shellcheck source=release-image.sh.template
55
. /usr/local/bin/release-image.sh
66

7-
# yuck... this is a good argument for renaming the node image to just `node` in both OCP and OKD
8-
coreos_img={{.StreamTag}}
9-
until COREOS_IMAGE=$(image_for ${coreos_img}); do
10-
echo 'Failed to query release image; retrying...'
7+
# Get the Machine Config Operator image from the release payload
8+
until MCO_IMAGE=$(image_for 'machine-config-operator'); do
9+
echo 'Failed to query MCO image from release; retrying...'
1110
sleep 10
1211
done
1312

13+
# Create temporary directory for binary extraction
14+
TEMP_DIR=$(mktemp -d)
15+
echo "Extracting machine-config-osimagestream binary to ${TEMP_DIR}"
16+
17+
# Extract the machine-config-osimagestream binary from MCO image
18+
podman create --name mco-osimagestream "${MCO_IMAGE}"
19+
podman cp mco-osimagestream:/usr/bin/machine-config-osimagestream "${TEMP_DIR}/machine-config-osimagestream"
20+
podman rm mco-osimagestream
21+
22+
# Execute the binary to get the CoreOS image pullspec
23+
# Note: Proxy environment variables (HTTP_PROXY, HTTPS_PROXY, NO_PROXY) are
24+
# automatically inherited from the environment if set via /etc/profile.d/proxy.sh
25+
until COREOS_IMAGE=$("${TEMP_DIR}/machine-config-osimagestream" \
26+
get default-node-image \
27+
--release-image "${RELEASE_IMAGE_DIGEST}" \
28+
--authfile /root/.docker/config.json \
29+
--per-host-certs /etc/containers/certs.d \
30+
--registry-config /etc/containers/registries.conf); do
31+
echo 'Failed to query for OS image pullspec; retrying...'
32+
sleep 10
33+
done
34+
35+
# Clean up temporary directory
36+
rm -rf "${TEMP_DIR}"
37+
1438
# need to use rpm-ostree here since `bootc status` doesn't work in the live ISO currently
1539
# https://github.com/containers/bootc/issues/1043
1640
booted_version=$(rpm-ostree status --json | jq -r .deployments[0].version)

0 commit comments

Comments
 (0)