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

Hook uninstalled if job is in a subfolder

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Critical
    • Resolution: Fixed
    • Component/s: github-plugin
    • Labels:
    • Environment:
      Jenkins ver. 1.565.3, GitHub plugin 1.9.1, CloudBees Folders Plugin 4.6.1
    • Similar Issues:

      Description

      After I started using the CloudBees Folders Plugin and moving jobs into folders, I noticed when I pushed stuff to github, builds were no longer triggered. I checked in GitHub and the Jenkins plugin was not enabled. I go to the job, save it again (the option "Build when a change is pushed to GitHub" is always checked and is the only method to trigger a build that's activated) and I see the hook is created, but after a minute or 2, it gets removed again. GitHub security log says the removal request comes from the Jenkins server.

      Looking at the source code, I see where hooks are being removed:
      https://github.com/jenkinsci/github-plugin/blob/49bc59d79707808d73eb0f9d5c97996fd5525d08/src/main/java/com/cloudbees/jenkins/Cleaner.java

      Activating the log for com.cloudbees.jenkins.Cleaner I can definitely see it's Jenkins the one removing the hooks. Why is considering jobs inside subfolders as "not interesting" I have no idea.

        Attachments

          Activity

          Hide
          integer Kanstantsin Shautsou added a comment -

          That all hooks where registered for projects that you expect

           LOGGER.log(Level.INFO, "Adding GitHub webhooks for {0}", names); 
          Show
          integer Kanstantsin Shautsou added a comment - That all hooks where registered for projects that you expect LOGGER.log(Level.INFO, "Adding GitHub webhooks for {0}" , names);
          Hide
          integer Kanstantsin Shautsou added a comment -

          Hi, restart wouldn't help. As orrc mentioned hook is registered only when newInstance argument for .start() is true.
          I split this functionality to separate method to have ability to call it from groovy and added button in global page.
          Proposed PR https://github.com/jenkinsci/github-plugin/pull/52/files

          Show
          integer Kanstantsin Shautsou added a comment - Hi, restart wouldn't help. As orrc mentioned hook is registered only when newInstance argument for .start() is true. I split this functionality to separate method to have ability to call it from groovy and added button in global page. Proposed PR https://github.com/jenkinsci/github-plugin/pull/52/files
          Hide
          integer Kanstantsin Shautsou added a comment -

          Please test this PR https://github.com/jenkinsci/github-plugin/pull/52 , you can pick built hpi from commit status link.

          Show
          integer Kanstantsin Shautsou added a comment - Please test this PR https://github.com/jenkinsci/github-plugin/pull/52 , you can pick built hpi from commit status link.
          Hide
          lucasocio Leandro Lucarella added a comment -

          I tested the PR and the re-register button seems to work fine, thanks!

          Show
          lucasocio Leandro Lucarella added a comment - I tested the PR and the re-register button seems to work fine, thanks!
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Kanstantsin Shautsou
          Path:
          src/main/java/com/cloudbees/jenkins/GitHubPushTrigger.java
          src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/global.jelly
          http://jenkins-ci.org/commit/github-plugin/6154cedfe18f265aea25756284a3472696eceaff
          Log:
          JENKINS-25127 Add Button for registering all hooks

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kanstantsin Shautsou Path: src/main/java/com/cloudbees/jenkins/GitHubPushTrigger.java src/main/resources/com/cloudbees/jenkins/GitHubPushTrigger/global.jelly http://jenkins-ci.org/commit/github-plugin/6154cedfe18f265aea25756284a3472696eceaff Log: JENKINS-25127 Add Button for registering all hooks

            People

            • Assignee:
              Unassigned
              Reporter:
              lucasocio Leandro Lucarella
            • Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: