Skip to content

Commit b48b4e2

Browse files
committed
Fix FwC test task registration (#133937)
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. * Add FwC branch configuration and update periodic trigger logic Ensuring that only relevant branches are considered. * Correct FWC periodic pipeline variables Utilize Buildkite matrix syntax and escape env in command.
1 parent f0103e6 commit b48b4e2

File tree

5 files changed

+47
-19
lines changed

5 files changed

+47
-19
lines changed
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
steps:
2-
- label: $FWC_VERSION / fwc
3-
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$FWC_VERSION#fwcTest -Dtests.bwc.snapshot=false
2+
- label: "{{matrix.FWC_VERSION}}" / fwc
3+
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$$FWC_VERSION#fwcTest -Dtests.bwc.snapshot=false
44
timeout_in_minutes: 300
55
agents:
66
provider: gcp
@@ -11,4 +11,4 @@ steps:
1111
setup:
1212
FWC_VERSION: $FWC_LIST
1313
env:
14-
FWC_VERSION: $FWC_VERSION
14+
FWC_VERSION: "{{matrix.FWC_VERSION}}"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is auto-generated. See .buildkite/pipelines/periodic-fwc.template.yml
22
steps:
3-
- label: $FWC_VERSION / fwc
4-
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$FWC_VERSION#fwcTest -Dtests.bwc.snapshot=false
3+
- label: "{{matrix.FWC_VERSION}}" / fwc
4+
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true v$$FWC_VERSION#fwcTest -Dtests.bwc.snapshot=false
55
timeout_in_minutes: 300
66
agents:
77
provider: gcp
@@ -12,4 +12,4 @@ steps:
1212
setup:
1313
FWC_VERSION: ["9.1.0", "9.1.1", "9.1.2", "9.1.3"]
1414
env:
15-
FWC_VERSION: $FWC_VERSION
15+
FWC_VERSION: "{{matrix.FWC_VERSION}}"

.buildkite/scripts/fwc-branches.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
# Configure FwC test branches
4+
# We do not want 7.x branch and only to run for branches that:
5+
# - have released at least one minor version (not main)
6+
# - have previous minor unreleased (not the oldest development branch)
7+
FWC_BRANCHES=()
8+
for branch in "${BRANCHES[@]}"; do
9+
if [[ ! "$branch" =~ ^7\..* ]]; then
10+
FWC_BRANCHES+=("$branch")
11+
fi
12+
done
13+
# Remove first and last element
14+
FWC_BRANCHES=("${FWC_BRANCHES[@]:1:${#FWC_BRANCHES[@]}-2}")
15+
16+
shouldRunFwcFor() {
17+
local branch=$1
18+
for fwc_branch in "${FWC_BRANCHES[@]}"; do
19+
if [[ "$fwc_branch" == "$branch" ]]; then
20+
return 0
21+
fi
22+
done
23+
return 1
24+
}

.buildkite/scripts/periodic.trigger.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -euo pipefail
55
echo "steps:"
66

77
source .buildkite/scripts/branches.sh
8+
source .buildkite/scripts/fwc-branches.sh
89

910
IS_FIRST=true
1011
SKIP_DELAY="${SKIP_DELAY:-false}"
@@ -46,8 +47,7 @@ EOF
4647
branch: "$BRANCH"
4748
commit: "$LAST_GOOD_COMMIT"
4849
EOF
49-
# Include forward compatibility tests only for the bugfix branch
50-
if [[ "${BRANCH}" == "${BRANCHES[2]}" ]]; then
50+
if shouldRunFwcFor "$BRANCH"; then
5151
cat <<EOF
5252
- trigger: elasticsearch-periodic-fwc
5353
label: Trigger periodic-fwc pipeline for $BRANCH

build-tools-internal/src/main/groovy/elasticsearch.fwc-test.gradle

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,23 @@
77
* License v3.0 only", or the "Server Side Public License, v 1".
88
*/
99

10-
import org.elasticsearch.gradle.VersionProperties
10+
import org.elasticsearch.gradle.Version
1111
import org.elasticsearch.gradle.testclusters.StandaloneRestIntegTestTask
1212

13-
def fwcVersions = buildParams.bwcVersions.released.findAll { it.major == VersionProperties.elasticsearchVersion.major && it.minor == VersionProperties.elasticsearchVersion.minor }
14-
def previousMinorSnapshot = buildParams.bwcVersions.unreleased.find { it.major == VersionProperties.elasticsearchVersion.major && it.minor == VersionProperties.elasticsearchVersion.minor - 1 }
15-
16-
fwcVersions.each { fwcVersion ->
17-
tasks.register("v${fwcVersion}#fwcTest", StandaloneRestIntegTestTask) {
18-
usesBwcDistribution(previousMinorSnapshot)
19-
usesBwcDistribution(fwcVersion)
20-
systemProperty("tests.old_cluster_version", previousMinorSnapshot)
21-
systemProperty("tests.new_cluster_version", fwcVersion)
22-
nonInputProperties.systemProperty 'tests.fwc', 'true'
13+
Version elasticsearchVersion = Version.fromString(versions.get("elasticsearch"))
14+
def fwcVersions = buildParams.bwcVersions.released.findAll { it.major == elasticsearchVersion.major && it.minor == elasticsearchVersion.minor }
15+
def targetMajor = elasticsearchVersion.minor > 0 ? elasticsearchVersion.major : elasticsearchVersion.major - 1
16+
def targetMinor = elasticsearchVersion.minor > 0 ? elasticsearchVersion.minor - 1 : buildParams.bwcVersions.unreleased.findAll { it.major == targetMajor }*.minor.max()
17+
def previousMinorSnapshot = buildParams.bwcVersions.unreleased.find { it.major == targetMajor && it.minor == targetMinor }
18+
if (previousMinorSnapshot != null) {
19+
fwcVersions.each { fwcVersion ->
20+
tasks.register("v${fwcVersion}#fwcTest", StandaloneRestIntegTestTask) {
21+
usesBwcDistribution(previousMinorSnapshot)
22+
usesBwcDistribution(fwcVersion)
23+
systemProperty("tests.old_cluster_version", previousMinorSnapshot)
24+
systemProperty("tests.new_cluster_version", fwcVersion)
25+
nonInputProperties.systemProperty 'tests.fwc', 'true'
26+
}
2327
}
2428
}
2529

0 commit comments

Comments
 (0)