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

Organization Scan recreates hooks for all repository

      The organization scan recreates a hook for all repositories for which there is an item. We can see that the WebHook of each repository is recreated:

      Apr 30, 2020 12:42:08 AM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
      Calling registerHooks() for dse-team-apac/aburdajewicz/testOrg/public-repo
      Apr 30, 2020 12:42:08 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
      GitHub webhooks activated for job dse-team-apac/aburdajewicz/testOrg/public-repo with [GitHubRepositoryName[host=github.example.com,username=test-org,repository=public-repo]] (events: [PULL_REQUEST, PUSH])
      Apr 30, 2020 12:42:09 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
      Replaced hook https://github.example.com/api/v3/repos/test-org/public-repo/hooks/32392 (events: [PULL_REQUEST, PUSH, REPOSITORY])
      Apr 30, 2020 12:42:09 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
      Created hook https://github.example.com/api/v3/repos/test-org/public-repo/hooks/32394 (events: [PULL_REQUEST, PUSH, REPOSITORY])
      Apr 30, 2020 12:42:10 AM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
      Calling registerHooks() for dse-team-apac/aburdajewicz/testOrg/private-repo
      Apr 30, 2020 12:42:10 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
      GitHub webhooks activated for job dse-team-apac/aburdajewicz/testOrg/private-repo with [GitHubRepositoryName[host=github.example.com,username=test-org,repository=private-repo]] (events: [PULL_REQUEST, PUSH])
      Apr 30, 2020 12:42:10 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
      Replaced hook https://github.example.com/api/v3/repos/test-org/private-repo/hooks/32393 (events: [PULL_REQUEST, PUSH, REPOSITORY])
      Apr 30, 2020 12:42:10 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
      Created hook https://github.example.com/api/v3/repos/test-org/private-repo/hooks/32395 (events: [PULL_REQUEST, PUSH, REPOSITORY])
      

      The GitHub audit log is then showing a "hook.destroy" / "hook.create" for each repository. API rate seems to be wasted and those recreation seem unnecessary. The difference of events is odd too: [PULL_REQUEST, PUSH] vs [PULL_REQUEST, PUSH, REPOSITORY]. It seems related to how GitHub Plugin and GitHub Branch Source work together.

      h3 How to Reproduce

      • Configure a GitHub Server under *Manage Jenkins > Configure System > GitHub* and enabled "Manage Hooks"
      • Create a log recorder in *Manage Jenkins > System Logs* for org.jenkinsci.plugins.github.webhook.WebhookManager, com.cloudbees.jenkins.GitHubWebHook
      • Create an GitHub Organization item that match at least one repo
      • Run the Organization Scan a few times

      Check the log recorder and also the Audit log at $GITHUB_ORG_URL/settings/audit-log, You shell see that hooks are replaced on Organization Scan.

          [JENKINS-62116] Organization Scan recreates hooks for all repository

          Allan BURDAJEWICZ created issue -
          Allan BURDAJEWICZ made changes -
          Description Original: The organization scan recreates a hook for all repositories for which there is an item. We can see that A WebHook is created / updated with events "[PULL_REQUEST, PUSH]" and then the webhook is *replaced* with events "[PULL_REQUEST, PUSH, REPOSITORY]".

          {code}
          Apr 30, 2020 12:42:08 AM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
          Calling registerHooks() for dse-team-apac/aburdajewicz/testOrg/public-repo
          Apr 30, 2020 12:42:08 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
          GitHub webhooks activated for job dse-team-apac/aburdajewicz/testOrg/public-repo with [GitHubRepositoryName[host=github.example.com,username=test-org,repository=public-repo]] (events: [PULL_REQUEST, PUSH])
          Apr 30, 2020 12:42:09 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
          Replaced hook https://github.example.com/api/v3/repos/test-org/public-repo/hooks/32392 (events: [PULL_REQUEST, PUSH, REPOSITORY])
          Apr 30, 2020 12:42:09 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
          Created hook https://github.example.com/api/v3/repos/test-org/public-repo/hooks/32394 (events: [PULL_REQUEST, PUSH, REPOSITORY])
          Apr 30, 2020 12:42:10 AM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
          Calling registerHooks() for dse-team-apac/aburdajewicz/testOrg/private-repo
          Apr 30, 2020 12:42:10 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
          GitHub webhooks activated for job dse-team-apac/aburdajewicz/testOrg/private-repo with [GitHubRepositoryName[host=github.example.com,username=test-org,repository=private-repo]] (events: [PULL_REQUEST, PUSH])
          Apr 30, 2020 12:42:10 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
          Replaced hook https://github.example.com/api/v3/repos/test-org/private-repo/hooks/32393 (events: [PULL_REQUEST, PUSH, REPOSITORY])
          Apr 30, 2020 12:42:10 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
          Created hook https://github.example.com/api/v3/repos/test-org/private-repo/hooks/32395 (events: [PULL_REQUEST, PUSH, REPOSITORY])
          {code}

          The GitHub audit log is then showing a "hook.destroy" / "hook.create" for each repository. API rate seems to be wasted and those recreation seem unnecessary. The differenc eof events


          h3 How to Reproduce

          * Configure a GitHub Server under **Manage Jenkins > Configure System > GitHub** and enabled "Manage Hooks"
          * Create a log recorder in **Manage Jenkins > System Logs** for {{org.jenkinsci.plugins.github.webhook.WebhookManager}}, {{com.cloudbees.jenkins.GitHubWebHook}}
          * Create an GitHub Organization item that match at least one repo
          * Run the Organization Scan a few times

          Check the log recorder and also the Audit log at {{$GITHUB_ORG_URL/settings/audit-log}}, You shell see that hooks are replaced on Organization Scan.
          New: The organization scan recreates a hook for all repositories for which there is an item. We can see that the WebHook of each repository is recreated:

          {code}
          Apr 30, 2020 12:42:08 AM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
          Calling registerHooks() for dse-team-apac/aburdajewicz/testOrg/public-repo
          Apr 30, 2020 12:42:08 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
          GitHub webhooks activated for job dse-team-apac/aburdajewicz/testOrg/public-repo with [GitHubRepositoryName[host=github.example.com,username=test-org,repository=public-repo]] (events: [PULL_REQUEST, PUSH])
          Apr 30, 2020 12:42:09 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
          Replaced hook https://github.example.com/api/v3/repos/test-org/public-repo/hooks/32392 (events: [PULL_REQUEST, PUSH, REPOSITORY])
          Apr 30, 2020 12:42:09 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
          Created hook https://github.example.com/api/v3/repos/test-org/public-repo/hooks/32394 (events: [PULL_REQUEST, PUSH, REPOSITORY])
          Apr 30, 2020 12:42:10 AM FINE com.cloudbees.jenkins.GitHubWebHook$1 apply
          Calling registerHooks() for dse-team-apac/aburdajewicz/testOrg/private-repo
          Apr 30, 2020 12:42:10 AM INFO org.jenkinsci.plugins.github.webhook.WebhookManager$1 run
          GitHub webhooks activated for job dse-team-apac/aburdajewicz/testOrg/private-repo with [GitHubRepositoryName[host=github.example.com,username=test-org,repository=private-repo]] (events: [PULL_REQUEST, PUSH])
          Apr 30, 2020 12:42:10 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
          Replaced hook https://github.example.com/api/v3/repos/test-org/private-repo/hooks/32393 (events: [PULL_REQUEST, PUSH, REPOSITORY])
          Apr 30, 2020 12:42:10 AM FINE org.jenkinsci.plugins.github.webhook.WebhookManager$3 applyNullSafe
          Created hook https://github.example.com/api/v3/repos/test-org/private-repo/hooks/32395 (events: [PULL_REQUEST, PUSH, REPOSITORY])
          {code}

          The GitHub audit log is then showing a "hook.destroy" / "hook.create" for each repository. API rate seems to be wasted and those recreation seem unnecessary. The difference of events is odd too: {{[PULL_REQUEST, PUSH]}} vs {{[PULL_REQUEST, PUSH, REPOSITORY]}}. It seems related to how GitHub Plugin and GitHub Branch Source work together.

          h3 How to Reproduce

          * Configure a GitHub Server under **Manage Jenkins > Configure System > GitHub** and enabled "Manage Hooks"
          * Create a log recorder in **Manage Jenkins > System Logs** for {{org.jenkinsci.plugins.github.webhook.WebhookManager}}, {{com.cloudbees.jenkins.GitHubWebHook}}
          * Create an GitHub Organization item that match at least one repo
          * Run the Organization Scan a few times

          Check the log recorder and also the Audit log at {{$GITHUB_ORG_URL/settings/audit-log}}, You shell see that hooks are replaced on Organization Scan.

          I can actually still see this when disabling the "Manage Webhooks" under Manage Jenkins > Configure System > GitHub. The creation / deletion of webhooks in that case is still triggered. But fails with credentials issues.

          Allan BURDAJEWICZ added a comment - I can actually still see this when disabling the "Manage Webhooks" under Manage Jenkins > Configure System > GitHub . The creation / deletion of webhooks in that case is still triggered. But fails with credentials issues.

          Olivier Lamy added a comment -

          Olivier Lamy added a comment - pr  https://github.com/jenkinsci/github-plugin/pull/230  
          Olivier Lamy made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: Open [ 1 ] New: Fixed but Unreleased [ 10203 ]

          similar to allan_burdajewicz - I am still seeing this issue even though I disabled webhook management

          Günter Grodotzki added a comment - similar to allan_burdajewicz - I am still seeing this issue even though I disabled webhook management
          Günter Grodotzki made changes -
          Resolution Original: Fixed [ 1 ]
          Status Original: Fixed but Unreleased [ 10203 ] New: Reopened [ 4 ]

          Allan BURDAJEWICZ added a comment - - edited

          lifeofguenter what version of the GitHub plugin are you running ? it supposed to be fixed in version 1.30.0.

          Allan BURDAJEWICZ added a comment - - edited lifeofguenter what version of the GitHub plugin are you running ? it supposed to be fixed in version 1.30.0.

          I am on version 1.30.0

          Günter Grodotzki added a comment - I am on version 1.30.0

            lanwen Kirill Merkushev
            allan_burdajewicz Allan BURDAJEWICZ
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: