mirror of
https://github.com/elastic/logstash.git
synced 2025-04-19 04:15:23 -04:00
add ci shared qualified-version script (#17311)
* ci: add shareable script for generating qualified version * ci: use shared script to generate qualified version
This commit is contained in:
parent
787fd2c62f
commit
10b5a84f84
5 changed files with 34 additions and 32 deletions
29
.buildkite/scripts/common/qualified-version.sh
Executable file
29
.buildkite/scripts/common/qualified-version.sh
Executable file
|
@ -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
|
|
@ -26,17 +26,7 @@ rake artifact:docker_oss || error "artifact:docker_oss build failed."
|
|||
rake artifact:docker_wolfi || error "artifact:docker_wolfi build failed."
|
||||
rake artifact:dockerfiles || error "artifact:dockerfiles 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 "Saving tar.gz for docker images"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -29,12 +29,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
|
||||
|
|
|
@ -45,14 +45,7 @@ fi
|
|||
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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue