We create a new release branch from master every new main release of our project. And we have pipelines applied to this new branch `release/*` so that all the new PRs to this new branch gets executed with this pipeline.
But the problem is that every time I create a new release branch from master the pipeline is executed, wasting usage from my allocated pipelines time.
Is there a way to avoid that? Or probably know if this new branch was created from master and no new commits so that I can skip all the following commands?
Hi Leandro,
Try using the following git command. It shows the commits that are on the current branch but not on master. If it doesn't output anything then you can exit early.
git log master..
eg:
script:
- if [ -z "`git log master..`" ]; then exit 0; fi
Cheers,
Steven
Awesome!
Thank you!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you tag each release, you can also use 'git describe' to check if there exists a tag pointing to the commit thats at the head of the newly created release branch.
If a tag exists, skip running tests and deployments (since its most likely a new release branch thats been pushed).
If no tag exists, then you have new commits on that branch, and you probably want to go ahead and run tests, deploy etc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.