CasaDelGato
CasaDelGato

Reputation: 1283

How to allow multiple Jenkins builds to Tag a Mercurial repository?

We have a Mercurial Repository, and often have multiple active branches. (prev release bug fix, curr release, future, etc...) We have a Jenkins workspace for each release - triggered by Hg commits. The problem is that we have Jenkins adding a Hg tag to indicate where the build happened. If we allow multiple builders on Jenkins, they sometimes run nearly simultaneously - so they both do a sync, tag, push. This means that one is guaranteed to fail at that point - because the tag push will fail.

Is there any way to allow multiple jenkins builds to run - but specify a short Critical Section that can't run simultaneously?

Added: I did find the "Exclusion-Plugin" for Jenkins, but you can't start the Critical Section before the repository is synced - as that happens before the first build step.

Upvotes: 0

Views: 768

Answers (1)

CasaDelGato
CasaDelGato

Reputation: 1283

Ok, figured it out. Using the Exclusion Plugin for Jenkins, I modified our hg tagging build step to be like this:

# Tag the Build point in Source Control
hg pull --rev .
hg tag Build_${BUILD_NUMBER} -m 'Jenkins Added Tag for Build_'${BUILD_NUMBER}
hg push

Then wrapped that with Critical Block Start/Stop.

Upvotes: 1

Related Questions