Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,551,903
Community Members
 
Community Events
184
Community Groups

Is it possible to run pipelines against a matrix of images?

GitHub Actions allows you to run a pipeline against a matrix of images, e.g. multiple node versions:

 

```

jobs:
  build:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [14.x, 16.x]
        # See supported Node.js release schedule at https://nodejs.org/en/about/releases/

    steps:
    - uses: actions/checkout@v3
    - name: Use Node.js ${{ matrix.node-version }}
      uses: actions/setup-node@v3
      with:
        node-version: ${{ matrix.node-version }}
        cache: 'npm'
    - run: npm ci
    - run: npm run build --if-present
    - run: npm test

```

 

With this pipeline running tests against node.js 14 and node.js 16.  

 

Is there a way to do this with bitbucket pipelines?

1 answer

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Nov 16, 2022

Hi Jared and welcome to the community!

Bitbucket Pipelines runs builds in Docker containers. For every step you define in your bitbucket-pipelines.yml file, a Docker container starts with the Docker image defined in the yml file, the repo is cloned in that container, then the commands of that step's script are executed, and in the end, the container gets destroyed.

One thing you can do is define a separate step for each node version you want to test, and then use for each step a different Docker image that has the version of node you want:

pipelines:
default:
- step:
name: Build and test Node 14
image: node:14
script:
- npm install
- npm test
- step:
name: Build and test Node 16
image: node:16
script:
- npm install
- npm test

A setup like that will use Dockerhub images node:14 and node:16 as a build environment for each step respectively. However, you can use instead any public and private Docker images including those hosted on Docker Hub, AWS, GCP, Azure, and self-hosted registries accessible on the internet. Please see more details here: https://support.atlassian.com/bitbucket-cloud/docs/use-docker-images-as-build-environments/

If the steps have the same commands, you can also use YAML anchors so that you won't have repeated sections, and define again a different Docker image for each step:

definitions: 
steps:
- step: &build-test
name: Build and test
script:
- npm install
- npm test

pipelines:
default:
- step:
<<: *build-test
image: node:14
- step:
<<: *build-test
image: node:16

If you have any questions, please feel free to let me know.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events