Skip to content

Commit e879299

Browse files
authored
Extend CI intake pipeline to run BC upgrade tests (#128614)
A new bc-upgrade step in the intake pipeline invokes a bash script to get the commit hash of the latest BC (or snapshot if no BC is available yet) from https://docs.elastic.dev/release/stack/release-api#future-releases for the current branch and runs BWC / upgrade tests from this commit to the HEAD commit of the current branch. If no matching BC / snapshot exists, the upgrade tests are skipped. Relates to ES-11905
1 parent 63f918a commit e879299

File tree

3 files changed

+76
-0
lines changed

3 files changed

+76
-0
lines changed

.buildkite/pipelines/intake.template.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ steps:
7272
buildDirectory: /dev/shm/bk
7373
env:
7474
BWC_VERSION: "{{matrix.BWC_VERSION}}"
75+
- label: bc-upgrade
76+
command: ".buildkite/scripts/run-bc-upgrade-tests.sh"
7577
- group: lucene-compat
7678
steps:
7779
- label: "{{matrix.LUCENE_VERSION}} / lucene-compat"

.buildkite/pipelines/intake.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@ steps:
7272
buildDirectory: /dev/shm/bk
7373
env:
7474
BWC_VERSION: "{{matrix.BWC_VERSION}}"
75+
- label: bc-upgrade
76+
command: ".buildkite/scripts/run-bc-upgrade-tests.sh"
77+
agents:
78+
image: "docker.elastic.co/ci-agent-images/eck-region/buildkite-agent:1.5"
79+
memory: "4G"
7580
- group: lucene-compat
7681
steps:
7782
- label: "{{matrix.LUCENE_VERSION}} / lucene-compat"
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/bash
2+
3+
#
4+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5+
# or more contributor license agreements. Licensed under the "Elastic License
6+
# 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
7+
# Public License v 1"; you may not use this file except in compliance with, at
8+
# your election, the "Elastic License 2.0", the "GNU Affero General Public
9+
# License v3.0 only", or the "Server Side Public License, v 1".
10+
#
11+
12+
set -euo pipefail
13+
14+
# Select the most recent build from the current branch.
15+
# We collect snapshots, order by date, then collect BCs, order by date, and concat them; then we select the last.
16+
# So if we have one (or more) BC, we will always prefer to use that. Otherwise we will use the latest snapshot.
17+
MANIFEST_URL="$(curl -s https://artifacts.elastic.co/releases/TfEVhiaBGqR64ie0g0r0uUwNAbEQMu1Z/future-releases/stack.json |
18+
jq ".releases[] |
19+
select(.branch == \"$BUILDKITE_BRANCH\") |
20+
select(.active_release == true) |
21+
((.snapshots | to_entries | sort_by(.value.completed_at)) +
22+
(.build_candidates | to_entries | sort_by(.value.completed_at))) |
23+
last | .value.manifest_url")"
24+
25+
if [[ -z "$MANIFEST_URL" ]]; then
26+
echo "No snapshots or build candidates for branch [$BUILDKITE_BRANCH]."
27+
echo "Skipping BC upgrade tests."
28+
exit 0
29+
fi
30+
31+
MANIFEST="$(curl -s "$MANIFEST_URL")"
32+
if [[ -z "$MANIFEST" ]]; then
33+
echo "Cannot get the build manifest from [$MANIFEST_URL]"
34+
exit 1
35+
fi
36+
37+
CURRENT_VERSION=$(sed -n 's/^elasticsearch[[:space:]]*=[[:space:]]*\(.*\)/\1/p' build-tools-internal/version.properties)
38+
39+
BC_VERSION=$(echo "$MANIFEST" | jq -r .version)
40+
BC_BUILD_ID=$(echo "$MANIFEST" | jq -r .build_id)
41+
BC_COMMIT_HASH=$(echo "$MANIFEST" | jq -r .projects.elasticsearch.commit_hash)
42+
43+
if [ "$CURRENT_VERSION-SNAPSHOT" != "$BC_VERSION" ]; then
44+
echo "Version [$BC_VERSION] of BC (or snapshot) does not match current version [$CURRENT_VERSION] of branch [$BUILDKITE_BRANCH]."
45+
echo "Skipping BC upgrade tests."
46+
exit 0
47+
fi
48+
49+
echo "Running BC upgrade tests on $BUILDKITE_BRANCH [$BC_VERSION] using BC (or snapshot) build of commit [$BC_COMMIT_HASH] with build id [$BC_BUILD_ID]."
50+
51+
cat <<EOF | buildkite-agent pipeline upload
52+
steps:
53+
- label: bc-upgrade $BC_BUILD_ID -> $BUILDKITE_BRANCH
54+
command: .ci/scripts/run-gradle.sh -Dbwc.checkout.align=true -Dorg.elasticsearch.build.cache.push=true -Dignore.tests.seed -Dscan.capture-file-fingerprints -Dtests.bwc.main.version=${BC_VERSION} -Dtests.bwc.refspec.main=${BC_COMMIT_HASH} bcUpgradeTest -Dtests.jvm.argline="-Des.serverless_transport=true"
55+
timeout_in_minutes: 300
56+
agents:
57+
provider: gcp
58+
image: family/elasticsearch-ubuntu-2004
59+
machineType: n1-standard-32
60+
buildDirectory: /dev/shm/bk
61+
preemptible: true
62+
retry:
63+
automatic:
64+
- exit_status: "-1"
65+
limit: 3
66+
signal_reason: none
67+
- signal_reason: agent_stop
68+
limit: 3
69+
EOF

0 commit comments

Comments
 (0)