Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow use of version qualifier for staging artifacts #4328

Merged
merged 7 commits into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .buildkite/hooks/pre-command
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server" ]]; then
fi

if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server-package-mbp" ]]; then
check_if_file_exist_in_repo "infra" "${BUILDKITE_BRANCH}" #TODO should be changed to "main" for rollback...
# TODO remove and replace _branch with BUILDKITE_BRANCH after PR tests
_branch="${DRA_BRANCH:="${BUILDKITE_BRANCH:=""}"}"

check_if_file_exist_in_repo "infra" "${_branch}" #TODO should be changed to "main" for rollback...
fi

if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server" || "$BUILDKITE_PIPELINE_SLUG" == "fleet-server-perf-tests" ]]; then
Expand Down Expand Up @@ -70,7 +73,7 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server" && "$BUILDKITE_STEP_KEY" == "
fi

if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server-package-mbp" ]]; then
if [[ "$BUILDKITE_STEP_KEY" == "package-x86-64" || "$BUILDKITE_STEP_KEY" == "package-arm" || "$BUILDKITE_STEP_KEY" == "dra-snapshot" || "$BUILDKITE_STEP_KEY" == "dra-staging" ]]; then
if [[ "$BUILDKITE_STEP_KEY" == package-x86-64* || "$BUILDKITE_STEP_KEY" == package-arm* || "$BUILDKITE_STEP_KEY" == "dra-snapshot" || "$BUILDKITE_STEP_KEY" == "dra-staging" ]]; then
export PRIVATE_CI_GCS_CREDENTIALS_SECRET=$(retry 5 vault kv get -field plaintext -format=json ${PRIVATE_CI_GCS_CREDENTIALS_PATH})
export JOB_GCS_BUCKET
fi
Expand All @@ -89,7 +92,7 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server-package-mbp" ]]; then
fi

if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server-package-mbp" ]]; then
if [[ "$BUILDKITE_STEP_KEY" == "package-x86-64" || "$BUILDKITE_STEP_KEY" == "package-arm" ]]; then
if [[ "$BUILDKITE_STEP_KEY" == package-x86-64* || "$BUILDKITE_STEP_KEY" == package-arm* ]]; then
export PRIVATE_CI_GCS_CREDENTIALS_SECRET=$(retry 5 vault kv get -field plaintext -format=json ${PRIVATE_CI_GCS_CREDENTIALS_PATH})
export JOB_GCS_BUCKET
fi
Expand Down
2 changes: 1 addition & 1 deletion .buildkite/hooks/pre-exit
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server" && "$BUILDKITE_STEP_KEY" == "
fi

if [[ "$BUILDKITE_PIPELINE_SLUG" == "fleet-server-package-mbp" ]]; then
if [[ "$BUILDKITE_STEP_KEY" == "package-x86-64" || "$BUILDKITE_STEP_KEY" == "package-arm" || "$BUILDKITE_STEP_KEY" == "dra-snapshot" && "$BUILDKITE_STEP_KEY" == "dra-staging" ]]; then
if [[ "$BUILDKITE_STEP_KEY" == package-x86-64* || "$BUILDKITE_STEP_KEY" == package-arm* || "$BUILDKITE_STEP_KEY" == "dra-snapshot" && "$BUILDKITE_STEP_KEY" == "dra-staging" ]]; then
unset GOOGLE_APPLICATION_CREDENTIALS
unset VAULT_ROLE_ID_SECRET
unset VAULT_ADDR_SECRET
Expand Down
75 changes: 44 additions & 31 deletions .buildkite/pipeline.package.mbp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,55 +8,68 @@ env:
IMAGE_UBUNTU_ARM_64: "core-ubuntu-2004-aarch64"

steps:
- group: "Package and Publish"
key: "package-publish"
steps:
- label: "Package Ubuntu-20 x86_64"
key: "package-x86-64"
command: ".buildkite/scripts/package.sh {{matrix.type}}"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"
matrix:
setup:
type:
- "snapshot"
- "staging"
- label: "Package x86_64 snapshot"
# skip building + packaging snapshot for pre-releases (flagged by a non-empty VERSION_QUALIFIER env var/BK param)
# as prereleases are only intended to be used with staging; details in https://github.com/elastic/ingest-dev/issues/4855
if: "build.env('VERSION_QUALIFIER') == null"
key: "package-x86-64-snapshot"
command: ".buildkite/scripts/package.sh snapshot"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"

- label: "Package x86_64 staging"
key: "package-x86-64-staging"
command: ".buildkite/scripts/package.sh snapshot"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"

- label: "Package Ubuntu-20 aarch64"
key: "package-arm"
command: ".buildkite/scripts/package.sh {{matrix.type}}"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.2xlarge"
matrix:
setup:
type:
- "snapshot"
- "staging"
- label: "Package aarch64 snapshot"
if: "build.env('VERSION_QUALIFIER') == null"
key: "package-arm-snapshot"
command: ".buildkite/scripts/package.sh snapshot"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.2xlarge"

- label: "Package aarch64 staging"
key: "package-arm-staging"
command: ".buildkite/scripts/package.sh staging"
agents:
provider: "aws"
imagePrefix: "${IMAGE_UBUNTU_ARM_64}"
instanceType: "t4g.2xlarge"

- label: "DRA snapshot"
if: "${FILE_EXISTS_IN_REPO} && build.env('VERSION_QUALIFIER') == null"
key: "dra-snapshot"
command: ".buildkite/scripts/dra_release.sh snapshot"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"
if: ${FILE_EXISTS_IN_REPO}
depends_on:
- step: "package-publish"
- step: "package-x86-64-snapshot"
allow_failure: false
- step: "package-arm-snapshot"
allow_failure: false

- label: "DRA release staging"
# we don't usually build staging from the main branch, but we exceptionally allow it for prereleases
# 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"
agents:
provider: "gcp"
image: "${IMAGE_UBUNTU_X86_64}"
machineType: "c2-standard-16"
if: "${FILE_EXISTS_IN_REPO} == true && build.env('BUILDKITE_BRANCH') != 'main'"
depends_on:
- step: "dra-snapshot"
- step: "package-x86-64-staging"
allow_failure: false
- step: "package-arm-staging"
allow_failure: false
4 changes: 3 additions & 1 deletion .buildkite/scripts/dra_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ BASE_DIR="${WORKSPACE}/${FOLDER_PATH}"
DRA_OUTPUT="release-manager.out"
export PROJECT="fleet-server"
export TYPE=${1}
export BRANCH="${BUILDKITE_BRANCH}"
# 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
export BRANCH="${DRA_BRANCH:="${BUILDKITE_BRANCH:=""}"}"
export VERSION="$(make get-version)"

if [[ "${VERSION}" == *"-SNAPSHOT"* || "${VERSION}" == "" ]]; then
Expand Down
2 changes: 0 additions & 2 deletions .buildkite/scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ set -euo pipefail

source .buildkite/scripts/common.sh

VERSION=$(awk '/const DefaultVersion/{print $NF}' version/version.go | tr -d '"')
PLATFORM_TYPE=$(uname -m)
TYPE="$1"
INFRA_REPO="https://github.com/repos/elastic/infra/contents"

if [[ ${BUILDKITE_BRANCH} == "main" && ${TYPE} == "staging" ]]; then
echo "INFO: staging artifacts for the main branch are not required."
Expand Down
Loading