A question of redundancy re Git branch updates and CI/CD flows

Viewed 28

We are using gihub to manage our CI/CD pipeline and I noticed that on a PR, every update I run to align the PR with target branch, I trigger the whole unit testing flow, since the head of the branch has changed, I want to explore if this is not a redundant action that can be excluded, if at all.

The testing flow triggers on every push into a published branch, which means that anything that was merged has passed all the tests. This essentially means that any update I run on my branch would include all those PRs that passed the full test flow, so my question is, why would I need to run a full test flow on every update to my branch?

Think about the situation where you have a large team and right before release everyone is putting their PRs in, moreover, after every PR gets merged, my PR would need a new update, which means another test run, github doesn't have "merge after tests complete successfully", so that means that I'm in a race to merge quickly before the next PR merges in, and if I don't > update > test run, would be happy to get your feedback on this.

Thx, Bud

1 Answers

That's totally expected: If you have a project with 5 PRs that have passed all tests and one of them gets merged, the other ones need to be re-tested and maybe updated to resolve conflicts, as the merged changes might have caused something in the remaining PRs to break (the code in your PR might be using a function that was updated by the PR that just got merged).

GitHub auto-merge might help managing the PR-merge flow with the team, so that most of the time another PR gets merged before yours you'll only have to click the Update branch button (assuming there are no conflicts) and then, once all checks have passed, it will be automatically merged.

However, I would say if that happens too often, you should try to create smaller PRs and merge them more often, to reduce the chances of having merge conflicts and a long queue of PRs on release day.

Related