From f8c483a7af26568364c55d1b3d462666c5a2ac8c Mon Sep 17 00:00:00 2001 From: Gustavo Lira e Silva Date: Thu, 3 Sep 2026 17:36:36 -0300 Subject: [PATCH 1/2] fix(ci): honour a preset CHART_VERSION and sort chart tags explicitly On this branch CHART_VERSION was assigned unconditionally: CHART_VERSION=$(get_chart_version "$CHART_MAJOR_VERSION") The Gangway trigger passes an override through MULTISTAGE_PARAM_OVERRIDE_CHART_VERSION, which reaches the script as CHART_VERSION and is then overwritten on this line before anything reads it. `--chart-version` has therefore been silently discarded on every release-1.9 run, and the job resolved the newest chart on the branch instead. main and release-1.10 already guard this with `-z`; this branch never did. Add the guard, and while here close the same gap those branches have: a pinned image tag did not pin the chart either. `--tag 1.9-246` alone left CHART_VERSION empty, so the newest chart was resolved regardless. The image and the chart are published together under the same build number, so a pinned TAG_NAME already determines the chart. Derive it, and log that it was derived. get_chart_version also took `.tags[0].name` from the quay API, which assumes the response is ordered newest first. The request sets no sort parameter, so that is an implicit dependency on undocumented behaviour. Select the tags matching the CI chart shape and take max_by(.start_ts). Verified against the live API: both the old and the new expression return 1.9-247-CI today. Co-Authored-By: Claude Opus 5 (1M context) --- .ci/pipelines/openshift-ci-tests.sh | 13 ++++++++++++- .ci/pipelines/utils.sh | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/.ci/pipelines/openshift-ci-tests.sh b/.ci/pipelines/openshift-ci-tests.sh index a2401412ac..4f48e6cac5 100755 --- a/.ci/pipelines/openshift-ci-tests.sh +++ b/.ci/pipelines/openshift-ci-tests.sh @@ -55,7 +55,18 @@ main() { log::info "Log file: ${LOGFILE}" log::info "JOB_NAME : $JOB_NAME" - CHART_VERSION=$(get_chart_version "$CHART_MAJOR_VERSION") + if [[ -n "${CHART_VERSION:-}" ]]; then + log::info "Using preset CHART_VERSION (pinned or from env): ${CHART_VERSION}" + elif [[ "${TAG_NAME:-}" =~ ^[0-9]+\.[0-9]+-[0-9]+$ ]]; then + # The image and the chart are published together under the same build + # number, so a pinned TAG_NAME already determines the chart. Resolving the + # newest chart here instead would pair a pinned RC image with a chart from + # a later build. + CHART_VERSION="${TAG_NAME}-CI" + log::info "Derived CHART_VERSION from pinned TAG_NAME: ${CHART_VERSION}" + else + CHART_VERSION=$(get_chart_version "$CHART_MAJOR_VERSION") + fi export CHART_VERSION case "$JOB_NAME" in diff --git a/.ci/pipelines/utils.sh b/.ci/pipelines/utils.sh index aad778104c..93321de504 100755 --- a/.ci/pipelines/utils.sh +++ b/.ci/pipelines/utils.sh @@ -1510,7 +1510,7 @@ get_previous_release_version() { get_chart_version() { local chart_major_version=$1 curl -sSX GET "https://quay.io/api/v1/repository/rhdh/chart/tag/?onlyActiveTags=true&filter_tag_name=like:${chart_major_version}-" -H "Content-Type: application/json" \ - | jq '.tags[0].name' | grep -oE '[0-9]+\.[0-9]+-[0-9]+-CI' + | jq -r '[.tags[] | select(.name | test("^[0-9]+\\.[0-9]+-[0-9]+-CI$"))] | max_by(.start_ts) | .name' } # Helper function to get dynamic value file path based on previous release version From 71fc070761ae6db94c4d5278b3131659ed6c7169 Mon Sep 17 00:00:00 2001 From: Gustavo Lira e Silva Date: Fri, 4 Sep 2026 11:10:13 -0300 Subject: [PATCH 2/2] fix(ci): map GA tags to their chart, and stop resolving "null" Two problems found reviewing this PR's own diff. Dropping the `grep` after jq lost the empty case: `max_by` over no matches yields null, and `jq -r` prints it as the string "null", so CHART_VERSION became "null". The old grep produced nothing there. Add `// empty`. A GA verification pins the image to x.y.z and passes no --chart-version, which fell through to the lookup and paired it with the newest CI chart - the same mismatch this PR fixes, for the other half of the flow. The chart repo publishes exact GA tags (1.9.8 exists), so map x.y.z to itself. Co-Authored-By: Claude Opus 5 (1M context) --- .ci/pipelines/openshift-ci-tests.sh | 5 +++++ .ci/pipelines/utils.sh | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.ci/pipelines/openshift-ci-tests.sh b/.ci/pipelines/openshift-ci-tests.sh index 4f48e6cac5..c5cf8d25d8 100755 --- a/.ci/pipelines/openshift-ci-tests.sh +++ b/.ci/pipelines/openshift-ci-tests.sh @@ -64,6 +64,11 @@ main() { # a later build. CHART_VERSION="${TAG_NAME}-CI" log::info "Derived CHART_VERSION from pinned TAG_NAME: ${CHART_VERSION}" + elif [[ "${TAG_NAME:-}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + # A GA verification pins the image to x.y.z and passes no --chart-version. + # The chart repo publishes the same x.y.z tag, so map it straight across. + CHART_VERSION="${TAG_NAME}" + log::info "Derived CHART_VERSION from pinned GA TAG_NAME: ${CHART_VERSION}" else CHART_VERSION=$(get_chart_version "$CHART_MAJOR_VERSION") fi diff --git a/.ci/pipelines/utils.sh b/.ci/pipelines/utils.sh index 93321de504..d87342c48a 100755 --- a/.ci/pipelines/utils.sh +++ b/.ci/pipelines/utils.sh @@ -1510,7 +1510,7 @@ get_previous_release_version() { get_chart_version() { local chart_major_version=$1 curl -sSX GET "https://quay.io/api/v1/repository/rhdh/chart/tag/?onlyActiveTags=true&filter_tag_name=like:${chart_major_version}-" -H "Content-Type: application/json" \ - | jq -r '[.tags[] | select(.name | test("^[0-9]+\\.[0-9]+-[0-9]+-CI$"))] | max_by(.start_ts) | .name' + | jq -r '[.tags[] | select(.name | test("^[0-9]+\\.[0-9]+-[0-9]+-CI$"))] | max_by(.start_ts) | .name // empty' } # Helper function to get dynamic value file path based on previous release version