Skip to content

Commit 9056b8e

Browse files
authored
Merge pull request #961 from mohawk2/ci-extract
Extract ElasticSearch Docker container build from CI config into script
2 parents 598733e + d6c1508 commit 9056b8e

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

.travis.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,20 +45,7 @@ before_install:
4545
- git clone git://github.com/travis-perl/helpers ~/travis-perl-helpers
4646
- source ~/travis-perl-helpers/init
4747

48-
- sudo mkdir -p /etc/elasticsearch/scripts/ && sudo mkdir /tmp/es && sudo chmod 777 /tmp/es
49-
50-
- sudo curl -O -L https://github.com/metacpan/metacpan-puppet/raw/master/modules/metacpan_elasticsearch/files/etc/scripts/prefer_shorter_module_names_100.groovy > /tmp/es/prefer_shorter_module_names_100.groovy
51-
52-
- sudo curl -O -L https://github.com/metacpan/metacpan-puppet/raw/master/modules/metacpan_elasticsearch/files/etc/scripts/prefer_shorter_module_names_400.groovy > /tmp/es/prefer_shorter_module_names_400.groovy
53-
54-
- sudo curl -O -L https://github.com/metacpan/metacpan-puppet/raw/master/modules/metacpan_elasticsearch/files/etc/scripts/status_is_latest.groovy > /tmp/es/status_is_latest.groovy
55-
56-
- sudo curl -O -L https://github.com/metacpan/metacpan-puppet/raw/master/modules/metacpan_elasticsearch/files/etc/scripts/score_version_numified.groovy > /tmp/es/score_version_numified.groovy
57-
58-
- sudo curl -O -L https://raw.githubusercontent.com/metacpan/metacpan-docker/master/elasticsearch/metacpan.yml > /tmp/metacpan.yml
59-
60-
- docker pull elasticsearch:2.4-alpine
61-
- docker run -d -p 127.0.0.1:9200:9200 -v /tmp/metacpan.yml:/usr/share/elasticsearch/config/metacpan.yml -v /tmp/es:/usr/share/elasticsearch/config/scripts elasticsearch:2.4-alpine
48+
- bin/docker-elasticsearch /tmp/metacpan.yml /tmp/es 127.0.0.1:9200
6249

6350
- cpanm -n Carton
6451
- cpanm -n App::cpm
@@ -71,7 +58,7 @@ install:
7158
- AUTHOR_TESTING=0 cpm install -L $PERL_CARTON_PATH --resolver $CPAN_RESOLVER --workers $(test-jobs) || (tail -n 500 -f ~/.perl-cpm/build.log; false)
7259

7360
before_script:
74-
- bin/wait-for-open http://localhost:9200/
61+
- bin/wait-for-open http://$ES_TEST/
7562
- coverage-setup
7663

7764
script:

bin/docker-elasticsearch

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/sh
2+
3+
# bin/docker-elasticsearch /tmp/metacpan.yml /tmp/es 127.0.0.1:9200
4+
5+
ES_CONFIG_FILE="$1"
6+
ES_CONFIG_DIR="$2"
7+
ES_PORT="$3"
8+
9+
sudo mkdir "$ES_CONFIG_DIR" && sudo chmod 777 "$ES_CONFIG_DIR"
10+
11+
sudo curl -L https://github.com/metacpan/metacpan-puppet/raw/master/modules/metacpan_elasticsearch/files/etc/scripts/prefer_shorter_module_names_100.groovy > "$ES_CONFIG_DIR"/prefer_shorter_module_names_100.groovy
12+
13+
sudo curl -L https://github.com/metacpan/metacpan-puppet/raw/master/modules/metacpan_elasticsearch/files/etc/scripts/prefer_shorter_module_names_400.groovy > "$ES_CONFIG_DIR"/prefer_shorter_module_names_400.groovy
14+
15+
sudo curl -L https://github.com/metacpan/metacpan-puppet/raw/master/modules/metacpan_elasticsearch/files/etc/scripts/status_is_latest.groovy > "$ES_CONFIG_DIR"/status_is_latest.groovy
16+
17+
sudo curl -L https://github.com/metacpan/metacpan-puppet/raw/master/modules/metacpan_elasticsearch/files/etc/scripts/score_version_numified.groovy > "$ES_CONFIG_DIR"/score_version_numified.groovy
18+
19+
sudo curl -L https://raw.githubusercontent.com/metacpan/metacpan-docker/master/elasticsearch/metacpan.yml > "$ES_CONFIG_FILE"
20+
21+
docker pull elasticsearch:2.4-alpine
22+
docker run -d -p "$ES_PORT":9200 -v "$ES_CONFIG_FILE":/usr/share/elasticsearch/config/metacpan.yml -v "$ES_CONFIG_DIR":/usr/share/elasticsearch/config/scripts elasticsearch:2.4-alpine

t/00_setup.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ BEGIN {
3030

3131
# Ensure we're starting fresh
3232
my $tmp_dir = tmp_dir();
33-
$tmp_dir->remove_tree;
33+
$tmp_dir->remove_tree( { safe => 0 } );
3434
$tmp_dir->mkpath;
3535

3636
ok( $tmp_dir->stat, "$tmp_dir exists for testing" );

0 commit comments

Comments
 (0)