Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions .ci/docker-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,22 @@ fi
# The ELASTIC_STACK_VERSION may be an alias, save the original before translating it
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(flaky memory) Isn't this docker-setup.sh same with .ci one? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its slightly different. The pattern is that we download only the files in the upstream .ci repository that do not exist in the child plugin repo. So in this case, given we have a slightly different docker-setup.sh we use the one in this repo, not the upstream.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker for this task but when I took a look at the difference between es-output .ci/docker-setup.sh and central .ci/docker-setup.sh, the only difference (assuming we land this PR) I found is if [ "$INTEGRATION" == "true" ]; then.. (below) at the end.

if [ "$INTEGRATION" == "true" ]; then
      pull_docker_snapshot "elasticsearch" $ELASTIC_STACK_VERSION_ALIAS
    fi

I was curious if we move this logic to the central .ci, that would allow us removing this repo .ci/docker-setup.sh as well. Just want DRY if possible. We can follow up later with cleaning processes if it makes to you too.

ELASTIC_STACK_VERSION_ALIAS="$ELASTIC_STACK_VERSION"

echo "Fetching versions from $VERSION_URL"
VERSIONS=$(curl -s $VERSION_URL)

echo "Computing latest stream version"
VERSION_CONFIG_FILE="$(dirname "$0")/logstash-versions.yml"
if [[ "$SNAPSHOT" = "true" ]]; then
ELASTIC_STACK_RETRIEVED_VERSION=$(echo $VERSIONS | jq '.snapshots."'"$ELASTIC_STACK_VERSION"'"')
echo $ELASTIC_STACK_RETRIEVED_VERSION
ELASTIC_STACK_RETRIEVED_VERSION=$(ruby -r yaml -e "puts YAML.load_file('$VERSION_CONFIG_FILE')['snapshots']['$ELASTIC_STACK_VERSION']")
else
ELASTIC_STACK_RETRIEVED_VERSION=$(echo $VERSIONS | jq '.releases."'"$ELASTIC_STACK_VERSION"'"')
ELASTIC_STACK_RETRIEVED_VERSION=$(ruby -r yaml -e "puts YAML.load_file('$VERSION_CONFIG_FILE')['releases']['$ELASTIC_STACK_VERSION']")
fi

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

case "${DISTRIBUTION}" in
Expand Down