Skip to content

Commit

Permalink
Support VERSION_QUALIFIER for elastic-agent-core DRA (#6551) (#6552)
Browse files Browse the repository at this point in the history
This commit adds support for the optional VERSION_QUALIFIER for the
elastic-agent-core staging DRA builds.

Closes #6543

(cherry picked from commit 7d1aaae)

Co-authored-by: Dimitrios Liappis <dimitrios.liappis@gmail.com>
  • Loading branch information
mergify[bot] and dliappis authored Jan 27, 2025
1 parent 1c75344 commit bf5e8e3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
5 changes: 3 additions & 2 deletions .buildkite/pipeline.elastic-agent-binary-dra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ env:
steps:
- group: ":beats: DRA Elastic-Agent Core Snapshot :beats:"
key: "dra-core-snapshot"
if: build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env("RUN_SNAPSHOT") == "true"
# don't run snapshot builds with prereleases (non empty VERSION_QUALIFIER) unless forced (RUN_SNAPSHOT=true)
if: build.env("RUN_SNAPSHOT") == "true" || (build.env('VERSION_QUALIFIER') == null && (build.branch == 'main' || build.branch =~ /^[0-9]+\.[0-9x]+\$/))
steps:
- label: ":package: Build Elastic-Agent Core Snapshot"
commands:
Expand Down Expand Up @@ -43,7 +44,7 @@ steps:

- group: ":beats: DRA Elastic-Agent Core Staging :beats:"
key: "dra-core-staging"
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env("RUN_STAGING") == "true"
if: build.branch =~ /^[0-9]+\.[0-9x]+\$/ || build.env("RUN_STAGING") == "true" || build.env('VERSION_QUALIFIER') != null
steps:
- label: ":package: Build Elastic-Agent Core staging"
commands:
Expand Down
6 changes: 6 additions & 0 deletions .buildkite/scripts/steps/build-agent-core.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ source .buildkite/scripts/common.sh

echo "+++ Build Agent artifacts"
SNAPSHOT=""
VERSION_QUALIFIER="${VERSION_QUALIFIER:=""}"
BEAT_VERSION_FULL=$BEAT_VERSION

if [ "$DRA_WORKFLOW" == "snapshot" ]; then
SNAPSHOT="true"
BEAT_VERSION_FULL="${BEAT_VERSION}-SNAPSHOT"
fi

if [[ "$DRA_WORKFLOW" == "staging" ]] && [[ -n "$VERSION_QUALIFIER" ]]; then
BEAT_VERSION_FULL="${BEAT_VERSION_FULL}-${VERSION_QUALIFIER}"
fi

SNAPSHOT=$SNAPSHOT mage packageAgentCore
chmod -R 777 build/distributions

Expand Down
7 changes: 5 additions & 2 deletions .buildkite/scripts/steps/dra-publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ WORKFLOW="${DRA_WORKFLOW:=""}"
COMMIT="${DRA_COMMIT:="${BUILDKITE_COMMIT:=""}"}"
BRANCH="${DRA_BRANCH:="${BUILDKITE_BRANCH:=""}"}"
PACKAGE_VERSION="${DRA_VERSION:="${BEAT_VERSION:=""}"}"
VERSION_QUALIFIER="${VERSION_QUALIFIER:=""}"

# force main branch on PR's or it won't execute
# because the PR branch does not have a project folder in release-manager
Expand Down Expand Up @@ -50,7 +51,8 @@ function run_release_manager_list() {
--commit "${_commit}" \
--workflow "${_workflow}" \
--version "${_version}" \
--artifact-set "${_artifact_set}"
--artifact-set "${_artifact_set}" \
--qualifier "${VERSION_QUALIFIER}"
}

# Publish DRA artifacts
Expand All @@ -71,10 +73,11 @@ function run_release_manager_collect() {
--workflow "${_workflow}" \
--version "${_version}" \
--artifact-set "${_artifact_set}" \
--qualifier "${VERSION_QUALIFIER}"
${_dry_run}
}

echo "+++ Release Manager ${WORKFLOW} / ${BRANCH} / ${COMMIT}";
echo "+++ Release Manager Workflow: ${WORKFLOW} / Branch: ${BRANCH} / VERSION_QUALIFIER: ${VERSION_QUALIFIER} / Commit: ${COMMIT}"
run_release_manager_list "${DRA_PROJECT_ID}" "${DRA_PROJECT_ARTIFACT_ID}" "${WORKFLOW}" "${COMMIT}" "${BRANCH}" "${PACKAGE_VERSION}"
run_release_manager_collect "${DRA_PROJECT_ID}" "${DRA_PROJECT_ARTIFACT_ID}" "${WORKFLOW}" "${COMMIT}" "${BRANCH}" "${PACKAGE_VERSION}" "${DRY_RUN}"
RM_EXIT_CODE=$?
Expand Down

0 comments on commit bf5e8e3

Please sign in to comment.