| 
 | 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 | +if [[ -z "$BUILDKITE_PULL_REQUEST_BASE_BRANCH" ]]; then  | 
 | 15 | +   echo "Not a pull request, skipping PR upgrade tests."  | 
 | 16 | +   exit 0  | 
 | 17 | +fi  | 
 | 18 | + | 
 | 19 | +# Identify the merge base of the current commit (branch) and the base branch of the pull request.  | 
 | 20 | +# PR upgrade tests are run from the merge base to the current commit.  | 
 | 21 | +BASE_COMMIT=$(git merge-base $BUILDKITE_PULL_REQUEST_BASE_BRANCH $BUILDKITE_COMMIT)  | 
 | 22 | + | 
 | 23 | +VERSION=$(sed -n 's/^elasticsearch[[:space:]]*=[[:space:]]*\(.*\)/\1/p' build-tools-internal/version.properties)  | 
 | 24 | + | 
 | 25 | +echo "Running PR upgrade tests from $BUILDKITE_PULL_REQUEST_BASE_BRANCH [$BASE_COMMIT] to $BUILDKITE_BRANCH [$BUILDKITE_COMMIT]."  | 
 | 26 | + | 
 | 27 | +cat <<EOF | buildkite-agent pipeline upload  | 
 | 28 | +steps:  | 
 | 29 | +    - label: pr-upgrade $BUILDKITE_PULL_REQUEST_BASE_BRANCH -> $BUILDKITE_BRANCH  | 
 | 30 | +      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=${VERSION}-SNAPSHOT -Dtests.bwc.refspec.main=${BASE_COMMIT} bcUpgradeTest -Dtests.jvm.argline="-Des.serverless_transport=true"  | 
 | 31 | +      timeout_in_minutes: 300  | 
 | 32 | +      agents:  | 
 | 33 | +        provider: gcp  | 
 | 34 | +        image: family/elasticsearch-ubuntu-2004  | 
 | 35 | +        machineType: n1-standard-32  | 
 | 36 | +        buildDirectory: /dev/shm/bk  | 
 | 37 | +        preemptible: true  | 
 | 38 | +      retry:  | 
 | 39 | +        automatic:  | 
 | 40 | +          - exit_status: "-1"  | 
 | 41 | +            limit: 3  | 
 | 42 | +            signal_reason: none  | 
 | 43 | +          - signal_reason: agent_stop  | 
 | 44 | +            limit: 3  | 
 | 45 | +EOF  | 
0 commit comments