forked from datacite/search
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy path.travis.yml
69 lines (61 loc) · 2.39 KB
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
language: java
jdk: oraclejdk8
sudo: required
cache:
directories:
- $HOME/.m2
services:
- mysql
- docker
before_install:
- wget https://github.com/jwilder/dockerize/releases/download/v0.6.0/dockerize-linux-amd64-v0.6.0.tar.gz
- tar -xzvf dockerize-linux-amd64-v0.6.0.tar.gz
- rm dockerize-linux-amd64-v0.6.0.tar.gz
- ./dockerize -template docker/solrconfig.xml.tmpl:src/main/resources/solrconfig.xml
- ./dockerize -template docker/log4j.properties.tmpl:src/main/resources/log4j.properties
before_script:
- mysql -e 'create database datacite;'
script:
- mvn clean test
after_success:
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD";
- REPO=datacite/search;
- AUTO_DEPLOY=false;
- if [ "${TRAVIS_TAG?}" ]; then
docker build -f Dockerfile -t $REPO:$TRAVIS_TAG .;
docker push $REPO:$TRAVIS_TAG;
echo "Pushed to" $REPO:$TRAVIS_TAG;
AUTO_DEPLOY=true;
elif [ "$TRAVIS_BRANCH" == "master" ]; then
docker build -f Dockerfile -t $REPO .;
docker push $REPO;
echo "Pushed to" $REPO;
AUTO_DEPLOY=true;
else
docker build -f Dockerfile -t $REPO:$TRAVIS_BRANCH .;
docker push $REPO:$TRAVIS_BRANCH;
echo "Pushed to" $REPO:$TRAVIS_BRANCH;
exit 0;
fi
- export GIT_SHA=$(git rev-parse --short HEAD);
- if [ "$(curl -Is https://solr.datacite.org/hostname)" == "solr2.datacite.org" ]; then
export GIT_0_TAG=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`);
export GIT_1_TAG=$(git describe --abbrev=0 --tags `git rev-list --tags --max-count=1`);
export SOLR_ACTIVE_ID=0;
else
export GIT_0_TAG=$(git describe --abbrev=0 --tags `git rev-list --tags --max-count=1`);
export GIT_1_TAG=$(git describe --abbrev=0 --tags `git rev-list --tags --skip=1 --max-count=1`);
export SOLR_ACTIVE_ID=1;
fi
- git clone "https://${TRAVIS_SECURE_TOKEN}@github.com/datacite/mastino.git";
- ./dockerize -template docker/_search.auto.tfvars.tmpl:mastino/stage/vpc/_search.auto.tfvars;
- cd mastino;
- git remote;
- git config user.email ${DOCKER_EMAIL};
- git config user.name ${DOCKER_USERNAME};
- git add stage/vpc/_search.auto.tfvars;
- git commit -m "Adding search git variables for latest commit";
- git push "https://${TRAVIS_SECURE_TOKEN}@github.com/datacite/mastino.git" master;
notifications:
slack: datacite:Wt8En0ALoTA6Kjc5EOKNDWxN
email: false