Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure bitbucket pipeline to ensure that deployment happens only when test is successfull

Acho Arnold
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
September 28, 2018

I have the following pipeline. Please, how do I ensure that the deployment step is done ONLY if the "Build and Test" step passes?


# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image: php:7.2

# Doing a full clone to be able to push back to Heroku.
clone:
depth: full

pipelines:
branches:
master:
- step:
name: Build and Test
caches:
- composer
script:
- apt-get update && apt-get install -y unzip git
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- cp .env.testing .env
- vendor/bin/phpunit
- step:
name: Deploy to Heroku
deployment: staging
script:
- apt-get update && apt-get install -y git
- git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git HEAD

1 answer

1 accepted

1 vote
Answer accepted
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 1, 2018

Hi Acho,

Bitbucket Pipelines runs steps sequentially. So the 'Deploy to Heroku' step will not begin execution until your 'Build and Test' step completes successfully.

If any steps fail to complete successfully (e.g. a test fails), then the entire pipeline will stop executing.

Have you been seeing different behaviour?

Thanks,

Phil

Acho Arnold
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 2, 2018

Thanks @Philip Hodder I didn't know that was the normal behaviour

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events