Skip to content

Commit e7e6f5a

Browse files
committed
Split up docker image creating in one script for branches and one for tags
Apparently Travis does not get the brach info from github when building a tag.
1 parent 67e07b5 commit e7e6f5a

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

.travis.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@ deploy:
2424
password:
2525
secure: NwkpOakaeJjErjTF4Y5MWeHzMvkxYZqrBFdRkzfenVfkWsomuyy553A691d3lc1+oREsh1fJJLjpZQYxTLUFIHOUmt/9zr02rFfguzj7hEYfWF8wHBXG6YSWv6T3aCA4RTMXvvzv9cHf1zfxh0fS7kgc+NRMAnd01diVLfYpBciLgmQ31J4mlwShp8yBQUoRBIvzSdzrgjr0TzCQZXB9xM6R2t/oJgXLo6Zz8dTzqq3De9nOU/1P2ZHLxodDikuFdu2/0CjoDgFXB0KnGKGKmJ6G1WMCVvi7abY7smmGA3s4a4NVL7Cirx6VwIj79PsAcgupr2iBAQk/GsPffzdpLtIrBek9u//p84hxrj/IaJWgPOeKeD7+r2Kc2g0r2dQjaM+9MqBx9/lC57xJRX/JHLQWirXfCucB9YyPun5I13Sf3hArkssQy/Jvd2aLFZ885BTfow6TAwl1ud+UPeauvEj6myKO98sko/3Y521EGXRofLGaPokLyPjI/3I4N4jCvw8m86eZAjjIhPFL7JKHf8OVc5gQCYQy3kxiF5wyvbfOeMBp0sk9UvJOrWvBEXFrimAZPu8o8T5WtlQAV02q7rxUwhMd+fpnbGewsl7Ob6eE4rGVrfWQIb86wOHbbJk3lCwPytjEFEI2bdUfRUFcrWxhC040hRP0gzVKLa+nBHM=
2626
on:
27-
tags: true
2827
repo: SUNET/SATOSA
28+
tags: true
2929
- provider: script
30-
script: scripts/travis_create_docker_image.sh
30+
script: scripts/travis_create_docker_image_branch.sh
3131
on:
3232
repo: SUNET/SATOSA
3333
branch: master
34+
- provider: script
35+
script: scripts/travis_create_docker_image_tag.sh
36+
on:
37+
repo: SUNET/SATOSA
38+
tags: true
3439
env:
3540
global:
3641
- secure: ymdbaVVKJFq193xn+pr7sRyjkcOBtpm6eu+A9QsdtzO6vhaj+MhFfsjWAJbGiaSvX691bLd+9kFqH76HViN1LbmkCujBm2+4k0DBSakb70T/81UNNpYGy4iIYzCKaWPPSwvFGfRjNY14RILEpOI8NCkJuDMuO7CiGkwOtmlOdP/tYdV9T3p36Hgpwa/0U5kIahqwnbBKiwjGGhI8YA4Ik01P4biEv3Fr++jS4dhzMe+hYjWDXW+bksf9OikbtJkPzHlZxCDgFH4yNY1TH6P3X/B8NLTrvpNZOj2GgQoZBDrTEM+RLdaLQ8EYcrJaEaOZs65Jicpw5Ycz8DHUuBXwlSiG1g/VJlzxYchGxnLguVyEELEm7p7vhDFYNOROL3J4PpY8E1+L834xzmhCqbHM2kHB2WeiIob0j1Hq7U1802tFuM+tu8P4gdEyGxstQaIehiTI/VQEJm+sKB1W5xtDQokrnMyiQfJy4K7T4ZrONV/gVhb85ayS6eF/Xu1vr/5s/fWyQOxNKvoeEiO6VVoLTWNPEysTewLFc8o7HcE/Qnv/67IwuK/vx0ZlESbNCRgTfqyWpn5vybyWmgo9aUC51hDiVQtZfVeaoF/Xtg2yxVn/4C1aPybpA2Oacll8LjyYwyoCeH3naD0j9Msy4izny2PF7MTT4iNbtwhRoAAqXic=

scripts/travis_create_docker_image.sh renamed to scripts/travis_create_docker_image_branch.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,4 @@ docker login -u $DOCKER_USER -p $DOCKER_PASS
66
export REPO=satosa/satosa
77
export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi`
88
docker build -f Dockerfile -t $REPO:$TAG .
9-
if [ -n "$TRAVIS_TAG" ]; then
10-
docker tag $REPO:$TAG $REPO:$TRAVIS_TAG
11-
fi
129
docker push $REPO
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
# Travis does not know which branch the repo is on when building a tag
6+
# Make sure to only call this script when building tags
7+
8+
docker login -u $DOCKER_USER -p $DOCKER_PASS
9+
export REPO=satosa/satosa
10+
export TAG=latest
11+
docker build -f Dockerfile -t $REPO:$TAG .
12+
if [ -n "$TRAVIS_TAG" ]; then
13+
docker tag $REPO:$TAG $REPO:$TRAVIS_TAG
14+
fi
15+
docker push $REPO

0 commit comments

Comments
 (0)