Hi, I'm having issue with setting up multiple conditions in bitbucket-pipelines.yml.
When I define only one condition, it works properly, but if I define two conditions, each step is triggered regardless of defined conditions.
Here is simplified example, defining only one condition works as intended:
But if define another condition, then all steps are executed each time:
I haven't found any similar use case or related documentation on this.
Does anyone know if this is even possible, and if yes, how it should be implemented?
Thanks in advance.
Community moderators have prevented the ability to post new answers.
@Patrik S Can you please answer this question, I'm also looking for a solution related to this kind of use case.
In my use case I want to skip/ no skip pipeline if condition becomes true/false. My pipeline is a bit lengthy but I will share some part of it, pipeline is 100% working but it skips the pipeline even if there is a change in the includePaths
image: cypress/browsers:node16.14.2-slim-chrome100-ff99-edge
definitions:
caches:
npm: $HOME/.npm
cypress: $HOME/.cache/Cypress
steps:
- step: &step-chrome
name: Testing in Chrome
caches:
- npm
- node
- cypress
script:
#- npx @bahmutov/print-env BITBUCKET
- npm ci
- npm run start:ci &
- npm run e2e:record:chrome -- --parallel --ci-build-id $BITBUCKET_BUILD_NUMBER
artifacts:
# store any generates images and videos as artifacts
- cypress/screenshots/**
- cypress/videos/**
- step: &step-firefox
name: Testing in Firefox
caches:
- node
- cypress
script:
- npm ci
- npm run start:ci &
- npm run e2e:record:firefox -- --parallel --ci-build-id $BITBUCKET_BUILD_NUMBER
artifacts:
# store any generates images and videos as artifacts
- cypress/screenshots/**
- cypress/videos/**
- step: &step-edge
name: Testing in Edge
caches:
- node
- cypress
script:
- npm ci
- npm run start:ci &
- npm run e2e:record:edge -- --parallel --ci-build-id $BITBUCKET_BUILD_NUMBER
artifacts:
# store any generates images and videos as artifacts
- cypress/screenshots/**
- cypress/videos/**
pipelines:
branches:
default:
...
...
...
develop:
...
...
...
prerelease:
...
...
...
main:
- step:
name: Preparing Dependencies
caches:
- npm
- node
- cypress
script:
- npx @bahmutov/print-env BITBUCKET
- npm ci
- parallel:
################ 12X-Machines-Chrome #######################
# To add additional machine simply copy each step and paste
###########################################################
- step:
name: 1X-Chrome
# Condition to stop pipeline if there are no changes in code
condition:
changesets:
includePaths:
# Any changes in Cypress Directories
- fixtures/**
- integration/**
- plugins/**
- support/**
# - "videos/**"
<<: *step-chrome
deployment: prod
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.