Skip to content

Commit

Permalink
Use centralized version qualifier (#42503)
Browse files Browse the repository at this point in the history
* Use centralized version qualifier

To avoid manual invocations specifying the version qualifier for
prereleases in this commit we leverage a centralized version of truth
for the version qualifier.

* fix bug

* revert defaults

(cherry picked from commit ad05234)
  • Loading branch information
dliappis authored and mergify[bot] committed Jan 30, 2025
1 parent 6c6cddc commit 31fe1f3
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 9 deletions.
26 changes: 17 additions & 9 deletions .buildkite/packaging.pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ steps:

- label: Staging dashboards
# TODO remove OR clause below (see earlier comment)
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env('VERSION_QUALIFIER') != null
if: (build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env('VERSION_QUALIFIER') != null) || build.env('RUN_STAGING') == "true"
depends_on: start-gate-staging
key: dashboards-staging
# TODO: container with go and make
Expand All @@ -73,9 +73,10 @@ steps:
retry:
automatic:
- limit: 1
commands:
- make build/distributions/dependencies.csv
- make beats-dashboards
commands: |
source .buildkite/scripts/version_qualifier.sh
make build/distributions/dependencies.csv
make beats-dashboards
env:
SNAPSHOT: false
DEV: false
Expand Down Expand Up @@ -172,14 +173,16 @@ steps:
key: packaging-staging
depends_on: start-gate-staging
# TODO remove OR clause below (see earlier comment)
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env('VERSION_QUALIFIER') != null
if: (build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env('VERSION_QUALIFIER') != null) || build.env('RUN_STAGING') == "true"
steps:
- label: "STAGING: {{matrix}}"
env:
PLATFORMS: "${PLATFORMS}"
SNAPSHOT: false
DEV: false
command: ".buildkite/scripts/packaging/package-dra.sh {{matrix}}"
command: |
source .buildkite/scripts/version_qualifier.sh
.buildkite/scripts/packaging/package-dra.sh {{matrix}}
agents:
provider: gcp
image: "${IMAGE_UBUNTU_X86_64}"
Expand Down Expand Up @@ -213,7 +216,9 @@ steps:
PACKAGES: "docker"
SNAPSHOT: false
DEV: false
command: ".buildkite/scripts/packaging/package-dra.sh {{matrix}}"
command: |
source .buildkite/scripts/version_qualifier.sh
.buildkite/scripts/packaging/package-dra.sh {{matrix}}
agents:
provider: "aws"
imagePrefix: "${AWS_IMAGE_UBUNTU_ARM_64}"
Expand Down Expand Up @@ -243,7 +248,9 @@ steps:
PLATFORMS: "${PLATFORMS}"
SNAPSHOT: false
DEV: false
command: ".buildkite/scripts/packaging/package-dra.sh x-pack/agentbeat"
command: |
source .buildkite/scripts/version_qualifier.sh
.buildkite/scripts/packaging/package-dra.sh x-pack/agentbeat
agents:
provider: gcp
image: "${IMAGE_UBUNTU_X86_64}"
Expand Down Expand Up @@ -279,7 +286,7 @@ steps:

- label: DRA Staging
# TODO remove OR clause below (see earlier comment)
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env('VERSION_QUALIFIER') != null
if: (build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env('VERSION_QUALIFIER') != null) || build.env('RUN_STAGING') == "true"
key: dra-staging
env:
DRA_WORKFLOW: staging
Expand All @@ -288,6 +295,7 @@ steps:
- packaging-staging
- dashboards-staging
command: |
source .buildkite/scripts/version_qualifier.sh
buildkite-agent artifact download "build/**" .
.buildkite/scripts/packaging/prepare-release-manager.sh staging
.buildkite/scripts/dra.sh
Expand Down
22 changes: 22 additions & 0 deletions .buildkite/scripts/version_qualifier.sh
Original file line number Diff line number Diff line change
@@ -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]"

0 comments on commit 31fe1f3

Please sign in to comment.