File tree 5 files changed +34
-32
lines changed
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 @@ -26,17 +26,7 @@ rake artifact:docker_oss || error "artifact:docker_oss build failed."
26
26
rake artifact:docker_wolfi || error " artifact:docker_wolfi build failed."
27
27
rake artifact:dockerfiles || error " artifact:dockerfiles build failed."
28
28
29
- if [[ " $WORKFLOW_TYPE " == " staging" ]] && [[ -n " $VERSION_QUALIFIER " ]]; then
30
- # Qualifier is passed from CI as optional field and specify the version postfix
31
- # in case of alpha or beta releases for staging builds only:
32
- # e.g: 8.0.0-alpha1
33
- STACK_VERSION=" ${STACK_VERSION} -${VERSION_QUALIFIER} "
34
- fi
35
-
36
- if [[ " $WORKFLOW_TYPE " == " snapshot" ]]; then
37
- STACK_VERSION=" ${STACK_VERSION} -SNAPSHOT"
38
- fi
39
-
29
+ STACK_VERSION=" $( ./$( dirname " $0 " ) /../common/qualified-version.sh) "
40
30
info " Build complete, setting STACK_VERSION to $STACK_VERSION ."
41
31
42
32
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 @@ -29,12 +29,12 @@ export JRUBY_OPTS="-J-Xmx4g"
29
29
30
30
# Extract the version number from the version.yml file
31
31
# e.g.: 8.6.0
32
- # The suffix part like alpha1 etc is managed by the optional VERSION_QUALIFIER_OPT environment variable
32
+ # The suffix part like alpha1 etc is managed by the optional VERSION_QUALIFIER environment variable
33
33
STACK_VERSION=` cat versions.yml | sed -n ' s/^logstash\:[[:space:]]\([[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\)$/\1/p' `
34
34
35
35
info " Agent is running on architecture [$( uname -i) ]"
36
36
37
- export VERSION_QUALIFIER_OPT =${VERSION_QUALIFIER_OPT :- " " }
37
+ export VERSION_QUALIFIER =${VERSION_QUALIFIER :- " " }
38
38
export DRA_DRY_RUN=${DRA_DRY_RUN:- " " }
39
39
40
40
if [[ ! -z $DRA_DRY_RUN && $BUILDKITE_STEP_KEY == " logstash_publish_dra" ]]; then
Original file line number Diff line number Diff line change 45
45
info " Downloaded ARTIFACTS sha report"
46
46
for file in build/logstash-* ; do shasum $file ; done
47
47
48
- FINAL_VERSION=$STACK_VERSION
49
- if [[ -n " $VERSION_QUALIFIER " ]]; then
50
- FINAL_VERSION=" $FINAL_VERSION -${VERSION_QUALIFIER} "
51
- fi
52
-
53
- if [[ " $WORKFLOW_TYPE " == " snapshot" ]]; then
54
- FINAL_VERSION=" ${STACK_VERSION} -SNAPSHOT"
55
- fi
48
+ FINAL_VERSION=" $( ./$( dirname " $0 " ) /../common/qualified-version.sh) "
56
49
57
50
mv build/distributions/dependencies-reports/logstash-${FINAL_VERSION} .csv build/distributions/dependencies-${FINAL_VERSION} .csv
58
51
You can’t perform that action at this time.
0 commit comments