Jenkins Github插件 - 触发参数化构建

时间:2016-07-05 19:30:57

标签: git github jenkins jenkins-plugins

我有一个"自由式项目" Jenkins作业有一个参数 - GIT_BRANCH,以便我可以手动或通过GitHub钩子触发它。

enter image description here

问题是GitHub插件似乎没有正确识别/设置被推送的分支。

当我查看" GitHub Hook Log"我看到Jenkins构建的视图(时间戳不匹配,因为我已经反感了钩子);

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

这很有趣,因为它根本不是正确的分支,我可以通过查看GitHub钩子日志来确认;

{
  "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"

来自com.cloudbees.jenkins.GitHubPushTrigger org.jenkinsci.plugins.github.webhook.WebhookManagercom.cloudbees.jenkins.GitHubWebHook(全部)的日志绝对没有显示。

我已尝试将以下内容作为git参数的名称来代替" GIT_BRANCH";

  • REF
  • BRANCH_TO_BUILD
  • BRANCH

软件版本:

  • Jenkins - 2.11
  • GitHub插件 - 1.19.2
  • Git参数插件 - 0.5.1

0 个答案:

没有答案