Skip to content

Commit 5c98abe

Browse files
dustymabejbtrystram
authored andcommitted
handle rebased node imgref in migration
Some systems were rebased [1] and will have a different imgref than systems that were automigrated to OCI based updates via the original migration script. Let's handle that case here. Fixes: coreos/fedora-coreos-tracker#2035 [1] coreos/fedora-coreos-tracker#2035 (comment)
1 parent 63b8caa commit 5c98abe

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

overlay.d/35container-signing-migration/usr/libexec/coreos-container-signing-migration

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,28 @@ if [[ "$booted_imgref" =~ ostree-image-signed:docker://quay.io/fedora/fedora-cor
4141
exit 0
4242
fi
4343

44+
booted_imgref_matches_expected() {
45+
local imgref=$1
46+
if [[ "$imgref" =~ ostree-remote-image:fedora:docker://quay.io/fedora/fedora-coreos ]]; then
47+
return 0
48+
fi
49+
if [[ "$imgref" =~ ostree-remote-registry:fedora:quay.io/fedora/fedora-coreos ]]; then
50+
# We could end up here if someone rebased following the instructions from:
51+
# https://github.com/coreos/fedora-coreos-docs/blob/fde6977fdb8b3ebc6b1e54e44d7ca099f0d3c372/modules/ROOT/pages/update-streams.adoc?plain=1#L59
52+
# See https://github.com/coreos/fedora-coreos-tracker/issues/2035#issuecomment-3327648073
53+
return 0
54+
fi
55+
return 1 # Didn't match expected starting state
56+
}
57+
4458
# Error if the machine starting state doesn't match expectation
45-
if [[ ! "$booted_imgref" =~ ostree-remote-image:fedora:docker://quay.io/fedora/fedora-coreos ]]; then
59+
if ! booted_imgref_matches_expected "$booted_imgref"; then
4660
# In this case the user is likely following some other image (quay.io/userx/fedora-coreos:testing)
4761
# but it should still be ok to error here because zincati probably shouldn't be enabled?
4862
echo "ERROR: The booted container imgref doesn't match the Fedora CoreOS default."
4963
exit 1
5064
fi
5165

52-
5366
# gather information to populate the booted-status-override.json file
5467
version=$(jq -r '.deployments[0].version' <<< "$status")
5568
base_commit_meta=$(jq -r '.deployments[0]."base-commit-meta"' <<< "$status")

0 commit comments

Comments
 (0)