Deploy PR Docker image
Signed-off-by: Emile Vauge <emile@vauge.com>
This commit is contained in:
parent
3f08bb4cdf
commit
3c3b179c29
3 changed files with 29 additions and 0 deletions
|
@ -29,3 +29,4 @@ script:
|
||||||
- make image
|
- make image
|
||||||
after_success:
|
after_success:
|
||||||
- make deploy
|
- make deploy
|
||||||
|
- make deploy-pr
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -85,5 +85,8 @@ fmt:
|
||||||
deploy:
|
deploy:
|
||||||
./script/deploy.sh
|
./script/deploy.sh
|
||||||
|
|
||||||
|
deploy-pr:
|
||||||
|
./script/deploy-pr.sh
|
||||||
|
|
||||||
help: ## this help
|
help: ## this help
|
||||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||||
|
|
25
script/deploy-pr.sh
Executable file
25
script/deploy-pr.sh
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if ([ "$TRAVIS_BRANCH" = "master" ] && [ -z "$TRAVIS_TAG" ]) && [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$DOCKER_VERSION" = "1.10.1" ]; then
|
||||||
|
echo "Deploying PR..."
|
||||||
|
else
|
||||||
|
echo "Skipping deploy PR"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
COMMENT=$(git log -1 --pretty=%B)
|
||||||
|
PR=$(echo $COMMENT | grep -oP "Merge pull request #\K(([0-9]*))(?=.*)")
|
||||||
|
|
||||||
|
if [ -z "$PR" ]; then
|
||||||
|
echo "Unable to get PR number: $PR from: $COMMENT"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# create docker image containous/traefik
|
||||||
|
echo "Updating docker containous/traefik image..."
|
||||||
|
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS
|
||||||
|
docker tag containous/traefik containous/traefik:pr-${PR}
|
||||||
|
docker push containous/traefik:pr-${PR}
|
||||||
|
|
||||||
|
echo "Deployed"
|
Loading…
Reference in a new issue