问题
I have a "Freestyle project" Jenkins job that has a single parameter--GIT_BRANCH
so that I can trigger it manually or via a GitHub hook.
The problem is that the GitHub plugin doesn't seem to correctly identify / set the branch that was pushed.
When I look at the "GitHub Hook Log" view on the Jenkins build, I see (timestamps don't match because I've resent the hook);
Last GitHub Push
Started on Jul 5, 2016 11:37:01 AM
Using strategy: Default
[poll] Last Built Revision: Revision 7c4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx (refs/remotes/origin/rc)
using GIT_SSH to set credentials
> git --version # timeout=10
> git -c core.askpass=true ls-remote -h git@github.com:an-org/a-repo.git # timeout=10
Found 7 remote heads on git@github.com:an-org/a-repo.git
[poll] Latest remote head revision on refs/heads/rc is: 7c4xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - already built by nnn
Done. Took 2.4 sec
No changes
Which is funny, because that's not the right branch at all, which I can confirm by looking at the GitHub hook log;
{
"ref": "refs/heads/nil/jenkins-testing",
"before": "0000000000000000000000000000000000000000",
"after": "27eyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"created": true,
"deleted": false,
"forced": true,
"base_ref": null,
"compare": "https://github.com/an-org/a-repo/commit/27eyyyyyyyyyy",
"commits": [
{
"id": "27eyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"tree_id": "acebbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"distinct": true,
"message": "dummy commit",
"timestamp": "2016-07-05T11:13:59-07:00",
"url": "https://github.com/an-org/a-repo/commit/27eyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
"author": {
"name": "Peter Novotnak",
"email": "peter@novotnak.net",
"username": "pnovotnak"
},
"committer": {
"name": "GitHub",
"email": "noreply@github.com",
"username": "web-flow"
The logs from com.cloudbees.jenkins.GitHubPushTrigger
org.jenkinsci.plugins.github.webhook.WebhookManager
and com.cloudbees.jenkins.GitHubWebHook
(ALL) show absolutely nothing.
I've tried the following as the name of the git parameter in place of "GIT_BRANCH";
- ref
- BRANCH_TO_BUILD
- BRANCH
Software versions:
- Jenkins - 2.11
- GitHub plugin - 1.19.2
- Git Parameter plugin - 0.5.1
来源:https://stackoverflow.com/questions/38211266/jenkins-github-plugin-triggering-a-parameterized-build