File tree Expand file tree Collapse file tree 5 files changed +34
-32
lines changed Expand file tree Collapse file tree 5 files changed +34
-32
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ # ********************************************************
4
+ # Source this script to get the QUALIFIED_VERSION env var
5
+ # or execute it to receive the qualified version on stdout
6
+ # ********************************************************
7
+
8
+ set -euo pipefail
9
+
10
+ export QUALIFIED_VERSION=" $(
11
+ # Extract the version number from the version.yml file
12
+ # e.g.: 8.6.0
13
+ printf ' %s' " $( awk -F' :' ' { if ("logstash" == $1) { gsub(/^ | $/,"",$2); printf $2; exit } }' versions.yml) "
14
+
15
+ # Qualifier is passed from CI as optional field and specify the version postfix
16
+ # in case of alpha or beta releases for staging builds only:
17
+ # e.g: 8.0.0-alpha1
18
+ printf ' %s' " ${VERSION_QUALIFIER: +-${VERSION_QUALIFIER} } "
19
+
20
+ # add the SNAPSHOT tag unless WORKFLOW_TYPE=="staging" or RELEASE=="1"
21
+ if [[ ! ( " ${WORKFLOW_TYPE:- } " == " staging" || " ${RELEASE: +$RELEASE } " == " 1" ) ]]; then
22
+ printf ' %s' " -SNAPSHOT"
23
+ fi
24
+ ) "
25
+
26
+ # if invoked directly, output the QUALIFIED_VERSION to stdout
27
+ if [[ " $0 " == " ${BASH_SOURCE:- ${ZSH_SCRIPT:- } } " ]]; then
28
+ printf ' %s' " ${QUALIFIED_VERSION} "
29
+ fi
Original file line number Diff line number Diff line change @@ -30,17 +30,7 @@ if [[ "$ARCH" != "aarch64" ]]; then
30
30
rake artifact:docker_ubi8 || error " artifact:docker_ubi8 build failed."
31
31
fi
32
32
33
- if [[ " $WORKFLOW_TYPE " == " staging" ]] && [[ -n " $VERSION_QUALIFIER " ]]; then
34
- # Qualifier is passed from CI as optional field and specify the version postfix
35
- # in case of alpha or beta releases for staging builds only:
36
- # e.g: 8.0.0-alpha1
37
- STACK_VERSION=" ${STACK_VERSION} -${VERSION_QUALIFIER} "
38
- fi
39
-
40
- if [[ " $WORKFLOW_TYPE " == " snapshot" ]]; then
41
- STACK_VERSION=" ${STACK_VERSION} -SNAPSHOT"
42
- fi
43
-
33
+ STACK_VERSION=" $( ./$( dirname " $0 " ) /../common/qualified-version.sh) "
44
34
info " Build complete, setting STACK_VERSION to $STACK_VERSION ."
45
35
46
36
info " Saving tar.gz for docker images"
Original file line number Diff line number Diff line change 23
23
24
24
SKIP_DOCKER=1 rake artifact:all || error " rake artifact:all build failed."
25
25
26
- if [[ " $WORKFLOW_TYPE " == " staging" ]] && [[ -n " $VERSION_QUALIFIER " ]]; then
27
- # Qualifier is passed from CI as optional field and specify the version postfix
28
- # in case of alpha or beta releases for staging builds only:
29
- # e.g: 8.0.0-alpha1
30
- STACK_VERSION=" ${STACK_VERSION} -${VERSION_QUALIFIER} "
31
- fi
32
-
33
- if [[ " $WORKFLOW_TYPE " == " snapshot" ]]; then
34
- STACK_VERSION=" ${STACK_VERSION} -SNAPSHOT"
35
- fi
36
-
26
+ STACK_VERSION=" $( ./$( dirname " $0 " ) /../common/qualified-version.sh) "
37
27
info " Build complete, setting STACK_VERSION to $STACK_VERSION ."
38
28
39
29
info " Generated Artifacts"
Original file line number Diff line number Diff line change @@ -33,12 +33,12 @@ export JRUBY_OPTS="-J-Xmx4g"
33
33
34
34
# Extract the version number from the version.yml file
35
35
# e.g.: 8.6.0
36
- # The suffix part like alpha1 etc is managed by the optional VERSION_QUALIFIER_OPT environment variable
36
+ # The suffix part like alpha1 etc is managed by the optional VERSION_QUALIFIER environment variable
37
37
STACK_VERSION=` cat versions.yml | sed -n ' s/^logstash\:[[:space:]]\([[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\)$/\1/p' `
38
38
39
39
info " Agent is running on architecture [$( uname -i) ]"
40
40
41
- export VERSION_QUALIFIER_OPT =${VERSION_QUALIFIER_OPT :- " " }
41
+ export VERSION_QUALIFIER =${VERSION_QUALIFIER :- " " }
42
42
export DRA_DRY_RUN=${DRA_DRY_RUN:- " " }
43
43
44
44
if [[ ! -z $DRA_DRY_RUN && $BUILDKITE_STEP_KEY == " logstash_publish_dra" ]]; then
Original file line number Diff line number Diff line change @@ -52,14 +52,7 @@ rm -f build/logstash-ubi8-${STACK_VERSION}-docker-image-aarch64.tar.gz
52
52
info " Downloaded ARTIFACTS sha report"
53
53
for file in build/logstash-* ; do shasum $file ; done
54
54
55
- FINAL_VERSION=$STACK_VERSION
56
- if [[ -n " $VERSION_QUALIFIER " ]]; then
57
- FINAL_VERSION=" $FINAL_VERSION -${VERSION_QUALIFIER} "
58
- fi
59
-
60
- if [[ " $WORKFLOW_TYPE " == " snapshot" ]]; then
61
- FINAL_VERSION=" ${STACK_VERSION} -SNAPSHOT"
62
- fi
55
+ FINAL_VERSION=" $( ./$( dirname " $0 " ) /../common/qualified-version.sh) "
63
56
64
57
mv build/distributions/dependencies-reports/logstash-${FINAL_VERSION} .csv build/distributions/dependencies-${FINAL_VERSION} .csv
65
58
You can’t perform that action at this time.
0 commit comments