DEV Community

Krishna P
Krishna P

Posted on

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

Top comments (0)