From 2404bad9a9c008d96e5536987062cebf7cc14faa Mon Sep 17 00:00:00 2001 From: kaisecheng <69120390+kaisecheng@users.noreply.github.com> Date: Mon, 8 Jul 2024 22:20:59 +0100 Subject: [PATCH] [CI] fix benchmark to pull snapshot version (#16308) - fixes the CI benchmark script to always runs against the latest snapshot version - uses `/v1/versions/$VERSION/builds/latest` to get the latest build id Fixes: #16307 Co-authored-by: Ry Biesemeyer --- .buildkite/scripts/benchmark/main.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.buildkite/scripts/benchmark/main.sh b/.buildkite/scripts/benchmark/main.sh index b4bbb8b2578..9d218d772d4 100755 --- a/.buildkite/scripts/benchmark/main.sh +++ b/.buildkite/scripts/benchmark/main.sh @@ -106,8 +106,9 @@ pull_images() { if [[ -n "$LS_VERSION" ]]; then docker pull "docker.elastic.co/logstash/logstash:$LS_VERSION" else - LS_VERSION=$( curl --retry-all-errors --retry 5 --retry-delay 1 -s https://artifacts-api.elastic.co/v1/versions | jq -r ".versions[-1]" ) - BUILD_ID=$( curl --retry-all-errors --retry 5 --retry-delay 1 -s https://artifacts-api.elastic.co/v1/branches/master/builds | jq -r ".builds[0]" ) + # select the SNAPSHOT artifact with the highest semantic version number + LS_VERSION=$( curl --retry-all-errors --retry 5 --retry-delay 1 -s https://artifacts-api.elastic.co/v1/versions | jq -r '.versions | map(select(endswith("-SNAPSHOT"))) | max_by(rtrimstr("-SNAPSHOT")|split(".")|map(tonumber))' ) + BUILD_ID=$(curl --retry-all-errors --retry 5 --retry-delay 1 -s "https://artifacts-api.elastic.co/v1/versions/${LS_VERSION}/builds/latest" | jq -re '.build.build_id') ARCH=$(arch) IMAGE_URL="https://snapshots.elastic.co/${BUILD_ID}/downloads/logstash/logstash-$LS_VERSION-docker-image-$ARCH.tar.gz" IMAGE_FILENAME="$LS_VERSION.tar.gz"