From 076bfa654ff9742ca134fbf8a12db5ce053c0455 Mon Sep 17 00:00:00 2001 From: vanhalenar Date: Wed, 13 May 2026 10:00:11 +0000 Subject: [PATCH 1/9] Add manage_common_versions.sh script --- test/bin/ci_phase_iso_build.sh | 3 +- test/bin/manage_common_versions.sh | 103 +++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 1 deletion(-) create mode 100755 test/bin/manage_common_versions.sh diff --git a/test/bin/ci_phase_iso_build.sh b/test/bin/ci_phase_iso_build.sh index 0edd72a2d7..0b45445748 100755 --- a/test/bin/ci_phase_iso_build.sh +++ b/test/bin/ci_phase_iso_build.sh @@ -182,7 +182,8 @@ cd "${ROOTDIR}/test/" source "${SCRIPTDIR}/common.sh" # shellcheck source=test/bin/common_versions_verify.sh -source "${SCRIPTDIR}/common_versions_verify.sh" +# source "${SCRIPTDIR}/common_versions_verify.sh" +"${SCRIPTDIR}/manage_common_versions.sh verify" if ${COMPOSER_CLI_BUILDS} ; then # Determine and create the ideal number of workers diff --git a/test/bin/manage_common_versions.sh b/test/bin/manage_common_versions.sh new file mode 100755 index 0000000000..929c6cdc6b --- /dev/null +++ b/test/bin/manage_common_versions.sh @@ -0,0 +1,103 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ROOTDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" + +action_verify() { + echo "Verifying common_versions.sh is in sync..." + + # Check if there was a change to common_versions.sh on current branch compared to base branch. + # --exit-code: 0 means no changes, 1 means changes hence the inverted condition with '!' + # Because the top commit is Merge Commit of PR branch into base branch (e.g. main), we need to check against the earlier commit (i.e. ^1). + if ! git diff --exit-code "${SCENARIO_BUILD_BRANCH}^1...HEAD" "${ROOTDIR}/test/bin/common_versions.sh" >/dev/null 2>&1; then + echo "Detected changes to common_versions.sh, verifying they match generated version..." + + # If the file was changed, regenerate it and compare - diff means that most likely the file was updated manually. + "${ROOTDIR}/scripts/pyutils/create-venv.sh" + + if [ "${SCENARIO_BUILD_BRANCH}" == "main" ]; then + y=$(awk -F'[ .]' '{print $3 "." $4}' < "${ROOTDIR}/Makefile.version.x86_64.var") + else + y=$(echo "${SCENARIO_BUILD_BRANCH}" | awk -F'[-]' '{ print $2 }') + fi + + "${ROOTDIR}/_output/pyutils/bin/python" \ + "${ROOTDIR}/test/bin/pyutils/generate_common_versions.py" \ + "${y}" \ + --update-file + + if ! git diff --exit-code "${ROOTDIR}/test/bin/common_versions.sh"; then + echo "ERROR: Discovered that common_versions.sh was updated on the branch under test, but the regenerated version is different" + git diff + exit 1 + fi + + echo "Verification passed: common_versions.sh matches generated version" + else + echo "No changes detected to common_versions.sh" + fi +} + +action_generate() { + local version="${1:-}" + + if [ -z "${version}" ]; then + echo "ERROR: Version is required" + echo "Usage: ${BASH_SOURCE[0]} generate [options]" + exit 1 + fi + + "${ROOTDIR}/scripts/pyutils/create-venv.sh" + shift + "${ROOTDIR}/_output/pyutils/bin/python" \ + "${ROOTDIR}/test/bin/pyutils/generate_common_versions.py" \ + "${version}" \ + "$@" +} + +usage() { + cat < [options] + +ACTIONS: + verify Verify that common_versions.sh is in sync with the template + and generation script. Checks if the file was manually edited + without regenerating. + + generate Generate common_versions.sh for the specified version. + VERSION format depends on the release: + - For 4.22 and older: minor version only (e.g., 19, 22) + - For 5.0 and newer: X.Y format (e.g., 5.0, 5.1) + + Additional options are passed to generate_common_versions.py: + --update-file Update test/bin/common_versions.sh + --create-pr Create a pull request with changes + --dry-run Dry run mode + + -h, --help Show this help message + +EOF +} + +if [ $# -eq 0 ]; then + usage + exit 1 +fi + +action="${1}" +shift + +case "${action}" in + verify|generate) + "action_${action}" "$@" + ;; + -h|--help) + usage + exit 0 + ;; + *) + usage + exit 1 + ;; +esac \ No newline at end of file From 7f9859e355fd4f514f792ca0d967cf92b4a43d72 Mon Sep 17 00:00:00 2001 From: vanhalenar Date: Wed, 13 May 2026 10:12:39 +0000 Subject: [PATCH 2/9] Add missing newline --- test/bin/manage_common_versions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/bin/manage_common_versions.sh b/test/bin/manage_common_versions.sh index 929c6cdc6b..6c02395dd9 100755 --- a/test/bin/manage_common_versions.sh +++ b/test/bin/manage_common_versions.sh @@ -100,4 +100,4 @@ case "${action}" in usage exit 1 ;; -esac \ No newline at end of file +esac From e9ceb37ed42c6aae6c6bf51b80611302c638140b Mon Sep 17 00:00:00 2001 From: vanhalenar Date: Wed, 13 May 2026 11:49:35 +0000 Subject: [PATCH 3/9] Fix quotes --- test/bin/ci_phase_iso_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/bin/ci_phase_iso_build.sh b/test/bin/ci_phase_iso_build.sh index 0b45445748..04d506f4fb 100755 --- a/test/bin/ci_phase_iso_build.sh +++ b/test/bin/ci_phase_iso_build.sh @@ -183,7 +183,7 @@ source "${SCRIPTDIR}/common.sh" # shellcheck source=test/bin/common_versions_verify.sh # source "${SCRIPTDIR}/common_versions_verify.sh" -"${SCRIPTDIR}/manage_common_versions.sh verify" +"${SCRIPTDIR}/manage_common_versions.sh" verify if ${COMPOSER_CLI_BUILDS} ; then # Determine and create the ideal number of workers From 26f0440a6a7dbef15ce8205e86b7b69e4ad48053 Mon Sep 17 00:00:00 2001 From: vanhalenar Date: Wed, 13 May 2026 12:28:40 +0000 Subject: [PATCH 4/9] Source script instead of run --- test/bin/ci_phase_iso_build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/bin/ci_phase_iso_build.sh b/test/bin/ci_phase_iso_build.sh index 04d506f4fb..738e8a3049 100755 --- a/test/bin/ci_phase_iso_build.sh +++ b/test/bin/ci_phase_iso_build.sh @@ -183,7 +183,7 @@ source "${SCRIPTDIR}/common.sh" # shellcheck source=test/bin/common_versions_verify.sh # source "${SCRIPTDIR}/common_versions_verify.sh" -"${SCRIPTDIR}/manage_common_versions.sh" verify +source "${SCRIPTDIR}/manage_common_versions.sh" verify if ${COMPOSER_CLI_BUILDS} ; then # Determine and create the ideal number of workers From 461babb5984b950205cad2e1b7f50da05c357a39 Mon Sep 17 00:00:00 2001 From: vanhalenar Date: Wed, 13 May 2026 12:57:28 +0000 Subject: [PATCH 5/9] Remove commented out lines --- test/bin/ci_phase_iso_build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/bin/ci_phase_iso_build.sh b/test/bin/ci_phase_iso_build.sh index 738e8a3049..dfd539fecb 100755 --- a/test/bin/ci_phase_iso_build.sh +++ b/test/bin/ci_phase_iso_build.sh @@ -181,8 +181,6 @@ cd "${ROOTDIR}/test/" # shellcheck source=test/bin/common.sh source "${SCRIPTDIR}/common.sh" -# shellcheck source=test/bin/common_versions_verify.sh -# source "${SCRIPTDIR}/common_versions_verify.sh" source "${SCRIPTDIR}/manage_common_versions.sh" verify if ${COMPOSER_CLI_BUILDS} ; then From 50deae6f99142031e64a2a81d5a966c0e04e5f56 Mon Sep 17 00:00:00 2001 From: vanhalenar Date: Thu, 14 May 2026 07:56:41 +0000 Subject: [PATCH 6/9] Fix shellcheck --- test/bin/ci_phase_iso_build.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test/bin/ci_phase_iso_build.sh b/test/bin/ci_phase_iso_build.sh index dfd539fecb..b597518427 100755 --- a/test/bin/ci_phase_iso_build.sh +++ b/test/bin/ci_phase_iso_build.sh @@ -181,6 +181,7 @@ cd "${ROOTDIR}/test/" # shellcheck source=test/bin/common.sh source "${SCRIPTDIR}/common.sh" +# shellcheck source=test/bin/manage_common_versions.sh source "${SCRIPTDIR}/manage_common_versions.sh" verify if ${COMPOSER_CLI_BUILDS} ; then From 95c9bb064f1d28235d0d91fa68f78d824cb82b6d Mon Sep 17 00:00:00 2001 From: vanhalenar Date: Thu, 14 May 2026 09:49:48 +0000 Subject: [PATCH 7/9] Export SCENARIO_BUILD_BRANCH --- test/bin/ci_phase_iso_build.sh | 2 +- test/bin/common.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/test/bin/ci_phase_iso_build.sh b/test/bin/ci_phase_iso_build.sh index b597518427..b4d870120e 100755 --- a/test/bin/ci_phase_iso_build.sh +++ b/test/bin/ci_phase_iso_build.sh @@ -182,7 +182,7 @@ cd "${ROOTDIR}/test/" source "${SCRIPTDIR}/common.sh" # shellcheck source=test/bin/manage_common_versions.sh -source "${SCRIPTDIR}/manage_common_versions.sh" verify +"${SCRIPTDIR}/manage_common_versions.sh" verify if ${COMPOSER_CLI_BUILDS} ; then # Determine and create the ideal number of workers diff --git a/test/bin/common.sh b/test/bin/common.sh index 039a6aa521..ef682a676f 100644 --- a/test/bin/common.sh +++ b/test/bin/common.sh @@ -234,6 +234,7 @@ get_build_branch() { # i.e. / # shellcheck disable=SC2034 # used elsewhere SCENARIO_BUILD_BRANCH="$(get_build_branch)" +export SCENARIO_BUILD_BRANCH # The tag identifier of a scenario used in directory # names when caching today's build artifacts, From 989d03d5def2565389058e8d8141e1c3d446efb9 Mon Sep 17 00:00:00 2001 From: vanhalenar Date: Thu, 14 May 2026 09:53:23 +0000 Subject: [PATCH 8/9] Address comments --- test/bin/common_versions_verify.sh | 30 ------------------------------ test/bin/manage_common_versions.sh | 2 +- 2 files changed, 1 insertion(+), 31 deletions(-) delete mode 100644 test/bin/common_versions_verify.sh diff --git a/test/bin/common_versions_verify.sh b/test/bin/common_versions_verify.sh deleted file mode 100644 index 85a6d39d1f..0000000000 --- a/test/bin/common_versions_verify.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env bash - -# Following script serves as a sort of presubmit to make sure that following files stay in sync: -# - test/bin/common_versions.sh -# - test/bin/pyutils/generate_common_versions.py -# - test/assets/common_versions.sh.template - -# Check if there was a change to common_versions.sh on current branch compared to base branch. -# --exit-code: 0 means no changes, 1 means changes hence the inverted condition with '!' -# Because the top commit is Merge Commit of PR branch into base branch (e.g. main), we need to check against the earlier commit (i.e. ^1). -if ! git diff --exit-code "${SCENARIO_BUILD_BRANCH}^1...HEAD" "${ROOTDIR}/test/bin/common_versions.sh"; then - # If the file was changed, regenerate it and compare - diff means that most likely the file was updated manually. - "${ROOTDIR}/scripts/pyutils/create-venv.sh" - - if [ "${SCENARIO_BUILD_BRANCH}" == "main" ]; then - y=$(awk -F'[ .]' '{print $3 "." $4}' < "${ROOTDIR}/Makefile.version.x86_64.var") - else - y=$(echo "${SCENARIO_BUILD_BRANCH}" | awk -F'[-]' '{ print $2 }') - fi - - "${ROOTDIR}/_output/pyutils/bin/python" \ - "${ROOTDIR}/test/bin/pyutils/generate_common_versions.py" \ - "${y}" \ - --update-file - if ! git diff --exit-code "${ROOTDIR}/test/bin/common_versions.sh"; then - echo "ERROR: Discovered that common_versions.sh was updated on the branch under test, but the regenerated version is different" - git diff - exit 1 - fi -fi diff --git a/test/bin/manage_common_versions.sh b/test/bin/manage_common_versions.sh index 6c02395dd9..dc85c2a1c6 100755 --- a/test/bin/manage_common_versions.sh +++ b/test/bin/manage_common_versions.sh @@ -16,7 +16,7 @@ action_verify() { # If the file was changed, regenerate it and compare - diff means that most likely the file was updated manually. "${ROOTDIR}/scripts/pyutils/create-venv.sh" - if [ "${SCENARIO_BUILD_BRANCH}" == "main" ]; then + if [ "${SCENARIO_BUILD_BRANCH}" = "main" ]; then y=$(awk -F'[ .]' '{print $3 "." $4}' < "${ROOTDIR}/Makefile.version.x86_64.var") else y=$(echo "${SCENARIO_BUILD_BRANCH}" | awk -F'[-]' '{ print $2 }') From fca668cc882a3be663272cd2f69e1af7c6f3b7cc Mon Sep 17 00:00:00 2001 From: vanhalenar Date: Thu, 14 May 2026 10:13:19 +0000 Subject: [PATCH 9/9] Address comments --- test/bin/ci_phase_iso_build.sh | 2 +- test/bin/manage_common_versions.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/bin/ci_phase_iso_build.sh b/test/bin/ci_phase_iso_build.sh index b4d870120e..c229c3ee5b 100755 --- a/test/bin/ci_phase_iso_build.sh +++ b/test/bin/ci_phase_iso_build.sh @@ -182,7 +182,7 @@ cd "${ROOTDIR}/test/" source "${SCRIPTDIR}/common.sh" # shellcheck source=test/bin/manage_common_versions.sh -"${SCRIPTDIR}/manage_common_versions.sh" verify +$(dry_run) bash -x "${SCRIPTDIR}/manage_common_versions.sh" verify if ${COMPOSER_CLI_BUILDS} ; then # Determine and create the ideal number of workers diff --git a/test/bin/manage_common_versions.sh b/test/bin/manage_common_versions.sh index dc85c2a1c6..824ceff4ec 100755 --- a/test/bin/manage_common_versions.sh +++ b/test/bin/manage_common_versions.sh @@ -17,9 +17,9 @@ action_verify() { "${ROOTDIR}/scripts/pyutils/create-venv.sh" if [ "${SCENARIO_BUILD_BRANCH}" = "main" ]; then - y=$(awk -F'[ .]' '{print $3 "." $4}' < "${ROOTDIR}/Makefile.version.x86_64.var") + y="$(awk -F'[ .]' '{print $3 "." $4}' < "${ROOTDIR}/Makefile.version.x86_64.var")" else - y=$(echo "${SCENARIO_BUILD_BRANCH}" | awk -F'[-]' '{ print $2 }') + y="$(awk -F'[-]' '{ print $2 }' <<< "${SCENARIO_BUILD_BRANCH}")" fi "${ROOTDIR}/_output/pyutils/bin/python" \