File tree Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Expand file tree Collapse file tree 1 file changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -78,11 +78,7 @@ namespace :es do
78
78
task :download_artifacts , :version do |_ , args |
79
79
json_filename = CURRENT_PATH . join ( 'tmp/artifacts.json' )
80
80
81
- unless ( version_number = args [ :version ] || ENV [ 'STACK_VERSION' ] )
82
- # Get version number and build hash of running cluster:
83
- version_number = cluster_info [ 'number' ]
84
- @build_hash = cluster_info [ 'build_hash' ] if cluster_info [ 'build_hash' ]
85
- end
81
+ version_number = args [ :version ] || ENV [ 'STACK_VERSION' ] || version_from_buildkite || version_from_running_cluster
86
82
87
83
# Create ./tmp if it doesn't exist
88
84
Dir . mkdir ( CURRENT_PATH . join ( 'tmp' ) , 0700 ) unless File . directory? ( CURRENT_PATH . join ( 'tmp' ) )
@@ -123,6 +119,18 @@ namespace :es do
123
119
File . write ( CURRENT_PATH . join ( 'tmp/rest-api-spec/build_hash' ) , @build_hash )
124
120
end
125
121
122
+ def version_from_buildkite
123
+ require 'yaml'
124
+ yaml = YAML . load_file ( File . expand_path ( '../.buildkite/pipeline.yml' , __dir__ ) )
125
+ yaml [ 'steps' ] . first [ 'env' ] [ 'STACK_VERSION' ]
126
+ end
127
+
128
+ def version_from_running_cluster
129
+ info = cluster_info
130
+ @build_hash = info [ 'build_hash' ] if info [ 'build_hash' ]
131
+ info [ 'number' ]
132
+ end
133
+
126
134
desc 'Check Elasticsearch health'
127
135
task :health do
128
136
require 'elasticsearch'
You can’t perform that action at this time.
0 commit comments