Skip to content

Commit 07681a2

Browse files
committed
[Generator] Updates automation rake task for code generation
1 parent 4084257 commit 07681a2

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

.github/make.sh

+1
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ docker run \
128128
-u "$(id -u)" \
129129
--env "RUBY_VERSION=${RUBY_VERSION}" \
130130
--env "WORKFLOW=${WORKFLOW}" \
131+
--env "CLIENTS_GITHUB_TOKEN=${CLIENTS_GITHUB_TOKEN}" \
131132
--name test-runner \
132133
--volume "${repo}:/usr/src/app" \
133134
--rm \

rake_tasks/automation.rake

+12-5
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,19 @@ namespace :automation do
3838

3939
desc 'Generate API code'
4040
task :codegen do
41-
version = YAML.load_file(File.expand_path("#{__dir__}/../.buildkite/pipeline.yml"))['steps'].first['env']['STACK_VERSION']
41+
path = File.expand_path('../elasticsearch-api/', __dir__)
42+
branch = YAML.load_file(File.expand_path("#{__dir__}/../.buildkite/pipeline.yml"))['steps'].first['env']['ES_YAML_TESTS_BRANCH']
43+
unless File.exist?(File.expand_path('elastic-client-generator-ruby', __dir__))
44+
sh "git clone https://#{ENV['CLIENTS_GITHUB_TOKEN']}@github.com/elastic/elastic-client-generator-ruby.git "
45+
end
4246

43-
Rake::Task['es:download_artifacts'].invoke(version)
44-
sh "cd #{CURRENT_PATH.join('elasticsearch-api/utils')} \
45-
&& BUNDLE_GEMFILE=`pwd`/Gemfile \
46-
&& bundle exec thor code:generate"
47+
sh "export ES_RUBY_CLIENT_PATH=#{path} " \
48+
' && cd elastic-client-generator-ruby/elasticsearch ' \
49+
' && sudo bundle install ' \
50+
" && bundle exec rake update[#{branch}]" \
51+
' && bundle exec rake gen_es' \
52+
' && cd ../../ ' \
53+
' && rm -rf elastic-client-generator-ruby '
4754
end
4855

4956
desc <<-DESC

rake_tasks/elasticsearch_tasks.rake

+2-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ namespace :es do
7373
abort e.message
7474
end
7575

76-
desc 'Download artifacts (tests and REST spec) for currently running cluster'
76+
# Deprecated
77+
desc 'Download Elasticsearch artifacts (tests and REST spec) for currently running cluster'
7778
task :download_artifacts, :version do |_, args|
7879
json_filename = CURRENT_PATH.join('tmp/artifacts.json')
7980

0 commit comments

Comments
 (0)