Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

If one of the Stage fails plan should not fail.

Suprabhat Sinha March 20, 2025

Hi, I have tried below code

version: 2

plan:
  project-key: MYPROJECT
  key: MYPLAN
  name: My Plan

stages:
  - Stage 1:
      jobs:
        - job1

  - Stage 2:
      final: true
      jobs:
        - job2

jobs:
  - job1:
      key: JOB1
      tasks:
        - script:
            - echo "Running Job 1"
            - exit 1  # Simulate failure

  - job2:
      key: JOB2
      tasks:
        - script:
            - echo "Running Job 2"
            - if [ "$bamboo_buildFailed" = "true" ]; then
                echo "Job 1 failed, but continuing with Job 2";
              else
                echo "Job 1 succeeded, continuing with Job 2";
              fi

Expectation:-

Plan should be marked as successful. 
AIM:-

Overall plan should not be marked as failed even if Stage 1 fails, and Stage 2 will always run.

2 answers

1 accepted

1 vote
Answer accepted
Shashank Kumar
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 20, 2025

Hey Suprabhat 

Welcome to Atlassian community.

Final stage just Runs regardless of the outcome of the previous stages, even if it is failed or passed, but the overall build will show as failed.

The corresponding Job under the Final stage will show as passed.image.png

 

Regards,

Shashank Kumar

**please don't forget to Accept the answer if your query was answered**

Suprabhat Sinha March 20, 2025

Thanks for your reply. So it seems build cannot be marked as passed, it will still remain in failed status. 

Like • Steffen Opel _Utoolity_ likes this
Shashank Kumar
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 24, 2025

Yes you are right!

Like • Steffen Opel _Utoolity_ likes this
0 votes
Suprabhat Sinha March 20, 2025

hi @Shashank Kumar mate, got any wise words for me on the above questions?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events