-
Notifications
You must be signed in to change notification settings - Fork 0
/
.travis.yml
62 lines (53 loc) · 1.79 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
sudo: required
language: java
branches:
only:
- master
- /^v[0-9]+/
env:
global:
- "COMMIT=${TRAVIS_COMMIT::8}"
- "REPO=ezh1k/dcc"
- "TAG=$(if [ \"$TRAVIS_BRANCH\" == \"master\" ]; then echo \"latest\"; else echo $TRAVIS_BRANCH ; fi)"
- "GIT_TAG=$(git describe --tags --exact-match --abbrev=0)"
- "DOCKER_VERSION=1.12.3"
- "DOCKER_COMPOSE_VERSION=1.8.1"
services:
- docker
before-install:
- |
set -e
sudo rm /usr/local/bin/docker-compose
curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose
chmod +x docker-compose
sudo mv docker-compose /usr/local/bin
before_script:
- |
# Prepare environment
set -e
echo $DOCKERHUB | base64 -d > .dockerhub.enc
openssl aes-256-cbc -K $encrypted_6e63a007385e_key -iv $encrypted_6e63a007385e_iv -in .dockerhub.enc -out .dockerhub -d
sh .dockerhub
# check docker versions
docker version
docker-compose version
script:
- echo -e "\e[0;33mBuild docker image REPO:$REPO COMMIT:$COMMIT TAG:$TAG GIT_TAG:$GIT_TAG BUILD_NUMBER:$TRAVIS_BUILD_NUMBER\e[m" && echo -en 'travis_fold:start:build\\r'
- |
set -e
docker images
docker-compose -f docker-compose.yml -f docker-compose.travis.yml up -d
sleep 5
docker-compose exec dcc /bin/bash -c 'ps aux | awk "/ \/dcc\/bin\/dccifd/ {print \"TEST PASSED\"}"' | grep PASSED
docker-compose down
docker tag dcc:latest $REPO
test -n "$GIT_TAG" && docker tag $REPO $REPO:$GIT_TAG || echo Skip publishing untagged docker image...
- echo -en 'travis_fold:end:build\\r'
after_success:
- |
# Publish image
set -e
docker images
# publish if tag contains vNNN
echo $GIT_TAG | grep -qe '^v[0-9]' && docker push $REPO
echo Success