I have a build pipeline set up in Azure devops that runs every time a PR goes into the main branch.
The steps are as follows:
checkout main
install dependencies
npm version to increment
Build
Publish to npm feed
Deploy to a test/staging environment
Push the change to the version number back to git.
Since the build runs every time a PR is completed, occasionally there are parallel builds. Depending on which one finishes first, the push will fail because it is "dirty".
I'm having issues finding a way to bypass it.
Possible methods:
- Just suppress the fail when the git push command fails (not ideal).
- Force the git push (not ideal).
- If a build is queued while one is running, wait until it is complete before starting the new build
- Cancel the older build and batch?
- Restructure the build process in some way.
Am I missing any?