Status: Open (View Workflow)
Github plugin: 1.29.0
GitHub API Plugin: 1.90
OS: Ubuntu 14.04.5 LTS
GitHub Pull Request Builder: 1.40.0
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.
- relates to
JENKINS-60901 GitHub manages hooks even when it has not been configured to do it
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.
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.
This is not only happening on GitHub organizations items, I have a free-style job that started failing with this same error.
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.
In my case I didn't have an entry in jenkins configuration, under GitHub -> GitHub Servers
It was not obvious from the error and the pipeline configuration that you needed to have the github repo configured both in global jenkins configuration and in the pipeline job itself
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.