Add structure to your pipeline with multiple steps in Bitbucket Pipelines

Bitbucket Pipelines empowers modern teams to build, test and deploy their code directly within Bitbucket. Today, we’re excited to share a huge improvement to how Pipelines can be structured to suit your team’s workflow, with support for multiple steps – the highest voted feature request in Bitbucket Pipelines.

With multiple steps in Pipelines, you can now:

  • Structure and visualize your pipeline in a more logical manner.
  • Test your code against different build environments.
  • Separate your deployment step from other commands in your pipeline.

 

multiple steps in bitbucket pipelines

You can add additional steps to your pipeline by modifying your bitbucket-pipelines.yml file to include another step keyword. Steps are executed in the order that they appear in the bitbucket-pipelines.yml file, and run in separate Docker containers. Each step can be configured to:

  • Use a different Docker image.
  • Use specific caches and services.
  • Produce artifacts that subsequent steps can consume.

Below is an example bitbucket-pipelines.yml file which uses multiple steps.


pipelines:
  default:
    - step:
        name: Build and test
        image: node:8.5.0
        caches:
          - node
        script:
          - npm install
          - npm test
          - npm build
        artifacts:
          - dist/**
    - step:
        name: Integration test
        image: node:8.5.0
        caches:
          - node
        services:
          - postgres
        script:
          - npm run integration-test
    - step:
        name: Deploy to beanstalk
        image: python:3.5.1
        script:
          - python deploy-to-beanstalk.py
 
definitions:
  services:
    postgres:
      image: postgres:9.6.4

For more information on how to set up multiple steps, check out our documentation.

Now that we’ve added support for multiple steps, you might be curious about whether we’ll support running steps in parallel or manually on-demand. Good news! This work is a stepping stone for us to add support for manual steps and parallel steps in the near future.

So stay tuned for more improvements to Bitbucket Pipelines to meet the needs of your team. If you haven’t tried Pipelines, get started today and improve the way your development team works.

Cheers!