Skip to content

Commit 5067eda

Browse files
authored
[CI] Download master snapshot of Elasticsearch and setup on Travis (elastic#844)
1 parent c0866ed commit 5067eda

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

.travis.yml

+3-10
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ language: ruby
1010

1111
services:
1212
- mongodb
13-
- elasticsearch
1413

1514
branches:
1615
only:
@@ -44,25 +43,19 @@ matrix:
4443

4544
env:
4645
global:
47-
- ELASTICSEARCH_VERSION=7.0.0.alpha
46+
- ELASTICSEARCH_VERSION=7.0.0-alpha1
4847
- TEST_CLUSTER_PORT=9250
4948
- QUIET=true
5049

51-
5250
before_install:
53-
#- wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}.deb
54-
#- wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-${ELASTICSEARCH_VERSION}.deb.sha512
55-
#- shasum -a 512 -c elasticsearch-${ELASTICSEARCH_VERSION}.deb.sha512
56-
#- sudo dpkg -i --force-confnew elasticsearch-${ELASTICSEARCH_VERSION}.deb
57-
#- sudo service elasticsearch restart
51+
- ELASTICSEARCH_VERSION=7.0.0-alpha1 TEST_CLUSTER_PORT=9250 source ./travis_before_script.sh
5852
- gem update --system -q
5953
- gem update bundler -q
6054
- gem --version
6155
- bundle version
6256

6357
install:
64-
- bundle install test:setup_elasticsearch_docker
65-
- bundle exec rake test:set
58+
- bundle install
6659
- rake bundle:clean
6760
- rake bundle:install
6861

elasticsearch-model/spec/spec_helper.rb

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
tracer.formatter = lambda { |s, d, p, m| "#{m.gsub(/^.*$/) { |n| ' ' + n }.ansi(:faint)}\n" }
2525
Elasticsearch::Model.client = Elasticsearch::Client.new host: ELASTICSEARCH_URL,
2626
tracer: (ENV['QUIET'] ? nil : tracer)
27+
puts "Elasticsearch Version: #{Elasticsearch::Model.client.info['version']}"
2728

2829
unless ActiveRecord::Base.connected?
2930
ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => ":memory:" )

elasticsearch-persistence/spec/spec_helper.rb

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
config.formatter = 'documentation'
1010
config.color = true
1111

12+
config.before(:suite) { puts "Elasticsearch Version: #{DEFAULT_CLIENT.info['version']}" }
1213
config.after(:suite) do
1314
DEFAULT_CLIENT.indices.delete(index: '_all')
1415
end

elasticsearch-rails/spec/spec_helper.rb

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
tracer.formatter = lambda { |s, d, p, m| "#{m.gsub(/^.*$/) { |n| ' ' + n }.ansi(:faint)}\n" }
2121
Elasticsearch::Model.client = Elasticsearch::Client.new host: ELASTICSEARCH_URL,
2222
tracer: (ENV['QUIET'] ? nil : tracer)
23+
puts "Elasticsearch Version: #{Elasticsearch::Model.client.info['version']}"
2324

2425
unless ActiveRecord::Base.connected?
2526
ActiveRecord::Base.establish_connection( :adapter => 'sqlite3', :database => ":memory:" )

travis_before_script.sh

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
metadata_url="https://artifacts-api.elastic.co/v1/branches/master/builds/latest/projects/elasticsearch/packages/elasticsearch-${ELASTICSEARCH_VERSION}-SNAPSHOT.zip/file"
4+
echo "Getting snapshot location from $metadata_url"
5+
6+
url=$(curl -v $metadata_url 2>&1 | grep -Pio 'location: \K(.*)' | tr -d '\r')
7+
8+
echo "Downloading Elasticsearch from $url"
9+
curl $url -o /tmp/elasticsearch.zip
10+
11+
echo 'Unzipping file'
12+
unzip -q /tmp/elasticsearch.zip
13+
14+
echo "Starting elasticsearch on port ${TEST_CLUSTER_PORT}"
15+
${PWD}/elasticsearch-7.0.0-alpha1-SNAPSHOT/bin/elasticsearch -E http.port=${TEST_CLUSTER_PORT} &> /dev/null &

0 commit comments

Comments
 (0)