Jenkins: Don't want to trigger on Git Tag (No Workspace)

I have users who need to trigger jenkins jobs on Github (Enterprise) pushes. So all I have access to are Webhooks, and the Git Service hooks. These hooks push even if the only commit was a tag.

Some users auto-tag their builds if they succeed, this auto-tag causes a new webhook to fire and it triggers their build again.

  • Docker compose environment variables specified with env_file parameter not working inside the dockerfile
  • Exposing ports in Docker won't work
  • docker container in AWS VPC, good idea or not? [closed]
  • Assetss from wwwroot cannot be found on Docker Image
  • Intellij, Spring dev tools remote, Docker, error Unexpected 404 response uploading class files
  • Docker container IP address
  • Typically we were avoiding this by using the git plugins “exclude user” section and setting a list of service accounts on that list that do the tagging.

    However with the advent of our new ephemeral build farm, we don’t maintain workspaces anymore (we spin nodes up as Docker containers on demand). So this approach no longer works (see: https://issues.jenkins-ci.org/browse/JENKINS-29282).

    My temporary work around is that I run a shell script as the first build step which now does some git-log compares and aborts 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 does not even start the build if it was just a tag event.

    This would appear to be an a difficult ask, but I feel like this problem has to be pretty common. Many people must auto-tag Git after a build runs successfully and avoid rebuilding.

  • Dockerfile strategies for Git
  • ssh issue of docker in redhat 6.5
  • COPY and ADD not working in Dockerfile
  • Dockerfile - Defining an ENV variable with a dynamic value
  • Docker swarm node hostnames are the same
  • Digital Ocean and Dokku plus Play had to use 2gb RAM Machine
  • One Solution collect form web for “Jenkins: Don't want to trigger on Git Tag (No Workspace)”

    I know this question is getting old, but I recently had a similar problem with Bitbucket’s webhook to Jenkins that would send out notifications of push changes for tags. I tried configuring the hook not to send those, but it never worked.

    After much trial and error, the only thing that worked for me was to set the “Branch Specifier (blank for ‘any’)” field of the Jenkins Git Plugin to “everything but tags”, using a regex like this one: :^(?!.*(refs\/tags\/)).*.

    I admit that this solution has the major drawback that a job with such a configuration cannot build tags… In my case, the set of jobs that had this configuration wasn’t expected to build tags, so it was an okay solution, but I would have much preferred to remove the notifications.

    Hope this helps.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.