• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • github-plugin
    • Jenkins ver. 1.565.3, GitHub plugin 1.9.1, CloudBees Folders Plugin 4.6.1

      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.

          [JENKINS-25127] Hook uninstalled if job is in a subfolder

          Leandro Lucarella created issue -
          Leandro Lucarella made changes -
          Description Original: 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.

          Looking at the "GitHub Hook Log" for a top-level project, I see something like this:
          ---
          Last GitHub Push

          Started on Oct 13, 2014 3:21:08 PM
          Polling SCM changes on master
          Using strategy: Default
          [poll] Last Built Revision: Revision ae6386642259cb1b675730fbce96deaa29d3a369 (origin/master)
           > git rev-parse --is-inside-work-tree # timeout=10
          Fetching changes from the remote Git repositories
           > git config remote.origin.url git@github.com:sociomantic/git-hub.git # timeout=10
          Fetching upstream changes from git@github.com:sociomantic/git-hub.git
           > git --version # timeout=10
          using GIT_SSH to set credentials GitHub jenkins-admin
           > git fetch --tags --progress git@github.com:sociomantic/git-hub.git +refs/heads/*:refs/remotes/origin/*
          Polling for changes in
          Seen branch in repository origin/master
           > git log --full-history --no-abbrev --format=raw -M -m --raw ae6386642259cb1b675730fbce96deaa29d3a369..7618cac3f33deb84868332acc64572b60d7adf7e # timeout=10
          Done. Took 3.4 sec
          Changes found
          ---

          (I don't know why is it polling anything in the first place because Polling is not enabled)

          For a job in a subfolder, I see this log instead:
          ---
          New: 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.

          Daniel Beck added a comment -

          Daniel Beck added a comment - This line is bogus, needs to be getAllItems(...) : https://github.com/jenkinsci/github-plugin/blob/49bc59d79707808d73eb0f9d5c97996fd5525d08/src/main/java/com/cloudbees/jenkins/Cleaner.java#L55

          I don't have a Java development environment, but I would be very much interested in testing a fix if someone can provide it

          Leandro Lucarella added a comment - I don't have a Java development environment, but I would be very much interested in testing a fix if someone can provide it
          Daniel Beck made changes -
          Labels New: folders

          ryangardner added a comment -

          I sent a pull request with the above fix. It fixed the issue for me.

          https://github.com/jenkinsci/github-plugin/pull/51#issuecomment-84089491

          ryangardner added a comment - I sent a pull request with the above fix. It fixed the issue for me. https://github.com/jenkinsci/github-plugin/pull/51#issuecomment-84089491

          Code changed in jenkins
          User: Ryan Gardner
          Path:
          src/main/java/com/cloudbees/jenkins/Cleaner.java
          http://jenkins-ci.org/commit/github-plugin/2a49bac65fb7e05cd083e8b445ad2fcfb689ae0a
          Log:
          Address JENKINS-25127 by using getAllIItems instead of getItems

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Ryan Gardner Path: src/main/java/com/cloudbees/jenkins/Cleaner.java http://jenkins-ci.org/commit/github-plugin/2a49bac65fb7e05cd083e8b445ad2fcfb689ae0a Log: Address JENKINS-25127 by using getAllIItems instead of getItems

          Nice! ETA for a release with this fix?

          Leandro Lucarella added a comment - Nice! ETA for a release with this fix?

          Oh, I see 1.11.1 is out, thanks!

          Is there any way to tell all the jobs to re-register in GitHub? Right now the only way I could find to do this is to go to each jobs's config and save it again, which is a bit impractical when you have many jobs.

          Thanks!

          Leandro Lucarella added a comment - Oh, I see 1.11.1 is out, thanks! Is there any way to tell all the jobs to re-register in GitHub? Right now the only way I could find to do this is to go to each jobs's config and save it again, which is a bit impractical when you have many jobs. Thanks!

          Hi, please try restart jenkins.

          Kanstantsin Shautsou added a comment - Hi, please try restart jenkins.

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

              Created:
              Updated:
              Resolved: