@@ -20,11 +20,8 @@ require_relative '../elasticsearch/lib/elasticsearch/version'
20
20
21
21
namespace :automation do
22
22
desc 'Build gem releases and snapshots'
23
- task :build_gems do |_ , args |
24
- output_dir = File . expand_path ( __dir__ + '/../build' )
25
- require 'byebug' ; byebug
26
-
27
-
23
+ task :build_gems do
24
+ output_dir = File . expand_path ( "#{ __dir__ } /../build" )
28
25
dir = CURRENT_PATH . join ( output_dir ) . to_s
29
26
FileUtils . mkdir_p ( dir ) unless File . exist? ( dir )
30
27
version = Elasticsearch ::VERSION
@@ -40,7 +37,7 @@ namespace :automation do
40
37
41
38
desc 'Generate API code'
42
39
task :codegen do
43
- version = YAML . load_file ( File . expand_path ( __dir__ + ' /../.buildkite/pipeline.yml' ) ) [ 'steps' ] . first [ 'env' ] [ 'STACK_VERSION' ]
40
+ version = YAML . load_file ( File . expand_path ( " #{ __dir__ } /../.buildkite/pipeline.yml" ) ) [ 'steps' ] . first [ 'env' ] [ 'STACK_VERSION' ]
44
41
45
42
Rake ::Task [ 'elasticsearch:download_artifacts' ] . invoke ( version )
46
43
sh "cd #{ CURRENT_PATH . join ( 'elasticsearch-api/utils' ) } \
@@ -100,16 +97,15 @@ namespace :automation do
100
97
DESC
101
98
task :bumpmatrix , :version do |_ , args |
102
99
abort ( '[!] Required argument [version] missing' ) unless ( version = args [ :version ] )
100
+ gh_actions = Dir . glob ( File . expand_path ( '../.github/workflows/*.yml' , __dir__ ) )
103
101
104
- files = [
105
- '.github/workflows/main.yml' ,
106
- '.github/workflows/otel.yml' ,
107
- '.buildkite/pipeline.yml'
108
- ]
102
+ files = gh_actions + [ '.buildkite/pipeline.yml' ]
109
103
regexp = Regexp . new ( /([0-9]{1,2}\. [0-9]{1,2}\. [0-9]{1,2}?+(-SNAPSHOT)?)/ )
110
104
files . each do |file |
111
105
content = File . read ( file )
112
106
match = content . match ( regexp )
107
+ next if match . nil?
108
+
113
109
old_version = match [ 1 ]
114
110
content . gsub! ( old_version , args [ :version ] )
115
111
puts "[#{ old_version } ] -> [#{ version } ] in #{ file . gsub ( './' , '' ) } "
0 commit comments