Skip to content

Commit 17bd697

Browse files
committed
[CI] Test Runner: Download latest test artifact when specific build is not available
1 parent 2c7169e commit 17bd697

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

rake_tasks/test_tasks.rake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,15 @@ namespace :test do
135135
exit 1
136136
end
137137

138-
build_hash_artifact = artifacts['version']['builds'].select do |a|
139-
a.dig('projects', 'elasticsearch', 'commit_hash') == build_hash
138+
build_hash_artifact = artifacts['version']['builds'].select do |build|
139+
build.dig('projects', 'elasticsearch', 'commit_hash') == build_hash
140140
end.first
141+
142+
unless build_hash_artifact
143+
STDERR.puts "[!] Could not find artifact with build hash #{build_hash}, using latest instead"
144+
build_hash_artifact = artifacts['version']['builds'].first
145+
end
146+
141147
# Dig into the elasticsearch packages, search for the rest-resources-zip package and return the URL:
142148
build_hash_artifact.dig('projects', 'elasticsearch', 'packages').select { |k,v| k =~ /rest-resources-zip/ }.map { | _, v| v['url'] }.first
143149
end

0 commit comments

Comments
 (0)