Skip to content

Commit fbe1bc5

Browse files
committed
Extract version qualifier into standalone script
1 parent a21b70a commit fbe1bc5

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

.buildkite/pull_request_pipeline.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@ steps:
136136
- limit: 3
137137
command: |
138138
set -euo pipefail
139-
ci/run-observability-sre-container-smoketest.sh
139+
source .buildkite/scripts/common/vm-agent.sh
140+
# Provides QUALIFIED_VERSION
141+
source ci/version-qualifier.sh
142+
./gradlew --stacktrace artifactDockerObservabilitySRE
143+
docker run docker.elastic.co/logstash/logstash-observability-sre:${QUALIFIED_VERSION} \
144+
logstash -e 'input { generator { count => 3 } } output { stdout { codec => rubydebug } }'
140145
141146
- label: ":lab_coat: Integration Tests - FIPS mode / part 1"
142147
key: "integration-tests-fips-part-1"

ci/run-observability-sre-container-smoketest.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

ci/version-qualifier.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/usr/bin/env bash
2+
3+
# *********************************************************
4+
# This file provides the qualified version, considering the
5+
# contents of /versions.yml, VERSION_QUALIFIER, and RELEASE
6+
# *********************************************************
7+
8+
set -euo pipefail
9+
10+
export QUALIFIED_VERSION="$(
11+
# extract logstash version from versions.yml
12+
printf "$(awk -F':' '{ if ("logstash" == $1) { gsub(/^ | $/,"",$2); printf $2; exit } }' versions.yml)"
13+
14+
# append the VERSION_QUALIFIER if it is present
15+
printf "${VERSION_QUALIFIER:+-${VERSION_QUALIFIER}}"
16+
17+
# add the SNAPSHOT tag unless RELEASE=1
18+
[[ "${RELEASE:-0}" == "1" ]] || printf "-SNAPSHOT"
19+
)"
20+
21+
if [[ "$0" == "${BASH_SOURCE[0]}" ]]; then
22+
printf "${QUALIFIED_VERSION}"
23+
fi

0 commit comments

Comments
 (0)