Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ways not to notify Jenkins when he's pushing tags ? #173

Open
jonathanpelletier opened this issue Jul 6, 2016 · 4 comments
Open

Ways not to notify Jenkins when he's pushing tags ? #173

jonathanpelletier opened this issue Jul 6, 2016 · 4 comments

Comments

@jonathanpelletier
Copy link

We are using Bitbucket 4.5.2 (which I'm not an admin of, so I can't access logs) with this webhook to notify our Jenkins jobs of new pushes. I recently added a post-build "Git Publisher" step to tag successful jobs and push it to our Bitbucket server.

Our Jenkins instance has its SSH key setup for system use, as described here: https://confluence.atlassian.com/bitbucketserver/ssh-access-keys-for-system-use-776639781.html. The problem is that the webhook sends a notification to Jenkins when the tag is pushed, triggering a new build. If this new build is successful, it gets tagged, triggers another build, yada, yada, yada.

I tried:

  1. Use in the "Committers to Ignore" field
    • After trying the 20 or so "obvious" possibilities, using the Linux user name, ssh-key email, etc... it never worked. I assume that it is because there is no Bitbucket user account, since the tagging/pushing was done using jenkins, which is allowed to connect to Bitbucket password-less over ssh.
  2. Running tcpdump on Jenkins
    • I never saw a "user" field (or something along the lines of) in the notification messages. I can easily guess that it's not something Bitbucket sends out. So couldn't see if it was a special user name, or just null.
  3. "Branch Options" -> "Ignore From" set to refs/tags/*
    • I thought it would be a clever thing to try, instead of targeting a specific user. No luck there either. The code in BranchEligibilityFilter.java told me after that only branches starting with refs/heads/ can match...

So any idea how I could prevent the webhook from notifying Jenkins when tags are pushed from Jenkins? I'm out of ideas, except doing some dirty build step in our job to stop the infinite build loop.

Thanks

@karann-jain
Copy link

Have you tried adding commit message while creating tag and excluding this commit tag using Git Plugin option Polling ignored commits with certain messages?

@jonathanpelletier
Copy link
Author

Hum, no I haven't tried to combine this setup with polling options. Now that you mention it, it might work. I'd need to give it a try...

@thrownullpointer
Copy link

Can you provide a git log of the commit performed by this user?

@MichalMichalak
Copy link

@karann-jain Adding tag message doesn't seem to work because Jenkins does all the filtering only after proper commit is determined. At this point tag information is already lost as tag is just used to determine which commit it point to. So yes, you can filter by message, but it would be a commit message, not a tag's one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants