From 59226d22a65e4d34cfae8b124c30f2c2bbd5edb8 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Thu, 5 Mar 2026 10:02:52 +0100 Subject: [PATCH 1/3] Change test-agent impl to align with greenboot-rs --- test/agent/microshift-test-agent.sh | 51 +++++++++++------------------ 1 file changed, 20 insertions(+), 31 deletions(-) diff --git a/test/agent/microshift-test-agent.sh b/test/agent/microshift-test-agent.sh index 0d6a573f83..656d644615 100755 --- a/test/agent/microshift-test-agent.sh +++ b/test/agent/microshift-test-agent.sh @@ -1,7 +1,6 @@ #!/usr/bin/bash set -xeuo pipefail -GREENBOOT_CONFIGURATION_FILE=/etc/greenboot/greenboot.conf AGENT_CFG=/var/lib/microshift-test-agent.json SYSTEMD_NOTIFIED=false @@ -58,32 +57,6 @@ _debug_info() { cat "${AGENT_CFG}" || true } -_get_current_boot_number() { - if ! /usr/bin/grub2-editenv list | grep -q boot_counter; then - echo "boot_counter is missing - script only for newly staged deployments" - exit 0 - fi - - local -r boot_counter=$(/usr/bin/grub2-editenv list | grep boot_counter | sed 's,boot_counter=,,') - local max_boot_attempts - - if test -f "${GREENBOOT_CONFIGURATION_FILE}"; then - # shellcheck source=/dev/null - source "${GREENBOOT_CONFIGURATION_FILE}" - fi - - if [ -v GREENBOOT_MAX_BOOT_ATTEMPTS ]; then - max_boot_attempts="${GREENBOOT_MAX_BOOT_ATTEMPTS}" - else - max_boot_attempts=3 - fi - - # When deployment is staged, greenboot sets boot_counter to 3 - # and this variable gets decremented on each boot. - # First boot of new deployment will have it set to 2. - echo "$((max_boot_attempts - boot_counter))" -} - _get_current_deployment_id() { local -r id="$(rpm-ostree status --booted --json | jq -r ".deployments[0].id")" echo "${id}" @@ -147,7 +120,6 @@ if [ ! -f "${AGENT_CFG}" ] ; then exit 0 fi -current_boot="$(_get_current_boot_number)" current_deployment_id="$(_get_current_deployment_id)" deploy=$(jq -c ".\"${current_deployment_id}\"" "${AGENT_CFG}") @@ -155,10 +127,27 @@ if [[ "${deploy}" == "null" ]]; then exit 0 fi -every_boot_actions=$(echo "${deploy}" | jq -c ".\"every\"") -current_boot_actions=$(echo "${deploy}" | jq -c ".\"${current_boot}\"") +current_boot_actions=$(echo "${deploy}" | jq -c "[.[]] | flatten") + +# greenboot-rs takes a different approach compared to bash greenboot implementation. +# bash greenboot: when deployment is staged, boot_counter is set immediately, +# when host boots again, the variable is present on 1st boot of new deployment. +# greenboot-rs: boot_counter is set only when the healthchecks fail for the new deployment. +# +# Therefore, test-agent cannot depend on boot_counter anymore to do +# actions on first boot of the new deployment. +# For this reason, the way how the test agent config is interpreted changed: +# the .deployment.number is no longer the "ordinal boot number" (i.e. 1st, 2nd, 3rd boot of the deployment) +# but "how many boots this action should be active". +# +# After collecting actions for the current boot, numbers are decremented, and if reach 0, +# removed from the config. +jq \ + --arg key "${current_deployment_id}" \ + '.[$key] |= (with_entries(if (.key | test("^[0-9]+$")) then .key |= (tonumber - 1 | tostring) else . end) | with_entries(select(.key != "0")))' \ + "${AGENT_CFG}" > "${AGENT_CFG}.tmp" && \ + mv "${AGENT_CFG}.tmp" "${AGENT_CFG}" -_run_actions "${every_boot_actions}" _run_actions "${current_boot_actions}" # If running under systemd, notify systemd that the service is ready so that From 752b6915c11bbb01e9fef96050c555c5708e99e7 Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Fri, 6 Mar 2026 10:48:38 +0100 Subject: [PATCH 2/3] Revert "Temporarily disable ostree selected upgrade and downgrade scenarios due to greenboot behavior change" This reverts commit a54c1e149330675e4c3c697e426878e8c1d7f629. --- ...isabled => el96-prel@el98-src@upgrade-fails-and-rolls-back.sh} | 0 ...backup.sh.disabled => el98-src@upgrade-fails-cannot-backup.sh} | 0 ...rc@downgrade-block.sh.disabled => el98-src@downgrade-block.sh} | 0 ...98-src@upgrade-fails.sh.disabled => el98-src@upgrade-fails.sh} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename test/scenarios/periodics/{el96-prel@el98-src@upgrade-fails-and-rolls-back.sh.disabled => el96-prel@el98-src@upgrade-fails-and-rolls-back.sh} (100%) rename test/scenarios/periodics/{el98-src@upgrade-fails-cannot-backup.sh.disabled => el98-src@upgrade-fails-cannot-backup.sh} (100%) rename test/scenarios/presubmits/{el98-src@downgrade-block.sh.disabled => el98-src@downgrade-block.sh} (100%) rename test/scenarios/presubmits/{el98-src@upgrade-fails.sh.disabled => el98-src@upgrade-fails.sh} (100%) diff --git a/test/scenarios/periodics/el96-prel@el98-src@upgrade-fails-and-rolls-back.sh.disabled b/test/scenarios/periodics/el96-prel@el98-src@upgrade-fails-and-rolls-back.sh similarity index 100% rename from test/scenarios/periodics/el96-prel@el98-src@upgrade-fails-and-rolls-back.sh.disabled rename to test/scenarios/periodics/el96-prel@el98-src@upgrade-fails-and-rolls-back.sh diff --git a/test/scenarios/periodics/el98-src@upgrade-fails-cannot-backup.sh.disabled b/test/scenarios/periodics/el98-src@upgrade-fails-cannot-backup.sh similarity index 100% rename from test/scenarios/periodics/el98-src@upgrade-fails-cannot-backup.sh.disabled rename to test/scenarios/periodics/el98-src@upgrade-fails-cannot-backup.sh diff --git a/test/scenarios/presubmits/el98-src@downgrade-block.sh.disabled b/test/scenarios/presubmits/el98-src@downgrade-block.sh similarity index 100% rename from test/scenarios/presubmits/el98-src@downgrade-block.sh.disabled rename to test/scenarios/presubmits/el98-src@downgrade-block.sh diff --git a/test/scenarios/presubmits/el98-src@upgrade-fails.sh.disabled b/test/scenarios/presubmits/el98-src@upgrade-fails.sh similarity index 100% rename from test/scenarios/presubmits/el98-src@upgrade-fails.sh.disabled rename to test/scenarios/presubmits/el98-src@upgrade-fails.sh From 2e8fb20a4af1ee06d408e3ad1e66c5c5728abf5e Mon Sep 17 00:00:00 2001 From: Patryk Matuszak Date: Fri, 6 Mar 2026 10:00:43 +0100 Subject: [PATCH 3/3] debug: don't use cache --- test/bin/ci_phase_iso_build.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/bin/ci_phase_iso_build.sh b/test/bin/ci_phase_iso_build.sh index 922e94cb71..02c5447e1d 100755 --- a/test/bin/ci_phase_iso_build.sh +++ b/test/bin/ci_phase_iso_build.sh @@ -188,11 +188,11 @@ if [ $# -gt 0 ] && [ "$1" = "-update_cache" ] ; then fi else GOT_CACHED_DATA=false - if ${HAS_CACHE_ACCESS} ; then - if download_build_cache ; then - GOT_CACHED_DATA=true - fi - fi + # if ${HAS_CACHE_ACCESS} ; then + # if download_build_cache ; then + # GOT_CACHED_DATA=true + # fi + # fi if ! ${GOT_CACHED_DATA} ; then echo "WARNING: Build cache is not available, rebuilding all the artifacts" fi