From aa17c79c3dfdb00d402c0e8d56d200a7aa1a372f Mon Sep 17 00:00:00 2001 From: Mariusz Jozala Date: Mon, 1 Sep 2025 15:29:10 +0200 Subject: [PATCH 1/3] Fix FwC test task registration With this change it takes into account that not all versions have previous minor unreleased version (because we are on the oldest active development branch), or that current version has minor == 0 (e.g. 9.0) so previous minor have to be calculated differently. --- .../main/groovy/elasticsearch.fwc-test.gradle | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/build-tools-internal/src/main/groovy/elasticsearch.fwc-test.gradle b/build-tools-internal/src/main/groovy/elasticsearch.fwc-test.gradle index 51301b405e514..2257ae2d03da9 100644 --- a/build-tools-internal/src/main/groovy/elasticsearch.fwc-test.gradle +++ b/build-tools-internal/src/main/groovy/elasticsearch.fwc-test.gradle @@ -7,19 +7,23 @@ * License v3.0 only", or the "Server Side Public License, v 1". */ -import org.elasticsearch.gradle.VersionProperties +import org.elasticsearch.gradle.Version import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask -def fwcVersions = buildParams.bwcVersions.released.findAll { it.major == VersionProperties.elasticsearchVersion.major && it.minor == VersionProperties.elasticsearchVersion.minor } -def previousMinorSnapshot = buildParams.bwcVersions.unreleased.find { it.major == VersionProperties.elasticsearchVersion.major && it.minor == VersionProperties.elasticsearchVersion.minor - 1 } - -fwcVersions.each { fwcVersion -> - tasks.register("v${fwcVersion}#fwcTest", StandaloneRestIntegTestTask) { - usesBwcDistribution(previousMinorSnapshot) - usesBwcDistribution(fwcVersion) - systemProperty("tests.old_cluster_version", previousMinorSnapshot) - systemProperty("tests.new_cluster_version", fwcVersion) - nonInputProperties.systemProperty 'tests.fwc', 'true' +Version elasticsearchVersion = Version.fromString(versions.get("elasticsearch")) +def fwcVersions = buildParams.bwcVersions.released.findAll { it.major == elasticsearchVersion.major && it.minor == elasticsearchVersion.minor } +def targetMajor = elasticsearchVersion.minor > 0 ? elasticsearchVersion.major : elasticsearchVersion.major - 1 +def targetMinor = elasticsearchVersion.minor > 0 ? elasticsearchVersion.minor - 1 : buildParams.bwcVersions.unreleased.findAll { it.major == targetMajor }*.minor.max() +def previousMinorSnapshot = buildParams.bwcVersions.unreleased.find { it.major == targetMajor && it.minor == targetMinor } +if (previousMinorSnapshot != null) { + fwcVersions.each { fwcVersion -> + tasks.register("v${fwcVersion}#fwcTest", StandaloneRestIntegTestTask) { + usesBwcDistribution(previousMinorSnapshot) + usesBwcDistribution(fwcVersion) + systemProperty("tests.old_cluster_version", previousMinorSnapshot) + systemProperty("tests.new_cluster_version", fwcVersion) + nonInputProperties.systemProperty 'tests.fwc', 'true' + } } } From cf3fbd1d79bed6c9094477e16a4c70fb164ab2cb Mon Sep 17 00:00:00 2001 From: Mariusz Jozala Date: Tue, 2 Sep 2025 09:50:25 +0200 Subject: [PATCH 2/3] Add FwC branch configuration and update periodic trigger logic Ensuring that only relevant branches are considered. --- .buildkite/scripts/fwc-branches.sh | 24 ++++++++++++++++++++++++ .buildkite/scripts/periodic.trigger.sh | 4 ++-- 2 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 .buildkite/scripts/fwc-branches.sh diff --git a/.buildkite/scripts/fwc-branches.sh b/.buildkite/scripts/fwc-branches.sh new file mode 100644 index 0000000000000..2bf0ff470dce7 --- /dev/null +++ b/.buildkite/scripts/fwc-branches.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +# Configure FwC test branches +# We do not want 7.x branch and only to run for branches that: +# - have released at least one minor version (not main) +# - have previous minor unreleased (not the oldest development branch) +FWC_BRANCHES=() +for branch in "${BRANCHES[@]}"; do + if [[ ! "$branch" =~ ^7\..* ]]; then + FWC_BRANCHES+=("$branch") + fi +done +# Remove first and last element +FWC_BRANCHES=("${FWC_BRANCHES[@]:1:${#FWC_BRANCHES[@]}-2}") + +shouldRunFwcFor() { + local branch=$1 + for fwc_branch in "${FWC_BRANCHES[@]}"; do + if [[ "$fwc_branch" == "$branch" ]]; then + return 0 + fi + done + return 1 +} diff --git a/.buildkite/scripts/periodic.trigger.sh b/.buildkite/scripts/periodic.trigger.sh index 30e13386f3088..a987de8939084 100755 --- a/.buildkite/scripts/periodic.trigger.sh +++ b/.buildkite/scripts/periodic.trigger.sh @@ -5,6 +5,7 @@ set -euo pipefail echo "steps:" source .buildkite/scripts/branches.sh +source .buildkite/scripts/fwc-branches.sh IS_FIRST=true SKIP_DELAY="${SKIP_DELAY:-false}" @@ -46,8 +47,7 @@ EOF branch: "$BRANCH" commit: "$LAST_GOOD_COMMIT" EOF -# Include forward compatibility tests only for the bugfix branch -if [[ "${BRANCH}" == "${BRANCHES[2]}" ]]; then +if shouldRunFwcFor "$BRANCH"; then cat < Date: Tue, 2 Sep 2025 11:00:49 +0200 Subject: [PATCH 3/3] Correct FWC periodic pipeline variables Utilize Buildkite matrix syntax and escape env in command. --- .buildkite/pipelines/periodic-fwc.template.yml | 6 +++--- .buildkite/pipelines/periodic-fwc.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.buildkite/pipelines/periodic-fwc.template.yml b/.buildkite/pipelines/periodic-fwc.template.yml index 5154ef36aaacc..e8a3178447185 100644 --- a/.buildkite/pipelines/periodic-fwc.template.yml +++ b/.buildkite/pipelines/periodic-fwc.template.yml @@ -1,6 +1,6 @@ steps: - - label: $FWC_VERSION / fwc - command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$FWC_VERSION#fwcTest -Dtests.bwc.snapshot=false + - label: "{{matrix.FWC_VERSION}}" / fwc + command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$$FWC_VERSION#fwcTest -Dtests.bwc.snapshot=false timeout_in_minutes: 300 agents: provider: gcp @@ -11,4 +11,4 @@ steps: setup: FWC_VERSION: $FWC_LIST env: - FWC_VERSION: $FWC_VERSION + FWC_VERSION: "{{matrix.FWC_VERSION}}" diff --git a/.buildkite/pipelines/periodic-fwc.yml b/.buildkite/pipelines/periodic-fwc.yml index f17ee5574e6e7..60472d9a1a01d 100644 --- a/.buildkite/pipelines/periodic-fwc.yml +++ b/.buildkite/pipelines/periodic-fwc.yml @@ -1,7 +1,7 @@ # This file is auto-generated. See .buildkite/pipelines/periodic-fwc.template.yml steps: - - label: $FWC_VERSION / fwc - command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$FWC_VERSION#fwcTest -Dtests.bwc.snapshot=false + - label: "{{matrix.FWC_VERSION}}" / fwc + command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$$FWC_VERSION#fwcTest -Dtests.bwc.snapshot=false timeout_in_minutes: 300 agents: provider: gcp @@ -12,4 +12,4 @@ steps: setup: FWC_VERSION: [] env: - FWC_VERSION: $FWC_VERSION + FWC_VERSION: "{{matrix.FWC_VERSION}}"