Skip to content

Commit feba31a

Browse files
authored
gracefully accept that 8.next may not exist (#64)
* also tolerate missing snapshot images for 8.next 8.current and 8.previous
1 parent 96385c7 commit feba31a

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

docker-setup.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,20 @@ pull_docker_snapshot() {
88
project="${1?project name required}"
99
local docker_image="docker.elastic.co/${project}/${project}${DISTRIBUTION_SUFFIX}:${ELASTIC_STACK_VERSION}"
1010
echo "Pulling $docker_image"
11-
docker pull "$docker_image"
11+
if docker pull "$docker_image" ; then
12+
echo "docker pull successful"
13+
else
14+
case "$ELASTIC_STACK_VERSION_ARG" in
15+
"8.previous"|"8.current"|"8.next")
16+
echo "Failed to pull logstash-${ELASTIC_STACK_VERSION}. Likely due to missing DRA build, skipping."
17+
exit 0
18+
;;
19+
*)
20+
echo "Failed to pull logstash-${ELASTIC_STACK_VERSION}. The image should exist, failing the build.."
21+
exit 1
22+
;;
23+
esac
24+
fi
1225
}
1326

1427
VERSION_URL="https://raw.githubusercontent.com/elastic/logstash/main/ci/logstash_releases.json"
@@ -19,8 +32,11 @@ if [ -z "${ELASTIC_STACK_VERSION}" ]; then
1932
exit 1
2033
fi
2134

35+
# save the original arg if needed
36+
ELASTIC_STACK_VERSION_ARG="$ELASTIC_STACK_VERSION"
37+
2238
echo "Fetching versions from $VERSION_URL"
23-
VERSIONS=$(curl $VERSION_URL)
39+
VERSIONS=$(curl -s $VERSION_URL)
2440

2541
if [[ "$SNAPSHOT" = "true" ]]; then
2642
ELASTIC_STACK_RETRIEVED_VERSION=$(echo $VERSIONS | jq '.snapshots."'"$ELASTIC_STACK_VERSION"'"')
@@ -35,6 +51,9 @@ if [[ "$ELASTIC_STACK_RETRIEVED_VERSION" != "null" ]]; then
3551
ELASTIC_STACK_RETRIEVED_VERSION="${ELASTIC_STACK_RETRIEVED_VERSION#\"}"
3652
echo "Translated $ELASTIC_STACK_VERSION to ${ELASTIC_STACK_RETRIEVED_VERSION}"
3753
export ELASTIC_STACK_VERSION=$ELASTIC_STACK_RETRIEVED_VERSION
54+
elif [[ "$ELASTIC_STACK_VERSION" == "8.next" ]]; then
55+
# we know "8.next" only exists between FF and GA of a minor
56+
exit 0
3857
fi
3958

4059
case "${DISTRIBUTION}" in

0 commit comments

Comments
 (0)