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,552,225
Community Members
 
Community Events
184
Community Groups

Is it possible to run pipe conditionally in `after-script`?

Edited

Hi, I want to run pipe `slack-notify` conditionally after a step finished (in after-script statement).

 

Is there any syntax that run the pipe conditionally by checking BITBUCKET_EXIT_CODE (only when FAILED(1)) ?

 

Desired situation using pseudo-YAML:

```yaml

after-script:
  - envsubst < ".pipelines/failed_pipe_payload.json.template" > ".pipelines/slack_payload.json"
  - pipe: atlassian/slack-notify:2.0.0
     variables:
       WEBHOOK_URL: $SLACK_WEBHOOK_URL
       PAYLOAD_FILE: .pipelines/slack_payload.json
     condition:
        variables.BITBUCKET_EXIT_CODE: 1
```

1 answer

1 accepted

0 votes
Answer accepted
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Apr 14, 2023

Hi @지원 전 

Thank you for your question!

You could try the next solution:

script:
- ...
after-script:
- if [[ BITBUCKET_EXIT_CODE -eq 0 ]]; then exit 0; else echo "Step failed"; fi
envsubst < ".pipelines/failed_pipe_payload.json.template" > ".pipelines/slack_payload.json"
- pipe: atlassian/slack-notify:2.0.0
...

 

Best regards,
Oleksandr Kyrdan

It works! Thanks for your support :)

I think it would be good if condition syntax is supported for pipe too!

Like Oleksandr Kyrdan likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events