I'll try explain my situation in as much detail as possible below. I'm not sure if I'm missing something or if there is a bug in the `atlassian/trigger-pipeline:5.3.0` pipe. You are welcome to ask any questions below if anything is unclear.
I have the following parallel steps in my pipeline
custom:
Project 1 pipeline
- step: (whatever pipeline 1 does)
Project 2 pipeline
- step: (whatever pipeline 2 does)
default:
- parallel:
steps:
- step:
name: trigger for project 1
script:
- pipe: atlassian/trigger-pipeline:5.3.0
variables:
BITBUCKET_USERNAME: $BITBUCKET_USER
BITBUCKET_APP_PASSWORD: $BITBUCKET_PASSWORD
REF_TYPE: 'branch'
REF_NAME: $BITBUCKET_BRANCH
CUSTOM_PIPELINE_NAME: "Project 1 pipeline"
ACCOUNT: "myaccount"
WAIT: "true"
DEBUG: "false"
REPOSITORY: "myrepository"
condition:
changesets:
includePaths:
- "apps/project1/**"
- step:
name: trigger for project 2
script:
- pipe: atlassian/trigger-pipeline:5.3.0
variables:
BITBUCKET_USERNAME: $BITBUCKET_USER
BITBUCKET_APP_PASSWORD: $BITBUCKET_PASSWORD
REF_TYPE: 'branch'
REF_NAME: $BITBUCKET_BRANCH
CUSTOM_PIPELINE_NAME: "Project 2 pipeline"
ACCOUNT: "myaccount"
WAIT: "true"
DEBUG: "false"
REPOSITORY: "myrepository"
condition:
changesets:
includePaths:
- "apps/project1/**"
- "apps/project2/**"
I have two projects in my monorepo, Project 1 and Project 2. I want the pipeline to run on every commit and it should trigger the two custom pipelines Ive listed above based on the following conditions.
- Trigger Project 1 custom pipeline if there are any changes to Project 1.
- Trigger Project 2 custom pipeline if there are changes to Project 1 or Project 2
While the pipelines run the merge button should be disabled until all of the pipelines pass, if any of them fail it should fail the overall pipeline.
When I make a commit the custom pipelines get triggered correctly with the conditions above, and the merge button gets enabled when all the triggered pipelines pass.
The problem I'm having is that since Project 2 pipeline has fewer steps and runs quicker than Project 1 pipeline, if its pipeline passes, the main pipeline is marked as passed and the merge button gets enabled (This shouldn't happen). When Project 1 pipeline eventually finishes and the project fails, it then changes the main pipeline result to failed and correctly disables the merge button.
The strange thing is this works correctly the other way round, If Project 2 pipeline fails first, main pipeline is marked is marked as failed and merge button is disabled, even if Project 1 pipeline passes afterwards, main pipeline remains as failed.
Note: The end result of the main pipeline is correct, if one of the pipelines fail the end result after all the triggered pipelines have run will be failed. The only problem is that if the shortest triggered pipeline passes there is a moment when a developer can merge their PR even if the rest of the triggered pipelines are not yet completed.
This seems like a bug to me, but if it isn't can anyone see if there is anything wrong with my implementation