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

Github webhook ignore "Github project" field (I.E. projectUrl)

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Incomplete
    • Component/s: github-plugin
    • Labels:
    • Environment:
      Jenkins 1.623 from deb (Ubuntu Server 15.04)
      Github plugin 1.12.0
    • Similar Issues:

      Description

      When setting up a Project with "Build when a change is pushed to GitHub" enabled, the webhook handler use the source code repository url to match the github project is applies on and ignore the dedicated field "Github project" (I.E. projectUrl).

      I think this is not a wanted behavior as this field seems to be dedicated to this purpose.

      Additionally this prevent from creating jobs that does not checkout the repository but are still triggered by the github webhook

        Attachments

          Activity

          Hide
          integer Kanstantsin Shautsou added a comment -

          Nothing wrong It works how designed by author.

          Github project is used for linking and by some gh related plugins.

          We plan implement more generic GH triggers that shouldn't depend on SCM, adding hacks right now is bad idea.

          Show
          integer Kanstantsin Shautsou added a comment - Nothing wrong It works how designed by author. Github project is used for linking and by some gh related plugins. We plan implement more generic GH triggers that shouldn't depend on SCM, adding hacks right now is bad idea.
          Hide
          lanwen Kirill Merkushev added a comment -

          Félicien François, thanks for your feedback!

          This problem already mentioned in https://github.com/jenkinsci/github-plugin/pull/54
          We are working on it

          Show
          lanwen Kirill Merkushev added a comment - Félicien François, thanks for your feedback! This problem already mentioned in https://github.com/jenkinsci/github-plugin/pull/54 We are working on it
          Hide
          felicienfrancois Félicien François added a comment -

          OK, thank you Kirill and good luck.

          Show
          felicienfrancois Félicien François added a comment - OK, thank you Kirill and good luck.
          Hide
          lo1tuma Mathias Schreck added a comment -

          Is there any update regarding this issue?

          Today I realised that the github plugin doesn’t automatically create the github webhook for my pipeline job which is configured to fetch the pipeline script from SCM. I guess github plugin doesn’t look at the pipeline script SCM settings and consequently can’t register the webhook.

          To reproduce this you can run the following script in the jenkins script console:

          import com.cloudbees.jenkins.GitHubWebHook
          import jenkins.model.Jenkins
          
          def myPipelineJob = Jenkins.getInstance().getAllItems().find { it.name == 'my-pipeline' }
          GitHubWebHook.get().registerHookFor(myPipelineJob)
          

          then jenkins logs shows the following:

          Jul 10, 2016 2:16:51 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
          GitHub webhooks activated for job my-pipeline with [] (events: [PUSH])
          

          As you can see, there are no repository information thus no webhook was created.

          When I do the same for a freestyle job, then everything works and the log output looks like this:

          Jul 10, 2016 2:20:26 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
          GitHub webhooks activated for job freestyle-job with [GitHubRepositoryName[host=my-corp-github-enterprise.com,username=foo,repository=bar]] (events: [PUSH])
          
          Show
          lo1tuma Mathias Schreck added a comment - Is there any update regarding this issue? Today I realised that the github plugin doesn’t automatically create the github webhook for my pipeline job which is configured to fetch the pipeline script from SCM. I guess github plugin doesn’t look at the pipeline script SCM settings and consequently can’t register the webhook. To reproduce this you can run the following script in the jenkins script console: import com.cloudbees.jenkins.GitHubWebHook import jenkins.model.Jenkins def myPipelineJob = Jenkins.getInstance().getAllItems().find { it.name == 'my-pipeline' } GitHubWebHook.get().registerHookFor(myPipelineJob) then jenkins logs shows the following: Jul 10, 2016 2:16:51 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run GitHub webhooks activated for job my-pipeline with [] (events: [PUSH]) As you can see, there are no repository information thus no webhook was created. When I do the same for a freestyle job, then everything works and the log output looks like this: Jul 10, 2016 2:20:26 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run GitHub webhooks activated for job freestyle-job with [GitHubRepositoryName[host=my-corp-github-enterprise.com,username=foo,repository=bar]] (events: [PUSH])
          Hide
          integer Kanstantsin Shautsou added a comment -

          So it works fine with freestyle job but doesn't with pipeline?

          Show
          integer Kanstantsin Shautsou added a comment - So it works fine with freestyle job but doesn't with pipeline?

            People

            • Assignee:
              lanwen Kirill Merkushev
              Reporter:
              felicienfrancois Félicien François
            • Votes:
              2 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: