As we use a mono repo, we have a “root” pipeline using the mono repo plugin that triggers children pipelines based on which parts of the codebase is being touched.
Some children pipelines are configured with “Cancel Intermediate Builds = false” because they run Terraform steps that would leave our infrastructure in undesired states if abruptly interrupted.
The root pipeline is configured with “Cancel Intermediate Builds = true”.
We noticed that when a developer pushes a new commit, all already running pipelines on their branch get canceled, including those where “Cancel Intermediate Builds = false”.
Is that the expected behavior? If yes what’s your recommendation to configure a mono repo pipelines so that some pipelines may cancel intermediate builds and some will not?
Thanks for reaching out!
I will look into this. can you send an email with a related build link to email@example.com
Jumping back in here with some update
Yes, the behavior you described is expected having the “Cancel Intermediate Builds” setting enabled for the root pipeline. When a new commit is pushed to a branch, the mono-repo plugin will trigger a new pipeline for that branch. This new pipeline will cancel any currently running pipelines for that branch, regardless of whether the “Cancel Intermediate Builds” setting is enabled or not.
To configure your pipelines so that some can cancel intermediate builds and some cannot, you can use pipeline-level settings for each pipeline only, instead of using the global setting on the “root” pipeline.
Pipelines that should not cancel intermediate builds, you can set “Cancel Intermediate Builds” to false at the pipeline level. For pipelines that can cancel intermediate builds, you can leave this setting as true. This way, when a new commit is pushed and the mono-repo plugin triggers a new pipeline, only pipelines that have “Cancel Intermediate Builds” set to true will be cancelled.
Thanks for the explanation.
If I understand correctly, if:
- pipeline A triggers B,
- pipeline B triggers C,
- pipeline C triggers D,
then builds on pipeline D will be automatically canceled on a new commit if either A, B, C or D is configured to cancel intermediate builds. Am I correct?
This is a theoretical question to be sure I understand, I don’t have related build link to share for that scenario.
Hi @pbarrau This is Suma jumping in on behalf of Stephanie.
Yes, your understanding is correct. If a parent pipeline build is cancelled (manually canceling the build or cancelled due to “Cancel Intermediate Build”) it will cancel the builds for the child pipeline that got created by the parent pipeline.