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

Jenkins unable to manage webhooks of Github organization

    Details

    • Similar Issues:

      Description

      Under GitHub Pull Request Builder configuration Auto-manage webhooks is enabled.

      In the GitHub Pull Request Builder added user credentials. User belongs to owners' User's credential tested and are working.

      Webhooks management however does not work. For every private repository there's an error message displayed in Jenkins: 

      There is no credentials with admin access to manage hooks on GitHubRepositoryName[host=github.com,username=ORG_NAME,repository=REPO_NAME]

      From the error message it looks like plugin is trying to use organisation name as a user name, so authentication fails.

        Attachments

          Activity

          Hide
          markstosberg Mark Stosberg added a comment -

          Neidhart Orlich You have a lot of repos to scan. Maybe periodically you hit your quota for the Github API. Do you only experience on problems on days with lot of pushes to Github?

          Show
          markstosberg Mark Stosberg added a comment - Neidhart Orlich You have a lot of repos to scan. Maybe periodically you hit your quota for the Github API. Do you only experience on problems on days with lot of pushes to Github?
          Hide
          tarjei Tarjei Huse added a comment -

          Any news here?

          I have tried very hard to find a place in Jenkins to set the username for the secret key, but have failed and thus Jenkins reports my ORGNAME as the username when connecting to GitHub.

          Is there a way to configure this in Jenkins I'm not seeing? In the comments above I see some references to "Projects->GitHub Organization->Owner under your Jenkins GitHub organisation" but I cannot find any such link in my Jenkins install.

          Regards,

          Show
          tarjei Tarjei Huse added a comment - Any news here? I have tried very hard to find a place in Jenkins to set the username for the secret key, but have failed and thus Jenkins reports my ORGNAME as the username when connecting to GitHub. Is there a way to configure this in Jenkins I'm not seeing? In the comments above I see some references to "Projects->GitHub Organization->Owner under your Jenkins GitHub organisation" but I cannot find any such link in my Jenkins install. Regards,
          Hide
          magnayn magnayn added a comment -

          I don't know if this is of help, and it's a bit embarrasing that the most common usecase ("I have a github org, I want to build all the projects, and have webhooks added so this is efficient/fast") is so terrible UX-wise.

          But:

          In the project configuration, top level (github organization), you need to set up the organisation name (so it finds the right projects).

          You need some credentials to access github. It only lists "username/password" items on the list.

          However : for github if you're using a personal access token, the username is irrelevant. It really should offer 'secret' types in this list.

          I got ours to work by (re)creating a username/password credentials as username = ORG_NAME, password = personal_access_token.

          This might be of help.

          Show
          magnayn magnayn added a comment - I don't know if this is of help, and it's a bit embarrasing that the most common usecase ("I have a github org, I want to build all the projects, and have webhooks added so this is efficient/fast") is so terrible UX-wise. But: In the project configuration, top level (github organization), you need to set up the organisation name (so it finds the right projects). You need some credentials to access github. It only lists "username/password" items on the list. However : for github if you're using a personal access token, the username is  irrelevant . It really should offer 'secret' types in this list. I got ours to work by (re)creating a username/password credentials as username = ORG_NAME, password = personal_access_token. This might be of help.
          Hide
          saulcruz Saul Cruz added a comment -

          This is not only happening on GitHub organizations items, I have a free-style job that started failing with this same error. 

          Show
          saulcruz Saul Cruz added a comment - This is not only happening on GitHub organizations items, I have a free-style job that started failing with this same error. 
          Hide
          mmerrill3 Michael Merrill added a comment -

          A possible solution in the org.jenkinsci.plugins.github.webhook.WebhookManager plugin would be to look up the username given the secret text via the API: https://api.github.com/user?  Or, if its an enterprise github, the API for current_user_url from https://<MY ENTERPRISE API URL>/? Use the login from that response as the username in the connection:

          host=github.com,username=<MY ORG>,repository=<MY REPO>

           

          I think this will work for all use cases, including private orgs, public, and enterprise github.

          Show
          mmerrill3 Michael Merrill added a comment - A possible solution in the org.jenkinsci.plugins.github.webhook.WebhookManager plugin would be to look up the username given the secret text via the API: https://api.github.com/user?   Or, if its an enterprise github, the API for current_user_url from  https://<MY ENTERPRISE API URL>/ ? Use the login from that response as the username in the connection: host=github.com,username=<MY ORG>,repository=<MY REPO>   I think this will work for all use cases, including private orgs, public, and enterprise github.

            People

            • Assignee:
              lanwen Kirill Merkushev
              Reporter:
              dmytro_kovalov Dmytro Kovalov
            • Votes:
              25 Vote for this issue
              Watchers:
              38 Start watching this issue

              Dates

              • Created:
                Updated: