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 } }' ) "  
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
3030  rake artifact:docker_ubi8 ||  error " artifact:docker_ubi8 build failed." 
3131fi 
3232
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 " ) ) " 
4434info " Build complete, setting STACK_VERSION to $STACK_VERSION ." 
4535
4636info " Saving tar.gz for docker images" 
Original file line number Diff line number Diff line change 2323
2424SKIP_DOCKER=1 rake artifact:all ||  error " rake artifact:all build failed." 
2525
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 " ) ) " 
3727info " Build complete, setting STACK_VERSION to $STACK_VERSION ." 
3828
3929info " Generated Artifacts" 
Original file line number Diff line number Diff line change @@ -33,12 +33,12 @@ export JRUBY_OPTS="-J-Xmx4g"
3333
3434#  Extract the version number from the version.yml file
3535#  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
3737STACK_VERSION=` cat versions.yml |  sed -n ' s/^logstash\:[[:space:]]\([[:digit:]]*\.[[:digit:]]*\.[[:digit:]]*\)$/\1/p' ` 
3838
3939info " Agent is running on architecture [$( uname -i) " 
4040
41- export  VERSION_QUALIFIER_OPT =${VERSION_QUALIFIER_OPT :- " "  
41+ export  VERSION_QUALIFIER =${VERSION_QUALIFIER :- " "  
4242export  DRA_DRY_RUN=${DRA_DRY_RUN:- " "  
4343
4444if  [[ !  -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
5252info " Downloaded ARTIFACTS sha report" 
5353for  file  in  build/logstash-* ;  do  shasum $file ; done 
5454
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 " ) ) " 
6356
6457mv build/distributions/dependencies-reports/logstash-${FINAL_VERSION} .csv build/distributions/dependencies-${FINAL_VERSION} .csv
6558
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments