How to make the runner continue with the next srep, if one step inside parallel step fails?
Asked by Sena Turku Cakmak:

Hello,

I have a pipeline and every step has a backup step that runs with another runner. If one step in parallel steps fails, I want the other step to still be able to continue without interruption and without the whole pipelie failing itself. For example:

![Bild (2).png](https://community.atlassian.com/t5/image/serverpage/image-id/341784i201A55FF8C6BAD04/image-size/large?v=v2&px=999 "Bild (2).png")

In this image there are 2 runners for parallel steps, Main and Backup. If backup runner fails as seen in "Check commit message \[Backup\]" step, I want the main runner to continue with the "TPT test" step since main runner completed "Check commit message" step successfully.

So basically even if one of the parallel steps fail, if the other was successfull, I want the other step to still continue with the next step rather then stopping after parallel step is done. Is this possible, or is there a workaround?

Thanks for your time,

Sena


Answers:
author: Mark C
body: Hi [@Sena Turku Cakmak](/t5/user/viewprofilepage/user-id/5436154)

Thank you for reaching out to the community.

Could you share your Pipelines YAML file but masking any sensitive information?

Regards,  
Mark C

comments: author: Sena Turku Cakmak
body: ```
image: atlassian/default-image:4


definitions:
  steps:
    - step: &updateDevVersion_run
        name: 'Update development version'
        clone:
            depth: full
        script:
          - echo "Made a change in build ${BITBUCKET_BUILD_NUMBER}"

    - step: &commitCheck_run
        clone:
          enabled : true
        script:
          - echo "checking commits with custom runner"

    - step: &TPT_run
        clone:
          enabled : false
        script:
          - echo "running TPT test in custom runner";   

pipelines:
  branches:
    feature/*:
        - step: *updateDevVersion_run
        - parallel:
            - step:
                #fail-fast: false
                name: 'Check commit message'
                runs-on: 
                    - self.hosted
                    - windows
                    - customrunner1
                <<: *commitCheck_run   
            - step:              
                # fail-fast: false  
                name: 'Check commit message [Backup]'
                runs-on: 
                    - self.hosted
                    - windows
                    - customrunner2
                <<: *commitCheck_run

        - parallel:
            - step:
                #fail-fast: false
                name: 'TPT test'
                runs-on: 
                    - self.hosted
                    - windows
                    - customrunner1
                <<: *TPT_run
            - step:
                # fail-fast: false
                name: 'TPT test [Backup]'
                runs-on: 
                    - self.hosted
                    - windows
                    - customrunner2
                <<: *TPT_run          

```

Here it is, hope this helps to solve the problem!


author: Sena Turku Cakmak
body: is there any update?


author: Mark C
body: Hi [@Sena Turku Cakmak](/t5/user/viewprofilepage/user-id/5436154)  

Thanks for providing your YAML configuration.  
I've tested the same on my end, unfortunately, there's no other way to resume builds when one of the parallel steps fails.

Right now, you can either merge those steps into one parallel step or explore the possibility of using **[after-scripts](https://bitbucket.org/blog/after-scripts-now-available-for-bitbucket-pipelines)** configuration which will allow you to run a step regardless if a step is successful or not.

Regards,  
Mark C


author: Sena Turku Cakmak
body: Hey Mark,
> Right now, you can either merge those steps into one parallel step or explore the possibility of using **[after-scripts](https://bitbucket.org/blog/after-scripts-now-available-for-bitbucket-pipelines)** configuration which will allow you to run a step regardless if a step is successful or not.

Can you elaborate on how this would look like in my yml file? Thank you for the support.

Best regards,

Sena


author: Mark C
body: Hi [@Sena Turku Cakmak](/t5/user/viewprofilepage/user-id/5436154)

You can essentially use one "parallel" step to run all those 4 steps that you have.

Regarding **after-script**, you can try this by completely removing the "parallel" configuration and adding after-script to each of your steps and potentially repeat the failed test in the after-script.

Having said that, I'd highly recommend using one "parallel" step instead, this way, you won't have to change a lot from your YAML configuration.

Here's the sample YAML configuration:

```
    feature/*:        - step: *updateDevVersion_run        - parallel:            - step:                #fail-fast: false                name: 'Check commit message'                runs-on:                     - self.hosted                    - windows                    - customrunner1                <<: *commitCheck_run               - step:                              # fail-fast: false                  name: 'Check commit message [Backup]'                runs-on:                     - self.hosted                    - windows                    - customrunner2                <<: *commitCheck_run            - step:                #fail-fast: false                name: 'TPT test'                runs-on:                     - self.hosted                    - windows                    - customrunner1                <<: *TPT_run            - step:                # fail-fast: false                name: 'TPT test [Backup]'                runs-on:                     - self.hosted                    - windows                    - customrunner2                <<: *TPT_run         
```

Regards,  
Mark C


author: Sena Turku Cakmak
body: ```
image: atlassian/default-image:4


definitions:
  steps:
    - step: &updateDevVersion_run
        name: 'Update development version'
        clone:
            depth: full
        script:
          - echo "Made a change in build ${BITBUCKET_BUILD_NUMBER}"

    - step: &commitCheck_run
        clone:
          enabled : true
        script:
          - echo "checking commits with custom runner"

    - step: &TPT_run
        clone:
          enabled : false
        script:
          - echo "running TPT test in custom runner";   

pipelines:
  branches:
    feature/*:
        - step: *updateDevVersion_run
        - parallel:
            - step:
                #fail-fast: false
                name: 'Check commit message'
                runs-on: 
                    - self.hosted
                    - windows
                    - customrunner1
                <<: *commitCheck_run   
            - step:              
                # fail-fast: false  
                name: 'Check commit message [Backup]'
                runs-on: 
                    - self.hosted
                    - windows
                    - customrunner2
                <<: *commitCheck_run

        - parallel:
            - step:
                #fail-fast: false
                name: 'TPT test'
                runs-on: 
                    - self.hosted
                    - windows
                    - customrunner1
                <<: *TPT_run
            - step:
                # fail-fast: false
                name: 'TPT test [Backup]'
                runs-on: 
                    - self.hosted
                    - windows
                    - customrunner2
                <<: *TPT_run          

```

Here it is, hope this helps to solve the problem!


Tags: bitbucket-cloud

cloud