Skip to content

Commit

Permalink
ci(dra): skip snapshots with qualifier and run in parallel (#15274)
Browse files Browse the repository at this point in the history
  • Loading branch information
v1v authored Jan 17, 2025
1 parent a6cf66b commit 57e3a42
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 25 deletions.
21 changes: 10 additions & 11 deletions .buildkite/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,14 @@ steps:
steps:
- label: "Package x86_64"
key: "package-x86-64"
command: ".buildkite/scripts/package.sh {{matrix.type}}"
command: ".buildkite/scripts/package.sh {{matrix}}"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"
matrix:
setup:
type:
- "snapshot"
- "staging"
- "snapshot"
- "staging"
artifact_paths:
- "build/distributions/**/*"
- "build/dependencies*.csv"
Expand All @@ -34,16 +32,14 @@ steps:

- label: "Package aarch64"
key: "package-arm"
command: ".buildkite/scripts/package.sh {{matrix.type}}"
command: ".buildkite/scripts/package.sh {{matrix}}"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.2xlarge"
matrix:
setup:
type:
- "snapshot"
- "staging"
- "snapshot"
- "staging"
artifact_paths:
- "build/distributions/**/*"
retry:
Expand All @@ -52,11 +48,14 @@ steps:

- label: "DRA"
key: "dra"
command: ".buildkite/scripts/dra.sh"
command: ".buildkite/scripts/dra.sh {{matrix}}"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"
matrix:
- "snapshot"
- "staging"
depends_on:
- step: "package"
allow_failure: false
30 changes: 16 additions & 14 deletions .buildkite/scripts/dra.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

set -eo pipefail

# Either staging or snapshot
TYPE="$1"

## Read current version.
VERSION=$(make get-version)

Expand Down Expand Up @@ -74,11 +77,12 @@ dra() {
local command=$2
local qualifier=${ELASTIC_QUALIFIER:-""}
echo "--- Run release manager $workflow (DRA command: $command)"
set -x
docker run --rm \
--name release-manager \
-e VAULT_ADDR="${VAULT_ADDR_SECRET}" \
-e VAULT_ROLE_ID="${VAULT_ROLE_ID_SECRET}" \
-e VAULT_SECRET_ID="${VAULT_SECRET}" \
-e VAULT_ADDR \
-e VAULT_ROLE_ID \
-e VAULT_SECRET_ID \
--mount type=bind,readonly=false,src=$(pwd),target=/artifacts \
docker.elastic.co/infra/release-manager:latest \
cli "$command" \
Expand All @@ -89,7 +93,7 @@ dra() {
--artifact-set main \
--qualifier "$qualifier" \
--version $VERSION | tee rm-output.txt

set +x
# Create Buildkite annotation similarly done in Beats:
# https://github.com/elastic/beats/blob/90f9e8f6e48e76a83331f64f6c8c633ae6b31661/.buildkite/scripts/dra.sh#L74-L81
if [[ "$command" == "collect" ]]; then
Expand All @@ -103,14 +107,12 @@ dra() {
fi
}

dra "snapshot" "$dra_command"
if [[ "${DRA_BRANCH}" != "main" && "${DRA_BRANCH}" != "8.x" ]]; then
echo "DRA_BRANCH is neither 'main' nor '8.x'"
dra "staging" "$dra_command"
fi

## Exception for main branch as requested by the Release Team.
if [[ "${DRA_BRANCH}" == "main" ]]; then
echo "Exception form main branch with the qualifier alpha1"
dra "staging" "$dra_command"
if [[ "${TYPE}" == "staging" ]]; then
if [[ "${DRA_BRANCH}" != "8.x" ]]; then
echo "${DRA_BRANCH} is not '8.x'"
dra "${TYPE}" "$dra_command"
fi
else
# NOTE: qualifier is not needed for snapshots, let's unset it.
dra "snapshot" "$dra_command" ""
fi

0 comments on commit 57e3a42

Please sign in to comment.