-
Notifications
You must be signed in to change notification settings - Fork 460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gitlab Branch Source Plugin won't create secret token. #987
Comments
You need to explain what needs to be changed in this project, maybe provide a reproducer that is independent of Jenkins. Or you need to open an issue in the corresponding Jenkins plugin: Because the stacktrace you provided doesn't give me enough explanation about what is going wrong. |
I've been digging into the plugin and GitLab itself in relation to jenkinsci/gitlab-branch-source-plugin#340 and wonder if there's a roundtrip that's failing here. GitLab's documentation says that the header is supposed to be |
Unless there is an actual roundtrip with the system hook, this is probably a red herring. |
I'm having a similar problem, and it looks to me like the issue is that the URL for the profile page changed at some point. The gitlab branch source plugin is failing here for me: https://github.com/jenkinsci/gitlab-branch-source-plugin/blob/master/src/main/java/io/jenkins/plugins/gitlabserverconfig/servers/helpers/GitLabPersonalAccessTokenCreator.java#L141 - and that is calling into AccessTokenUtils.createPersonalAccessToken() in gitlab4j-api That method is building a URL like this: /profile/personal_access_tokens ( https://github.com/gitlab4j/gitlab4j-api/blob/main/src/main/java/org/gitlab4j/api/utils/AccessTokenUtils.java#L165 ) But, in gitlab the correct URL seems to now be /-/user_settings/personal_access_tokens I see in the pom file that tests appear to be running against a quite outdated version of gitlab here (12.9.2) where we're running gitlab 17.x - so I suspect it changed somewhere between those versions. |
Thank you for the detailed analysis. To be honest I think that We could try to change the mentioned line:
To use the new URL pattern. But the documentation itself does not provide a REST endpoint for this operation: The So I think the "Gitlab Branch Source Plugin" should not use this method. I think the correct flow is to create the token before trying to configure the gitlab connection in Jenkins. |
I am using Gitlab 14.0.12 and Jenkins 2.400. GitLab Branch Source Plugin Version660.vd45c0f4c0042 installed. When using any of the logins, it gives me the same error. When I went through and tried seeing what the cookies that are returned when going through sign in like the code does, I do not get anything that looks like the format expected. I am not sure if I am using the wrong version of something somewhere, but it's been driving me crazy that this isn't working. I cannot get my Multibranch plugins to kick off automatically because of this.
org.gitlab4j.api.GitLabApiException: authenticity_token not found, aborting!
The text was updated successfully, but these errors were encountered: