Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(dra): skip snapshots with qualifier and run in parallel #15274

Merged
merged 5 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading