Github Service Hook triggers erroneous builds

I have a service hook setup on a repo in our Github Enterprise instance. It uses the TeamCity service hook to trigger continuous builds. Its pointing at a TeamCity build configuration with a VC root where the branch spec is:

+:refs/heads/*
+:refs/pull/*/merge


But when we push tags (aka refs/tags/*) it triggers a build (ex ?addToQueue=bt1234&branchName=xyz-1.0) and since the tag isn't in the given branch spec it appears to use the default branch in the VCS root (aka master).  Ideally I want it to skip the build entirely.

Advice on how to ignore or filter the erroneous webhook?

5 comments
Comment actions Permalink

Brian,

It is currently "by design" to associate a build with a branch once the branch is explicitly specified in the build triggering action.
You would need to filter the unnecessary branches not to execute a commit hook on them somehow.

There is a related issue on this: https://youtrack.jetbrains.com/issue/TW-27422

BTW, using "add2queue" HTTP request is obsolete now, the recommended way is to use REST API to trigger a build.

0
Comment actions Permalink

Thanks Yegor, a couple additional questions. Does JetBrains plan to update the existing Github service hook (or create a new one), since you are listed as the maintainer?

https://github.com/github/github-services/blob/master/lib/services/teamcity.rb#L10-L11

Also you say "I" need to filter the unecessary branches but I don't have that control without a change to the Github service hook OR TeamCity adding a callback endpoint for the Github webhooks.
https://developer.github.com/webhooks/#events

Any plans to add support for the full spectrum of webhook events, along with a way to configure/filter/map the events to triggering builds?

Thanks again.

0
Comment actions Permalink

Brian,

> Does JetBrains plan to update the existing Github service hook

Yes. There is a related issue filed: https://youtrack.jetbrains.com/issue/TW-38809

While we would be comfortable maintiaing the hook, so far JetBrains has never commited to do so.


Sorry, I do not have a good solution for you right now. I'd configure TeamCity to use build's branches which would be compatible with the branch sent by the hook. See related discussion.


> Any plans to add support for the full spectrum of webhook events

Not sure I understand what kind of support you mean here. Could you expand on this?

0
Comment actions Permalink

TeamCity should expose a REST endpoint that can receive the payload for a Github `push` event. In TeamCity I would want the ability to configure the endpoint to filter out particular events so they don't trigger a build, for example if the event `ref` doesn't match the provided branch spec for the VCS root.

Another highly desired feature would be for TeamCity to auto-install the webhook based on the VCS root information. Having to set it up and maintain it manually is tedious.

0
Comment actions Permalink

Also, I can't configure my VCS root to include `refs/tags/*`, that would be a bad thing if my CI builds tried to `mvn deploy` a released tag.

0

Please sign in to leave a comment.