0

Scenario: Job 1 should be triggered on every new commit to github repository.

Job 2 should be triggered only when adding a tag to that same github repository.

If I configure the Github Plugin to use webhooks, it seems that if I try to set 'Branches to build' to anything permissive (**/* or refs/heads/*), it will build any push to github - which includes adding and removing tags.

Additionally, I can't seem to find a way to ignore all commits, and ONLY build tags.

I'm using Jenkins 2.32.3, Git Plugin 3.1.0, and Github Plugin 1.26.1

tayworm
  • 146
  • 3
  • This is answered in [Jenkins Git Plugin: How to build specific tag?](http://stackoverflow.com/questions/10195900/jenkins-git-plugin-how-to-build-specific-tag) — though you can use a `*` wildcard, rather than hardcoding a tag name. – Christopher Orr Mar 17 '17 at 09:44
  • The accepted answer says that it doesn't work. That also doesn't explain how to NOT trigger builds on a new tag for job 1 – tayworm Mar 17 '17 at 14:09
  • Read the answer with the most votes. Not triggering on tags is the default behaviour, so you don't need to do anything special for job 1. – Christopher Orr Mar 17 '17 at 14:12
  • @ChristopherOrr that seems to be true if I am only watching one branch to build (like the default, `*/master`) but it stops working like that if I try to watch wildcard branches - `*/*` or `refs/heads/*` – tayworm Mar 17 '17 at 14:15
  • Odd. Adding/removing tags doesn't cause a commit, and tags are under refs/tags, not refs/heads, so that shouldn't happen. I've never seen this behaviour in Jenkins with a GitHub repo. – Christopher Orr Mar 17 '17 at 14:19
  • @ChristopherOrr yeah it's not what I expected. When I'm doing this it also triggers when I delete a tag. I haven't ever seen behavior quite like this either. – tayworm Mar 17 '17 at 14:21

1 Answers1

0

Im going to start off by saying that this might vary depending on jenkins and plugin versions.

But in the normal git plugin, when you go to the job config you can select Additional Build Behavior. Under add you can select to ignore commits with certain messages (i.e. comments) or to ignore commits by certain commiters (i.e. the build user)

Al Neill
  • 589
  • 4
  • 5
  • My experience is that those fields don't work when using a webhook, but that also doesn't answer the question. – tayworm Mar 16 '17 at 23:01