Skip to content

Commit 1e3561e

Browse files
committed
[CI] Updates artifact task for when there's no match in build hashes
1 parent 4976ef0 commit 1e3561e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

rake_tasks/elasticsearch_tasks.rake

+4-4
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,12 @@ namespace :elasticsearch do
8383
exit 1
8484
end
8585

86-
# Get the build hash if it hasn't been set from a running cluster
87-
@build_hash ||= artifacts['version']['builds'].first.dig('projects', 'elasticsearch', 'commit_hash')
88-
86+
# Either find the artifacts for the exact same build hash from the current running cluster or
87+
# use the first one from the list of builds:
8988
build_hash_artifact = artifacts['version']['builds'].find do |build|
9089
build.dig('projects', 'elasticsearch', 'commit_hash') == @build_hash
91-
end
90+
end || artifacts['version']['builds'].first if build_hash_artifact.nil?
91+
9292
zip_url = build_hash_artifact.dig('projects', 'elasticsearch', 'packages').select { |k, _| k =~ /rest-resources-zip/ }.map { |_, v| v['url'] }.first
9393

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

0 commit comments

Comments
 (0)