You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What Operating System are you using (both controller, and any agents involved in the problem)?
Windows 11
Reproduction steps
GitLab setup
Generate personal access token with required API access
Create new group
Create single project in that group
Setup credentials in Jenkins in System -> Global credentials
Add Secret text credentials named dummy_connection_string with random text as secret
Create GitLab Personal Access Token gitlab_token with token created in "GitLab Setup"
Create secret text gitlab_webhook_secret with random text as secret
Define GitLab server
Credentials = gitlab_token
'Manage Web Hooks' disabled
'Manage System Hooks' disabled
Secret Toekn = gitlab_webhook_secret
Define orgranization Folder job
Add New Item -> Organization Folder
2.Add GitLab Group as repository source
Select server defined in "Define GitLab server"
Enter name of group created in "GitLab setup"
Remove all behaviours except "Discover branches" (probably not necessary)
Add "Override GitLab hook management modes"
Set Web Hook Strategy to "Use Item credentials for Web Hook management'
Set System Hook Strategy to 'Disable System Hook management'
Save
Trigger GitLab Group Scan
Check 'Scan GitLab Group Log'
Expected Results
Webhook is created
Actual Results
Cannot set web hook: Unauthorized is reported in GitLab group scan log. Inspection of HTTP requests between Jenkins and GitLab show that for all requests except hooks-related token defined in server is used. For request that lists hooks configured in project (/api/v4/groups/<groupname>%2f<projectname>/hooks) different token is used. In fact it is token created as dummy_connection_string.
Jenkins and plugins versions report
Environment
What Operating System are you using (both controller, and any agents involved in the problem)?
Windows 11
Reproduction steps
dummy_connection_string
with random text as secretgitlab_token
with token created in "GitLab Setup"gitlab_webhook_secret
with random text as secretgitlab_token
gitlab_webhook_secret
2.Add GitLab Group as repository source
Expected Results
Webhook is created
Actual Results
Cannot set web hook: Unauthorized
is reported in GitLab group scan log. Inspection of HTTP requests between Jenkins and GitLab show that for all requests except hooks-related token defined in server is used. For request that lists hooks configured in project (/api/v4/groups/<groupname>%2f<projectname>/hooks
) different token is used. In fact it is token created asdummy_connection_string
.Anything else?
My bet is on usage of
firstOrNull
in https://github.com/jenkinsci/gitlab-branch-source-plugin/blob/master/src/main/java/io/jenkins/plugins/gitlabbranchsource/GitLabSCMSource.java#L789.If more localized token is not found, it should fallback to token defined in server, not random credential from Jenkins instance.
Are you interested in contributing a fix?
With some guidance I can try but I've never done any Jenkins development, so it might not be easy for me.
The text was updated successfully, but these errors were encountered: