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

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


1 badge earned


Participate in fun challenges

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


Gift kudos to your peers

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


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!


can we run pipes in a bash script ?

Irfan Nazer
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Oct 18, 2023

I have multiple steps that should be run on different conditions, and every step should run on the same deployment, so instead of using the inbuild condition which the bitbucket pipeline provided I've started checking within the scripts


- step: &DeployUI
        oidc: true
        size: 2x
        name: Deploy UI
          - node
          - |
            if git diff-tree --no-commit-id --name-only -r HEAD | grep -q "src" || git diff-tree --no-commit-id --name-only -r HEAD | grep -q "public"; then
            npm install
            CI=false npm run build
            pipe: atlassian/aws-s3-deploy:1.2.0
                  AWS_DEFAULT_REGION: $REGION
                  AWS_OIDC_ROLE_ARN: "arn:aws:iam::$ACC_ID:role/Admin"
                  S3_BUCKET: $content_bucket
                  LOCAL_PATH: "build"
            pipe: atlassian/aws-cloudfront-invalidate:0.7.0
                  AWS_DEFAULT_REGION: $REGION
                  AWS_OIDC_ROLE_ARN: "arn:aws:iam::$ACC_ID:role/Admin"
                  DISTRIBUTION_ID: $cloudfront_dist_id
but its not identifying this pipe what should I do

1 answer

2 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Oct 19, 2023 • edited

Hello @Irfan Nazer and welcome to the Community!

Since pipes are a Bitbucket cloud's feature, their definition must be placed within the step's script YML attributes for it to be correctly identified by pipelines.

One route you could take for putting the conditions in the step while still being able to execute the pipe is to force the exit of the step if the condition is/is not met, as in the following example : 

  - if [[ ! $CONDITION ]]; then exit 0 ; fi #if $CONDITION is not met, exit the step and goes to next step
- npm install
- pipe: atlassian/email-notify:0.11.0 variables: USERNAME: '' PASSWORD: $PASSWORD FROM: '' TO: '' HOST: '' PORT: 587 SUBJECT: 'Bitbucket Pipe Notification for your-bitbucket-brunch' DEBUG: true

In the above example, if the boolean condition $CONDITION is not met, we will force the completion of the step with exit 0 (so the step will be completed with Success status), which will make the pipelines go to the next step in the build, if any, or complete the pipeline if there are no remaining steps.

On the other hand, if the boolean condition $CONDITION is true, it will continue the execution of the next commands in the step's script, which includes the npm install and the pipe execution.

Hope that helps! Let me know in case you have any questions.

Thank you, @Irfan Nazer !

Patrik S

Suggest an answer

Log in or Sign up to answer
Site Admin
AUG Leaders

Atlassian Community Events