From a5bfedbf5fbec45db2e09fc25ed222028ebb7fce Mon Sep 17 00:00:00 2001 From: Fernando Briano Date: Wed, 24 Nov 2021 14:51:39 +0000 Subject: [PATCH] Adds the option to pass in STACK_VERSION to download artifacts This way we don't need to have a running cluster to check the version and we can request a specific version. --- rake_tasks/elasticsearch_tasks.rake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/rake_tasks/elasticsearch_tasks.rake b/rake_tasks/elasticsearch_tasks.rake index a132ad1b10..59603dbee3 100644 --- a/rake_tasks/elasticsearch_tasks.rake +++ b/rake_tasks/elasticsearch_tasks.rake @@ -50,7 +50,6 @@ namespace :elasticsearch do end end - def package_url(filename, build_hash) begin artifacts = JSON.parse(File.read(filename)) @@ -93,11 +92,13 @@ namespace :elasticsearch do task :download_artifacts do json_filename = CURRENT_PATH.join('tmp/artifacts.json') - # Get version number and build hash of running cluster: - version_number = cluster_info['number'] - build_hash = cluster_info['build_hash'] + unless (version_number = ENV['STACK_VERSION']) + # Get version number and build hash of running cluster: + version_number = cluster_info['number'] + build_hash = cluster_info['build_hash'] + puts "Build hash: #{build_hash}" + end - puts "Build hash: #{build_hash}" # Create ./tmp if it doesn't exist Dir.mkdir(CURRENT_PATH.join('tmp'), 0700) unless File.directory?(CURRENT_PATH.join('tmp'))