Jenkins: No need to run on Git tag (no workspace)

I have users who need to run jenkins jobs on Github (Enterprise). This way I have access to Webhooks and Git Service hooks. These hooks push even if the tag is the only latch.

Some users automatically mark their builds, if they succeed, this auto tag triggers a new webhook to start and it starts their build again.

We usually avoided this by using the "exclude user" section of Git and setting a list of service accounts in that list that do the tagging.

However, with the advent of our new ephemeral build farm, we no longer tackle workspaces (we rotate nodes as needed in Docker containers). So this approach no longer works (see https://issues.jenkins-ci.org/browse/JENKINS-29282 ).

My temporary job is that I run a shell script as the first step of the build, which now does some git-log, compares and breaks the build if the service account was the only committer.

I'm looking for a way to use a Git hook to trigger a build that doesn't even start the build if it was just a tag event.

This seems like a tricky question, but I feel like this problem should be pretty common. Many people should automatically flag Git after a build completes successfully and avoid rebuilding.

+3


source to share


1 answer


I know this question is getting old, but I recently had a similar issue with a Bitbucket web site for Jenkins that sent push change notifications for tags. I tried setting up the hook to not send them, but it never worked.

After much trial and error, the only thing that worked for me was to establish the "specifier branches (blank for" any ")" Jenkins " the Git plugin for" everything but tag "using a regular expression like this: :^(?!.*(refs\/tags\/)).*

.



I admit that this solution has a major drawback, which is that working with such a configuration cannot create tags ... In my case, the set of jobs that had this configuration shouldn't have to create tags, so that was ok but I would prefer to remove notifications.

Hope it helps.

+3


source







All Articles