Skip to content

Commit

Permalink
[CI] Updates artifact task for when there's no match in build hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
picandocodigo committed Nov 9, 2023
1 parent 4976ef0 commit 1e3561e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions rake_tasks/elasticsearch_tasks.rake
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ namespace :elasticsearch do
exit 1
end

# Get the build hash if it hasn't been set from a running cluster
@build_hash ||= artifacts['version']['builds'].first.dig('projects', 'elasticsearch', 'commit_hash')

# Either find the artifacts for the exact same build hash from the current running cluster or
# use the first one from the list of builds:
build_hash_artifact = artifacts['version']['builds'].find do |build|
build.dig('projects', 'elasticsearch', 'commit_hash') == @build_hash
end
end || artifacts['version']['builds'].first if build_hash_artifact.nil?

zip_url = build_hash_artifact.dig('projects', 'elasticsearch', 'packages').select { |k, _| k =~ /rest-resources-zip/ }.map { |_, v| v['url'] }.first

# Dig into the elasticsearch packages, search for the rest-resources-zip package and return the URL:
Expand Down

0 comments on commit 1e3561e

Please sign in to comment.