From c99400e6c093efb188132d3507a3b48451ecc939 Mon Sep 17 00:00:00 2001 From: Alban Crequy Date: Sat, 27 Feb 2016 22:30:41 +0100 Subject: [PATCH] circle.yml: deploy on a personal hub account I would to do some changes in Scope and test my changes in Kubernetes, following the guide on: https://github.com/weaveworks/scope#using-weave-scope-with-kubernetes For that, I need a Docker image of Scope hosted on a Docker hub and reference that Docker image in my Kubernetes resource yaml file. Instead of building Scope on my laptop and pushing it manually on my Docker Hub account, I am using my CircleCI account to do this automatically. This patch fixes the deployment target in circle.yml. It uses the environment variable $DOCKER_USER from the CircleCI settings to guard against unintended deployment. As before, only the "master" branch will trigger the deployment. This change should not impact the build of the official Scope Docker image. --- circle.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/circle.yml b/circle.yml index 334d1b134..0ca8d92dc 100644 --- a/circle.yml +++ b/circle.yml @@ -62,7 +62,10 @@ test: deployment: hub: branch: master - owner: weaveworks commands: - - docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS - - docker push weaveworks/scope + - > + test -z "${DOCKER_USER}" || ( + docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS && + (test "${DOCKER_USER}" == "weaveworks" || docker tag weaveworks/scope:latest $DOCKER_USER/scope:latest) && + docker push $DOCKER_USER/scope + )