Skip to content

Commit

Permalink
Allow use of version qualifier for staging artifacts (#42304)
Browse files Browse the repository at this point in the history
This commits adds support for an optional $VERSION_QUALIFIER env var/build option in the packaging pipeline to allow building prerelease artifacts from staging.

Closes elastic/ingest-dev#4857
  • Loading branch information
dliappis authored Jan 16, 2025
1 parent a3cefc0 commit c7b6ad8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
15 changes: 9 additions & 6 deletions .buildkite/packaging.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ steps:
key: start-gate-snapshot

- name: Start of concurrency group for DRA Staging
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/
# exceptionally allow building staging from main when VERSION_QUALIFIER is set, to allow prerelease testing
# TODO remove OR clause below and above comment, and only allow matching /^[0-9]+\.[0-9x]+\$/ for build.branch
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env('VERSION_QUALIFIER') != null
command: echo "--> Start of concurrency gate dra-staging"
concurrency_group: "dra-gate-staging-$BUILDKITE_BRANCH"
concurrency: 1
Expand Down Expand Up @@ -58,7 +60,8 @@ steps:
- build/distributions/**/*

- label: Staging dashboards
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/
# TODO remove OR clause below (see earlier comment)
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env('VERSION_QUALIFIER') != null
depends_on: start-gate-staging
key: dashboards-staging
# TODO: container with go and make
Expand Down Expand Up @@ -170,8 +173,8 @@ steps:
- group: Packaging Staging
key: packaging-staging
depends_on: start-gate-staging
## Only for release
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/
# TODO remove OR clause below (see earlier comment)
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env('VERSION_QUALIFIER') != null
steps:
- label: "STAGING: {{matrix}}"
env:
Expand Down Expand Up @@ -276,8 +279,8 @@ steps:
machineType: "${GCP_DEFAULT_MACHINE_TYPE}"

- label: DRA Staging
## Only for release branches
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/
# TODO remove OR clause below (see earlier comment)
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env('VERSION_QUALIFIER') != null
key: dra-staging
env:
DRA_WORKFLOW: staging
Expand Down
7 changes: 5 additions & 2 deletions .buildkite/scripts/dra.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ set -euo pipefail
BRANCH="${DRA_BRANCH:="${BUILDKITE_BRANCH:=""}"}"

BEAT_VERSION=$(make get-version)

VERSION_QUALIFIER="${VERSION_QUALIFIER:=""}"
CI_DRA_ROLE_PATH="kv/ci-shared/release/dra-role"

function release_manager_login {
Expand Down Expand Up @@ -49,7 +49,9 @@ docker run --rm \
--commit "${BUILDKITE_COMMIT}" \
--workflow "${DRA_WORKFLOW}" \
--version "${BEAT_VERSION}" \
--artifact-set "main"
--artifact-set "main" \
--qualifier "${VERSION_QUALIFIER}"


echo "+++ :hammer_and_pick: Publishing DRA artifacts for version [$BEAT_VERSION], branch [$BRANCH], workflow [$DRA_WORKFLOW] and DRY_RUN: [$DRY_RUN]"

Expand All @@ -68,6 +70,7 @@ docker run --rm \
--workflow "${DRA_WORKFLOW}" \
--version "${BEAT_VERSION}" \
--artifact-set "main" \
--qualifier "${VERSION_QUALIFIER}" \
${DRY_RUN} | tee rm-output.txt


Expand Down
8 changes: 8 additions & 0 deletions .buildkite/scripts/packaging/prepare-release-manager.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@
set -ueo pipefail

readonly TYPE=${1:-snapshot}
readonly VERSION_QUALIFIER="${VERSION_QUALIFIER:-""}"

# rename dependencies.csv to the name expected by release-manager.
VERSION=$(make get-version)
FINAL_VERSION=$VERSION-SNAPSHOT
if [ "$TYPE" != "snapshot" ] ; then
FINAL_VERSION=$VERSION
fi

set +e
if [[ -n "$VERSION_QUALIFIER" ]]; then
FINAL_VERSION="$FINAL_VERSION-${VERSION_QUALIFIER}"
fi
set -e

echo "Rename dependencies to $FINAL_VERSION"
mv build/distributions/dependencies.csv \
build/distributions/dependencies-"$FINAL_VERSION".csv
Expand Down

0 comments on commit c7b6ad8

Please sign in to comment.