From ceb13c5ab6063f6a89fe13a0fcab2efcc20fcb14 Mon Sep 17 00:00:00 2001 From: luke Date: Fri, 4 Aug 2017 22:36:39 -0700 Subject: [PATCH] Only push container on successful build --- bitbucket-pipelines.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index c5462736..a3710212 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -18,7 +18,16 @@ pipelines: # build the Docker image (this will use the Dockerfile in the root of the repo) - docker build -t $IMAGE_NAME . - # authenticate with the Docker Hub registry - - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD - # push the new Docker image to the Docker registry - - docker push $IMAGE_NAME \ No newline at end of file + branches: + master: + - step: + script: + # authenticate with the Docker Hub registry + - docker login --username $DOCKER_HUB_USERNAME --password $DOCKER_HUB_PASSWORD + # push the new Docker image to the Docker registry + - docker push $IMAGE_NAME + feature/*: + - step: + image: yourdockerusername/imagename # This step uses its own image + script: + - echo "This script runs only on commit to branches with names that match the feature/* pattern."