-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
52 lines (47 loc) · 2.27 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
language: generic
services:
- docker
jdk:
- openjdk8
before_install:
- openssl aes-256-cbc -K $encrypted_9112fb2807d4_key -iv $encrypted_9112fb2807d4_iv -in travis_rsa.enc -out /tmp/travis_rsa -d
- eval "$(ssh-agent -s)"
- chmod 600 /tmp/travis_rsa
- ssh-add /tmp/travis_rsa
env:
global:
- version=0.1.0
- date=$(date +%Y%m%d-%H%M%S)
- dockerrepo=klibio/io.klib.docker.osgi.tutorial
- commit=`echo "$TRAVIS_COMMIT"|cut -c1-7`
- dockerversion=${version}.${date}_${commit}
- branding="<a href='https:\/\/github.com\/klibio\/io.klib.docker.osgi.tut\/tree\/$TRAVIS_BRANCH'>klib.io by Kirschners GmbH - branch: $TRAVIS_BRANCH - $dockerversion <\/a>"
- AZ_REPO=$(lsb_release -cs)
cache:
directories:
- "$HOME/.m2"
before_script:
- unset _JAVA_OPTIONS
#install azure cli
- sh install_azure.sh
script:
# add branding to the html page
- sed -i "s/<div><\/div>/<div>${branding}<\/div>/" ./quickstart/rest/src/main/resources/static/index.html
- tail ./quickstart/rest/src/main/resources/static/index.html
# build quickstart applet and docker image
- mvn verify -f ./quickstart/
- docker build -t $dockerrepo:${TRAVIS_BRANCH}-$dockerversion -t $dockerrepo:${TRAVIS_BRANCH}-latest --file ./Dockerfile-alpine.osgi.txt .
- docker build -t $dockerrepo:arm32v7-latest --file ./Dockerfile-arm32v7.txt .
# push docker image
- docker login -u $DCKUSR -p $DCKPW
- docker push $dockerrepo:${TRAVIS_BRANCH}-$dockerversion
- docker push $dockerrepo:${TRAVIS_BRANCH}-latest
# add droplet to known hosts and update container ran on droplet when pushed to master
- ssh-keyscan -t rsa ${IP} >> $HOME/.ssh/known_hosts
#- ssh-keyscan -t rsa ${IP_AZURE} >> $HOME/.ssh/known_hosts
# commented out digitalocean droplet update, as the droplet does not exist anymore
#- if [ "$TRAVIS_BRANCH" = "develop" ]; then echo "sh updatedevelop" | ssh -tt root@${IP}; fi
#- if [ "$TRAVIS_BRANCH" = "master" ]; then echo "sh updatemaster" | ssh -tt root@${IP}; fi
#update container instance hosted via azure
#- az login --service-principal -u ${azure_appID} -p ${azure_password} --tenant ${azure_tenant}
#- az container delete --resource-group klibio --name develop --yes && az container create --resource-group klibio --name develop --image klibio/io.klib.docker.osgi.tutorial:develop-latest --dns-name-label develop --ports 8080