DEV Community

Krishna P
Krishna P

Posted on

5

How to include different image for each step in bitbucket pipeline

Bitbucket Pipelines is an integrated CI/CD service built into Bitbucket.It allows you to automatically build, test, and even deploy your code based on a configuration file in your repository.

Usually all your steps runs inside the docker container in the cloud and you need a base image to run your build and other pipeline steps

So this opens up two possible scenarios

  1. Entire bibucket-pipeline.yml file uses single image and you can mention at the beginning of your yml file like below
image: node:10.15.0

pipelines:
  default:
    - step:
        name: Build and test
        script:
          - npm install
          - npm test
    - step:
        name: Deploy
        script:
          - bin/deploy.sh
Enter fullscreen mode Exit fullscreen mode

above configuration works fine as long as it does not have any dependency on other image

  1. If you want to use a python script for releasing and you need a python image to do that in that case you can do the following changes i,e you can add the particular image at the step level as shown below
image: node:10.15.0

pipelines:
  default:
    - step:
        name: Build and test
        script:
          - npm install
          - npm test
    - step:
        name: Deploy
        script:
          - bin/deploy.sh
    - step:
        name: Release
        image: python:3.7.2
        script:
          - bin/release-notes.py
Enter fullscreen mode Exit fullscreen mode

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more