Skip to content

Commit

Permalink
[CI] fix benchmark to pull snapshot version (#16308)
Browse files Browse the repository at this point in the history
- 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 <[email protected]>
  • Loading branch information
kaisecheng and yaauie authored Jul 8, 2024
1 parent ea0c168 commit 2404bad
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .buildkite/scripts/benchmark/main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 2404bad

Please sign in to comment.