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,466,652
Community Members
 
Community Events
176
Community Groups

Multiple conditions in bitbucket-pipelines.yml

Edited

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:

Screenshot from 2021-06-09 13-00-05.png


But if define another condition, then all steps are executed each time:

Screenshot from 2021-06-09 13-01-11.png

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.

1 answer

@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

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events