You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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?
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.