Skip to content
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
29 changes: 29 additions & 0 deletions .buildkite/scripts/common/qualified-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

# ********************************************************
# Source this script to get the QUALIFIED_VERSION env var
# or execute it to receive the qualified version on stdout
# ********************************************************

set -euo pipefail

export QUALIFIED_VERSION="$(
# Extract the version number from the version.yml file
# e.g.: 8.6.0
printf '%s' "$(awk -F':' '{ if ("logstash" == $1) { gsub(/^ | $/,"",$2); printf $2; exit } }' versions.yml)"

# Qualifier is passed from CI as optional field and specify the version postfix
# in case of alpha or beta releases for staging builds only:
# e.g: 8.0.0-alpha1
printf '%s' "${VERSION_QUALIFIER:+-${VERSION_QUALIFIER}}"

# add the SNAPSHOT tag unless WORKFLOW_TYPE=="staging" or RELEASE=="1"
if [[ ! ( "${WORKFLOW_TYPE:-}" == "staging" || "${RELEASE:+$RELEASE}" == "1" ) ]]; then
printf '%s' "-SNAPSHOT"
fi
)"

# if invoked directly, output the QUALIFIED_VERSION to stdout
if [[ "$0" == "${BASH_SOURCE:-${ZSH_SCRIPT:-}}" ]]; then
printf '%s' "${QUALIFIED_VERSION}"
fi
12 changes: 1 addition & 11 deletions .buildkite/scripts/dra/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,7 @@ if [[ "$ARCH" != "aarch64" ]]; then
rake artifact:docker_ubi8 || error "artifact:docker_ubi8 build failed."
fi

if [[ "$WORKFLOW_TYPE" == "staging" ]] && [[ -n "$VERSION_QUALIFIER" ]]; then
# Qualifier is passed from CI as optional field and specify the version postfix
# in case of alpha or beta releases for staging builds only:
# e.g: 8.0.0-alpha1
STACK_VERSION="${STACK_VERSION}-${VERSION_QUALIFIER}"
fi

if [[ "$WORKFLOW_TYPE" == "snapshot" ]]; then
STACK_VERSION="${STACK_VERSION}-SNAPSHOT"
fi

STACK_VERSION="$(./$(dirname "$0")/../common/qualified-version.sh)"
info "Build complete, setting STACK_VERSION to $STACK_VERSION."

info "Saving tar.gz for docker images"
Expand Down
12 changes: 1 addition & 11 deletions .buildkite/scripts/dra/build_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,7 @@ esac

SKIP_DOCKER=1 rake artifact:all || error "rake artifact:all build failed."

if [[ "$WORKFLOW_TYPE" == "staging" ]] && [[ -n "$VERSION_QUALIFIER" ]]; then
# Qualifier is passed from CI as optional field and specify the version postfix
# in case of alpha or beta releases for staging builds only:
# e.g: 8.0.0-alpha1
STACK_VERSION="${STACK_VERSION}-${VERSION_QUALIFIER}"
fi

if [[ "$WORKFLOW_TYPE" == "snapshot" ]]; then
STACK_VERSION="${STACK_VERSION}-SNAPSHOT"
fi

STACK_VERSION="$(./$(dirname "$0")/../common/qualified-version.sh)"
info "Build complete, setting STACK_VERSION to $STACK_VERSION."

info "Generated Artifacts"
Expand Down
4 changes: 2 additions & 2 deletions .buildkite/scripts/dra/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ export JRUBY_OPTS="-J-Xmx4g"

# Extract the version number from the version.yml file
# e.g.: 8.6.0
# The suffix part like alpha1 etc is managed by the optional VERSION_QUALIFIER_OPT environment variable
# The suffix part like alpha1 etc is managed by the optional VERSION_QUALIFIER environment variable
STACK_VERSION=`cat versions.yml | sed -n 's/^logstash\:[[:space:]]\([[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\)$/\1/p'`

info "Agent is running on architecture [$(uname -i)]"

export VERSION_QUALIFIER_OPT=${VERSION_QUALIFIER_OPT:-""}
export VERSION_QUALIFIER=${VERSION_QUALIFIER:-""}
export DRA_DRY_RUN=${DRA_DRY_RUN:-""}

if [[ ! -z $DRA_DRY_RUN && $BUILDKITE_STEP_KEY == "logstash_publish_dra" ]]; then
Expand Down
9 changes: 1 addition & 8 deletions .buildkite/scripts/dra/publish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,7 @@ rm -f build/logstash-ubi8-${STACK_VERSION}-docker-image-aarch64.tar.gz
info "Downloaded ARTIFACTS sha report"
for file in build/logstash-*; do shasum $file;done

FINAL_VERSION=$STACK_VERSION
if [[ -n "$VERSION_QUALIFIER" ]]; then
FINAL_VERSION="$FINAL_VERSION-${VERSION_QUALIFIER}"
fi

if [[ "$WORKFLOW_TYPE" == "snapshot" ]]; then
FINAL_VERSION="${STACK_VERSION}-SNAPSHOT"
fi
FINAL_VERSION="$(./$(dirname "$0")/../common/qualified-version.sh)"

mv build/distributions/dependencies-reports/logstash-${FINAL_VERSION}.csv build/distributions/dependencies-${FINAL_VERSION}.csv

Expand Down