diff --git a/.buildkite/pipeline.package.mbp.yml b/.buildkite/pipeline.package.mbp.yml index 46b74e848..fd79e27e0 100644 --- a/.buildkite/pipeline.package.mbp.yml +++ b/.buildkite/pipeline.package.mbp.yml @@ -21,7 +21,9 @@ steps: - label: "Package x86_64 staging" key: "package-x86-64-staging" - command: ".buildkite/scripts/package.sh staging" + command: | + source .buildkite/scripts/version_qualifier.sh + .buildkite/scripts/package.sh staging agents: provider: "gcp" image: "${IMAGE_UBUNTU_X86_64}" @@ -38,7 +40,9 @@ steps: - label: "Package aarch64 staging" key: "package-arm-staging" - command: ".buildkite/scripts/package.sh staging" + command: | + source .buildkite/scripts/version_qualifier.sh + .buildkite/scripts/package.sh staging agents: provider: "aws" imagePrefix: "${IMAGE_UBUNTU_ARM_64}" @@ -63,7 +67,9 @@ steps: # details in https://github.com/elastic/ingest-dev/issues/4855 if: "${FILE_EXISTS_IN_REPO} == true && (build.env('BUILDKITE_BRANCH') != 'main' || build.env('VERSION_QUALIFIER') != null)" key: "dra-staging" - command: ".buildkite/scripts/dra_release.sh staging" + command: | + source .buildkite/scripts/version_qualifier.sh + .buildkite/scripts/dra_release.sh staging agents: provider: "gcp" image: "${IMAGE_UBUNTU_X86_64}" diff --git a/.buildkite/scripts/version_qualifier.sh b/.buildkite/scripts/version_qualifier.sh new file mode 100755 index 000000000..88d172dad --- /dev/null +++ b/.buildkite/scripts/version_qualifier.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# An opinionated approach to managing the Elastic Qualifier for the DRA in a Google Bucket +# instead of using a Buildkite env variable. + +if [[ -n "$VERSION_QUALIFIER" ]]; then + echo "~~~ VERSION_QUALIFIER externally set to [$VERSION_QUALIFIER]" + return 0 +fi + +# DRA_BRANCH can be used for manually testing packaging with PRs +# e.g. define `DRA_BRANCH="main"` under Options/Environment Variables in the Buildkite UI after clicking new Build +BRANCH="${DRA_BRANCH:="${BUILDKITE_BRANCH:=""}"}" + +qualifier="" +URL="https://storage.googleapis.com/dra-qualifier/${BRANCH}" +if curl -sf -o /dev/null "$URL" ; then + qualifier=$(curl -s "$URL") +fi + +export VERSION_QUALIFIER="$qualifier" +echo "~~~ VERSION_QUALIFIER set to [$VERSION_QUALIFIER]"