Skip to content

Commit

Permalink
Backport #302 to 8.17: Support prereleases (#302) (#305)
Browse files Browse the repository at this point in the history
Support prereleases (#302)

This commit adds support for VERSION_QUALIFIER to DRA.
  • Loading branch information
dliappis authored Jan 30, 2025
1 parent 7de28ca commit 6a3afa9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ steps:
key: "dra-staging"
if: |
// Staging should only run when triggered from Unified Release
( build.branch =~ /^[0-9]+\.[0-9x]+\$/ && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" )
( (build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env('VERSION_QUALIFIER') != null) && build.env("BUILDKITE_TRIGGERED_FROM_BUILD_PIPELINE_SLUG") == "unified-release-staging" )
steps:
- label: ":construction_worker: Build stack installers / Staging"
command: ".buildkite/scripts/build.ps1"
Expand Down
14 changes: 6 additions & 8 deletions .buildkite/scripts/dra-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,19 @@ VAULT_ROLE_ID=$(echo $DRA_CREDS | jq -r '.role_id')
VAULT_SECRET_ID=$(echo $DRA_CREDS | jq -r '.secret_id')
BRANCH="${BUILDKITE_BRANCH}"
export VAULT_ADDR VAULT_ROLE_ID VAULT_SECRET_ID
VERSION_QUALIFIER="${VERSION_QUALIFIER:=""}"

# Retrieve version value
VERSION=$(curl -s --retry 5 --retry-delay 10 "$MANIFEST_URL" | jq -r '.version')
# remove -SNAPSHOT style suffix from VERSION
VERSION=${VERSION%-*}
MANIFEST_VERSION=$(curl -s --retry 5 --retry-delay 10 "$MANIFEST_URL" | jq -r '.version')
# remove -SNAPSHOT or -alpha1 style suffix from MANIFEST_VERSION
VERSION=${MANIFEST_VERSION%-*}
export VERSION
if [[ -z $VERSION ]]; then
echo "+++ Required version property from ${MANIFEST_URL} was empty: [$VERSION]. Exiting."
exit 1
fi

if [ "$DRA_WORKFLOW" == "staging" ]; then
BEATS_MANIFEST_URL=$(curl https://artifacts-"$DRA_WORKFLOW".elastic.co/beats/latest/"$VERSION".json | jq -r '.manifest_url')
else
BEATS_MANIFEST_URL=$(curl https://artifacts-"$DRA_WORKFLOW".elastic.co/beats/latest/"$VERSION"-SNAPSHOT.json | jq -r '.manifest_url')
fi
BEATS_MANIFEST_URL=$(curl https://artifacts-"$DRA_WORKFLOW".elastic.co/beats/latest/"$MANIFEST_VERSION".json | jq -r '.manifest_url')

# Publish DRA artifacts
function run_release_manager() {
Expand All @@ -58,6 +55,7 @@ function run_release_manager() {
--version "${VERSION}" \
--artifact-set main \
--dependency beats:"${BEATS_MANIFEST_URL}" \
--qualifier "${VERSION_QUALIFIER}" \
$dry_run \
#
}
Expand Down

0 comments on commit 6a3afa9

Please sign in to comment.