Skip to content

Commit eaa00a6

Browse files
committed
Rake tasks: Streamlines es namespace
1 parent 2f7b405 commit eaa00a6

File tree

2 files changed

+15
-17
lines changed

2 files changed

+15
-17
lines changed

rake_tasks/docker_tasks.rake

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,39 @@
1616
# KIND, either express or implied. See the License for the
1717
# specific language governing permissions and limitations
1818
# under the License.
19-
require 'mkmf'
2019

21-
namespace :docker do
20+
require 'mkmf' # For find_executable
21+
22+
namespace :es do
2223
desc <<~DOC
2324
Start Elasticsearch in a Docker container.
2425
2526
Default:
26-
rake docker:start[version]
27+
rake es:start[version]
2728
E.g.:
28-
rake docker:start[7.x-SNAPSHOT]
29+
rake es:start[9.x-SNAPSHOT]
2930
3031
To start the container with Platinum, pass it in as a parameter:
31-
rake docker:start[7.x-SNAPSHOT,platinum]
32+
rake es:start[9.x-SNAPSHOT,platinum]
3233
DOC
3334
task :start, [:version, :suite] do |_, params|
3435
abort 'Docker not installed' unless find_executable 'docker'
35-
abort 'You need to set a version, e.g. rake docker:start[7.x-SNAPSHOT]' unless params[:version]
36+
abort 'You need to set a version, e.g. rake docker:start[9.x-SNAPSHOT]' unless params[:version]
3637

3738
test_suite = params[:suite] || 'free'
3839
system("STACK_VERSION=#{params[:version]} TEST_SUITE=#{test_suite} ./.buildkite/run-elasticsearch.sh")
3940
end
40-
end
4141

42-
namespace :es do
4342
desc <<~DOC
4443
Start Elasticsearch docker container (shortcut), reads STACK_VERSION from buildkite pipeline
4544
DOC
4645
task :up do
47-
version = File.read('./.buildkite/pipeline.yml').
48-
split("\n").
49-
select { |a| a.include? 'STACK_VERSION' }
50-
.first
51-
.strip
52-
.gsub('STACK_VERSION: ','')
53-
Rake.application.invoke_task("docker:start[#{version}]")
46+
version = File.read('./.buildkite/pipeline.yml')
47+
.split("\n")
48+
.select { |a| a.include? 'STACK_VERSION' }
49+
.first
50+
.strip
51+
.gsub('STACK_VERSION: ', '')
52+
Rake.application.invoke_task("es:start[#{version}, platinum]")
5453
end
5554
end

rake_tasks/elasticsearch_tasks.rake

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ namespace :es do
4444
desc 'Automatically update to latest version'
4545
task :autoupdate_version do
4646
require 'tempfile'
47-
4847
branch = `git branch --show-current`.strip
49-
url = "https://snapshots.elastic.co/latest/#{branch}.json"
48+
url = "https://artifacts-snapshot.elastic.co/elasticsearch/latest/#{branch}.json"
5049
file = Tempfile.new('version')
5150
download_file!(url, file)
5251
version = JSON.parse(file.read)['version']

0 commit comments

Comments
 (0)