Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-37845

GitHub plugin build-on-push for Pipeline job is hard/unpredictable to work with

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Hello,
      I have encountered issues with automatic hook registering for a pipeline job.

      This is the github project:

      https://github.com/alanfranz/foolscrate

      I have read:

      https://issues.jenkins-ci.org/browse/JENKINS-37217

      and

      https://issues.jenkins-ci.org/browse/JENKINS-34396

      I created a new pipeline job, I did set the github project url, checked "build when change is pushed to github", then choose to use the Jenkinsfile from SCM, and set the github ssh url for my project; Initially I had an issue with the auto-registering of any hook, this was the log

      Aug 31, 2016 10:40:38 AM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
      Calling registerHooks() for foolscrate-v1dev
      Aug 31, 2016 10:40:38 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
      GitHub webhooks activated for job foolscrate-v1dev with [] (events: [REPOSITORY])
      

      There were no hooks defined in my github settings page for the repo.

      After looking at the issues above, I discovered that I had to manually trigger one build and I needed to set (AFAICU) an explit 'git url:' in my Jenkinsfile. THEN, after that, I had to disable the "Build when change was pushed to github", save the job, RE-ENABLE the option, re-save the job.

      After doing that, this was the log:

      Aug 31, 2016 10:59:42 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
      GitHub webhooks activated for job foolscrate-v1dev with [GitHubRepositoryName[host=github.com,username=alanfranz,repository=foolscrate]] (events: [REPOSITORY])
      Aug 31, 2016 10:59:43 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
      Created hook https://api.github.com/repos/alanfranz/foolscrate/hooks/9722521 (events: [REPOSITORY])
      Aug 31, 2016 11:00:06 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager unregisterFor
      Check GHRepository@20f660a4[description=<null>,homepage=<null>,name=foolscrate,license=<null>,fork=false,watchers=0,forks=0,size=66,milestones={},language=Shell,commits={},source=<null>,parent=<null>,url=https://api.github.com/repos/alanfranz/foolscrate,id=65638029] for redundant hooks...
      

      And still nothing happened on push.

      See the issue? It seems the hook was created only for REPOSITORY events, but not for PUSH events!

      I entered my github settings page, and enabled the PUSH event.

      Immediately, the event was triggered and the build started. But something more happened:

       SCM changes detected in foolscrate-v1dev. Triggering #4
      Aug 31, 2016 11:13:59 AM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
      Calling registerHooks() for foolscrate-v1dev
      Aug 31, 2016 11:13:59 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
      GitHub webhooks activated for job foolscrate-v1dev with [GitHubRepositoryName[host=github.com,username=alanfranz,repository=foolscrate]] (events: [PUSH, REPOSITORY])
      Aug 31, 2016 11:13:59 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
      Created hook https://api.github.com/repos/alanfranz/foolscrate/hooks/9722695 (events: [PUSH, REPOSITORY])

      That happened WITHOUT me editing the job itself again (I had committed changes to the Jenkinsfile, by the way), and now the hook seemed to register properly.

      My final request:
      I'm not sure whether this is a bug; the pipeline job should now be the "way to go" for new Jenkins job. Can we get a CLEAR documentation of what we should or shouldn't do, in either the Jenkins page or the Jenkinsfile, in order to make Github push events to work?

      Thank you very much!

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stephenconnolly Stephen Connolly
              Reporter:
              alanfranz alanfranz
              Votes:
              8 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: