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!


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
Community Members
Community Events
Community Groups

pipes inside a miltiline script in Bitbucket Pipeline


I was trying to run a pipe based on a specific condition in the script. The condition is multiline scripts.
I want to implement something like the below but I am getting errors. Please guide.

- >- if [ "$Var" = True ]; then
            - pipe: atlassian/aws-code-deploy:1.1.1
- >- if [ "$Var" = False ]; then
            - pipe: atlassian/aws-code-deploy:1.1.1


2 answers

1 accepted

3 votes
Answer accepted
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Sep 08, 2022

Hello @Agastya Bisht ,

Welcome to Atlassian Community!

I'm afraid it's currently not possible to condition the execution of pipes in Bitbucket Pipelines, as bash does not recognize the "pipe" as a valid command. We have a feature request to implement that functionality, which you can check in the following link : 

I would suggest you to add your vote there, since this helps both developers and product managers to understand the interest. Also, make sure you add yourself as a watcher in case you want to receive first-hand updates from that ticket. Please note that all features are implemented with this policy in mind.

While this feature is not implemented, one workaround I can think of is separating the conditions into multiple steps, and finishing the step early with an exit 0 in case the condition is not met. Please refer to the example below : 

image: atlassian/default-image:3
    - step: 
       name: "Execute when the variable is true"
         - if [ "$VAR" != true ]; then exit 0 ; fi # Finish the step if the $VAR value is not true
         - pipe: atlassian/aws-code-deploy:1.1.1
variables: <A>

    - step: 
       name: "Execute when the variable is false"
         - if [ "$VAR" != false ]; then exit 0 ; fi # Finish the step if the $VAR value is not false
         - pipe: atlassian/aws-code-deploy:1.1.1
variables: <B>

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

Thank you, @Agastya Bisht .

Kind regards,

Patrik S

Thank you, Patrik
Your provided solution worked for me.

Suggest an answer

Log in or Sign up to answer
AUG Leaders

Atlassian Community Events