Skip to content

Commit 7618e9b

Browse files
authored
Track logstash versions in .ci (#1221)
* Track logstash versions in .ci Previously logstash versions were tracked in the logstash repo and curled during CI steps. This commit moves the source of truth to the `.ci` repo where the consumer of that information lives. This also changes the format from json to yaml to allow commenting in the file. * REMOVE THIS COMMIT Temporarily include logstash-versions until logstash-plugins/.ci#77 is merged. * Fix path to logstash-releases.yaml * Code review resolution * Revert "REMOVE THIS COMMIT" This reverts commit 2aadeda.
1 parent f7cf1d6 commit 7618e9b

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

.ci/docker-setup.sh

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,22 @@ fi
3434
# The ELASTIC_STACK_VERSION may be an alias, save the original before translating it
3535
ELASTIC_STACK_VERSION_ALIAS="$ELASTIC_STACK_VERSION"
3636

37-
echo "Fetching versions from $VERSION_URL"
38-
VERSIONS=$(curl -s $VERSION_URL)
39-
37+
echo "Computing latest stream version"
38+
VERSION_CONFIG_FILE="$(dirname "$0")/logstash-versions.yml"
4039
if [[ "$SNAPSHOT" = "true" ]]; then
41-
ELASTIC_STACK_RETRIEVED_VERSION=$(echo $VERSIONS | jq '.snapshots."'"$ELASTIC_STACK_VERSION"'"')
42-
echo $ELASTIC_STACK_RETRIEVED_VERSION
40+
ELASTIC_STACK_RETRIEVED_VERSION=$(ruby -r yaml -e "puts YAML.load_file('$VERSION_CONFIG_FILE')['snapshots']['$ELASTIC_STACK_VERSION']")
4341
else
44-
ELASTIC_STACK_RETRIEVED_VERSION=$(echo $VERSIONS | jq '.releases."'"$ELASTIC_STACK_VERSION"'"')
42+
ELASTIC_STACK_RETRIEVED_VERSION=$(ruby -r yaml -e "puts YAML.load_file('$VERSION_CONFIG_FILE')['releases']['$ELASTIC_STACK_VERSION']")
4543
fi
4644

47-
if [[ "$ELASTIC_STACK_RETRIEVED_VERSION" != "null" ]]; then
48-
# remove starting and trailing double quotes
49-
ELASTIC_STACK_RETRIEVED_VERSION="${ELASTIC_STACK_RETRIEVED_VERSION%\"}"
50-
ELASTIC_STACK_RETRIEVED_VERSION="${ELASTIC_STACK_RETRIEVED_VERSION#\"}"
51-
echo "Translated $ELASTIC_STACK_VERSION to ${ELASTIC_STACK_RETRIEVED_VERSION}"
45+
if [[ -n "$ELASTIC_STACK_RETRIEVED_VERSION" ]]; then
46+
echo "Translating ELASTIC_STACK_VERSION to ${ELASTIC_STACK_RETRIEVED_VERSION}"
5247
export ELASTIC_STACK_VERSION=$ELASTIC_STACK_RETRIEVED_VERSION
5348
elif [[ "$ELASTIC_STACK_VERSION" == "9.next" ]]; then
54-
# we know "9.next" only exists between FF and GA of a minor
55-
# exit 99 so the build is skipped
5649
exit 99
50+
else
51+
# No version translation found, assuming user provided explicit version
52+
echo "No version found for $ELASTIC_STACK_VERSION, using as-is"
5753
fi
5854

5955
case "${DISTRIBUTION}" in

0 commit comments

Comments
 (0)