jenkinsci / gitlab-branch-source-plugin

A Jenkins Plugin for GitLab Multibranch Pipeline jobs and Folder Organization
https://plugins.jenkins.io/gitlab-branch-source
MIT License
124 stars 94 forks source link

Error Creating Secret Token for Gitlab in Jenkins #340

Open jdteasler opened 1 year ago

jdteasler commented 1 year ago

Jenkins and plugins versions report

Jenkins: 2.400 OS: Windows Server 2019 - 10.0 Java: 12.0.2 - Oracle Corporation (OpenJDK 64-Bit Server VM)

ace-editor:1.1 active-directory:2.30 ant:487.vd79d090d4ea_e antisamy-markup-formatter:159.v25bc67cd35fb apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5 authentication-tokens:1.53.v1c90fd9191ab blueocean:1.27.4 blueocean-autofavorite:1.2.5 blueocean-bitbucket-pipeline:1.27.4 blueocean-commons:1.27.4 blueocean-config:1.27.4 blueocean-core-js:1.27.4 blueocean-dashboard:1.27.4 blueocean-display-url:2.4.2 blueocean-events:1.27.4 blueocean-git-pipeline:1.27.4 blueocean-github-pipeline:1.27.4 blueocean-i18n:1.27.4 blueocean-jira:1.27.4 blueocean-jwt:1.27.4 blueocean-personalization:1.27.4 blueocean-pipeline-api-impl:1.27.4 blueocean-pipeline-editor:1.27.4 blueocean-pipeline-scm-api:1.27.4 blueocean-rest:1.27.4 blueocean-rest-impl:1.27.4 blueocean-web:1.27.4 bootstrap4-api:4.6.0-6 bootstrap5-api:5.3.0-1 bouncycastle-api:2.28 branch-api:2.1109.vdf225489a_16d build-user-vars-plugin:1.9 built-on-column:1.4 caffeine-api:3.1.6-115.vb_8b_b_328e59d8 checks-api:2.0.0 chucknorris:1.4 cloudbees-bitbucket-branch-source:809.vc1d904b_30426 cloudbees-folder:6.815.v0dd5a_cb40e0e command-launcher:100.v2f6722292ee8 commons-lang3-api:3.12.0-36.vd97de6465d5b commons-text-api:1.10.0-36.vc008c8fcda7b credentials:1254.vb_96f366e7b_a_d credentials-binding:604.vb_64480bc56ca data-tables-api:1.13.4-2 deploy:1.16 display-url-api:2.3.7 docker-commons:419.v8e3cd84ef49c docker-workflow:563.vd5d2e5c4007f durable-task:507.v050055d0cb_dd echarts-api:5.4.0-5 envinject:2.901.v0038b_6471582 envinject-api:1.199.v3ce31253ed13 ez-templates:1.3.5 favorite:2.4.2 font-awesome-api:6.4.0-1 generic-webhook-trigger:1.86.3 git:5.1.0 git-client:4.4.0 git-parameter:0.9.18 git-server:99.va_0826a_b_cdfa_d gitflow:1.0.1 github:1.37.1 github-api:1.314-431.v78d72a_3fe4c3 github-branch-source:1728.v859147241f49 gitlab-api:5.2.0-86.v1ed41a_9cf486 gitlab-branch-source:660.vd45c0f4c0042 gitlab-oauth:1.17 gitlab-plugin:1.7.14 handlebars:3.0.8 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 hp-application-automation-tools-plugin:8.0 htmlpublisher:1.31 instance-identity:173.va_37c494ec4e5 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.15.2-350.v0c2f3f8fc595 jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javadoc:233.vdc1a_ec702cff javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.8-1 jdk-tool:66.vd8fa_64ee91b_d jenkins-design-language:1.27.4 jersey2-api:2.39.1-2 jira:3.10 jjwt-api:0.11.5-77.v646c772fddb_0 jnr-posix-api:3.1.17-1 jquery:1.12.4-1 jquery-detached:1.2.1 jquery3-api:3.7.0-1 jsch:0.2.8-65.v052c39de79b_2 junit:1207.va_09d5100410f ldap:682.v7b_544c9d1512 lockable-resources:1156.v5e9f897ece02 m2release:0.16.3 mailer:457.v3f72cb_e015e5 mapdb-api:1.0.9-28.vf251ce40855d matrix-auth:3.1.8 matrix-combinations-parameter:1.3.2 matrix-project:789.v57a_725b_63c79 maven-plugin:3.22 metrics:4.2.18-439.v86a_20b_a8318b mina-sshd-api-common:2.10.0-69.v28e3e36d18eb mina-sshd-api-core:2.10.0-69.v28e3e36d18eb momentjs:1.1.1 nodelabelparameter:1.12.0 oauth-credentials:0.645.ve666a_c332668 okhttp-api:4.11.0-145.vcb_8de402ef81 pagerduty:0.7.1 pam-auth:1.10 parameterized-trigger:2.45 pipeline-build-step:496.v2449a_9a_221f2 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:656.va_a_ceeb_6ffb_f7 pipeline-input-step:468.va_5db_051498a_4 pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2141.v5402e818a_779 pipeline-model-definition:2.2141.v5402e818a_779 pipeline-model-extensions:2.2141.v5402e818a_779 pipeline-rest-api:2.32 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2141.v5402e818a_779 pipeline-stage-view:2.32 pipeline-utility-steps:2.15.4 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:3.3.0 popper-api:1.16.1-3 popper2-api:2.11.6-2 pubsub-light:1.17 run-condition:1.5 scm-api:672.v64378a_b_20c60 script-security:1251.vfe552ed55f8d selenium:3.141.59 seleniumhtmlreport:1.1 snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4 sse-gateway:1.26 ssh-agent:333.v878b_53c89511 ssh-credentials:305.v8f4381501156 ssh-slaves:2.877.v365f5eb_a_b_eec ssh-steps:2.0.65.vd26b_5b_9b_de4d sshd:3.303.vefc7119b_ec23 structs:324.va_f5d6774f3a_d support-core:1283.v9ddb_0284a_00c token-macro:359.vb_cde11682e0c translation:1.16 trilead-api:2.84.v72119de229b_7 variant:59.vf075fe829ccb windows-slaves:1.8.1 workflow-aggregator:596.v8c21c963d92d workflow-api:1213.v646def1087f9 workflow-basic-steps:1017.vb_45b302f0cea workflow-cps:3691.v28b_14c465a_bb workflow-cps-global-lib:609.vd95673f149b_b workflow-durable-task-step:1247.v7f9dfea_b_4fd0 workflow-job:1308.v58d48a_763b_31 workflow-multibranch:756.v891d88f2cd46 workflow-scm-step:415.v434365564324 workflow-step-api:639.v6eca_cd8c04aa workflow-support:839.v35e2736cfd5c

What Operating System are you using (both controller, and any agents involved in the problem)?

OS: Windows Server 2019 - 10.0

Reproduction steps

Go to Manage Jenkins > System Click Advanced under Add GitLab Server Click Manage additional GitLab actions Click Convert login and password token. Select any Credentials listed. Create token Credentials

Expected Results

I was thinking this is the way to create the secret token that would show up in the drop down list under Gitlab in Jenkins.

Actual Results

org.gitlab4j.api.GitLabApiException: authenticity_token not found, aborting!

at org.gitlab4j.api.utils.AccessTokenUtils.login(AccessTokenUtils.java:616)

at org.gitlab4j.api.utils.AccessTokenUtils.createPersonalAccessToken(AccessTokenUtils.java:159)

at io.jenkins.plugins.gitlabserverconfig.servers.helpers.GitLabPersonalAccessTokenCreator.doCreateTokenByCredentials(GitLabPersonalAccessTokenCreator.java:141)

at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:719)

at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:397)

at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:409)

at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:78)

at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26)

at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:207)

at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:140)

at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:558)

at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:59)

at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)

at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)

at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:289)

at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:59)

at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)

at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)

at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:836)

at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)

at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:475)

at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)

at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)

at org.kohsuke.stapler.Stapler.invoke(Stapler.java:698)

at org.kohsuke.stapler.Stapler.service(Stapler.java:248)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:764)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:227)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:157)

at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:248)

at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)

at jenkins.security.ResourceDomainFilter.doFilter(ResourceDomainFilter.java:81)

at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)

at jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:129)

at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)

at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:60)

at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)

at com.cloudbees.jenkins.support.slowrequest.SlowRequestFilter.doFilter(SlowRequestFilter.java:37)

at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)

at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)

at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)

at jenkins.metrics.impl.MetricsFilter.doFilter(MetricsFilter.java:125)

at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)

at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:160)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:154)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:94)

at jenkins.security.AcegiSecurityExceptionFilter.doFilter(AcegiSecurityExceptionFilter.java:52)

at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)

at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:54)

at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120)

at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)

at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100)

at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)

at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:110)

at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:101)

at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221)

at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)

at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:97)

at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117)

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:63)

at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)

at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:111)

at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:172)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:53)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:86)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

at jenkins.security.SuspiciousRequestFilter.doFilter(SuspiciousRequestFilter.java:38)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:189)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:162)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:659)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:135)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)

at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:687)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:357)

at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:382)

at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)

at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:895)

at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1722)

at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)

at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.base/java.lang.Thread.run(Thread.java:835)

Anything else?

I am using Gitlab 16.1.0 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.

krachynski commented 1 year ago

I am seeing the same behaviour here.

Jenkins: 2.414.1 OS: Linux - 5.15.0-73-generic Java: 11.0.20 - Eclipse Adoptium (OpenJDK 64-Bit Server VM)

Office-365-Connector:4.20.0 active-directory:2.33 amazon-ecr:1.114.vfd22430621f5 analysis-model-api:11.7.0 ansible:253.v4fe719ffdd8a_ ant:497.v94e7d9fffa_b_9 antisamy-markup-formatter:162.v0e6ec0fcfcf6 apache-httpcomponents-client-4-api:4.5.14-208.v438351942757 apache-httpcomponents-client-5-api:5.2.1-1.0 authentication-tokens:1.53.v1c90fd9191ab authorize-project:1.7.1 aws-credentials:218.v1be9466ec5da aws-java-sdk:1.12.529-406.vdeff15e5817d aws-java-sdk-cloudformation:1.12.529-406.vdeff15e5817d aws-java-sdk-codebuild:1.12.529-406.vdeff15e5817d aws-java-sdk-ec2:1.12.529-406.vdeff15e5817d aws-java-sdk-ecr:1.12.529-406.vdeff15e5817d aws-java-sdk-ecs:1.12.529-406.vdeff15e5817d aws-java-sdk-efs:1.12.529-406.vdeff15e5817d aws-java-sdk-elasticbeanstalk:1.12.529-406.vdeff15e5817d aws-java-sdk-iam:1.12.529-406.vdeff15e5817d aws-java-sdk-kinesis:1.12.529-406.vdeff15e5817d aws-java-sdk-logs:1.12.529-406.vdeff15e5817d aws-java-sdk-minimal:1.12.529-406.vdeff15e5817d aws-java-sdk-secretsmanager:1.12.529-406.vdeff15e5817d aws-java-sdk-sns:1.12.529-406.vdeff15e5817d aws-java-sdk-sqs:1.12.529-406.vdeff15e5817d aws-java-sdk-ssm:1.12.529-406.vdeff15e5817d bootstrap5-api:5.3.0-1 bouncycastle-api:2.29 branch-api:2.1128.v717130d4f816 build-timeout:1.31 caffeine-api:3.1.8-133.v17b_1ff2e0599 checks-api:2.0.1 cloud-stats:320.v96b_65297a_4bb cloudbees-folder:6.848.ve3b_fd7839a_81 command-launcher:107.v773860566e2e commons-httpclient3-api:3.1-3 commons-lang3-api:3.13.0-62.v7d18e55f51e2 commons-text-api:1.10.0-78.v3e7b_ea_d5a_fe1 conditional-buildstep:1.4.3 config-file-provider:953.v0432a_802e4d2 configuration-as-code:1700.v6f448841296e copyartifact:722.v0662a_9b_e22a_c credentials:1271.v54b1c2c6388a credentials-binding:631.v861c06d062b_4 data-tables-api:1.13.5-1 display-url-api:2.3.9 docker-commons:439.va_3cb_0a_6a_fb_29 docker-java-api:3.3.1-79.v20b_53427e041 docker-plugin:1.5 docker-workflow:572.v950f58993843 dtkit-api:3.0.2 durable-task:523.va_a_22cf15d5e0 ec2:1609.v53b_02a_b_9e52d echarts-api:5.4.0-5 email-ext:2.100 embeddable-build-status:412.v09da_db_1dee68 favorite:2.4.3 font-awesome-api:6.4.0-2 forensics-api:2.3.0 git:5.2.0 git-client:4.4.0 github:1.37.3 github-api:1.314-431.v78d72a_3fe4c3 github-branch-source:1734.v8a_ed3a_653490 github-checks:554.vb_ee03a_000f65 gitlab-api:5.3.0-91.v1f9a_fda_d654f gitlab-branch-source:671.v67b7169092ca gradle:2.8.2 handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953 htmlpublisher:1.32 instance-identity:173.va_37c494ec4e5 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.15.2-350.v0c2f3f8fc595 jacoco:3.3.4 jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javadoc:243.vb_b_503b_b_45537 javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.8-1 jdk-tool:73.vddf737284550 jersey2-api:2.40-1 jira:3.10 jjwt-api:0.11.5-77.v646c772fddb_0 jobConfigHistory:1229.v3039470161a_d jquery:1.12.4-1 jquery3-api:3.7.0-1 jsch:0.2.8-65.v052c39de79b_2 junit:1217.v4297208a_a_b_ce label-linked-jobs:6.0.1 ldap:694.vc02a69c9787f lockable-resources:1185.v0c528656ce04 mailer:463.vedf8358e006b mapdb-api:1.0.9-28.vf251ce40855d matrix-auth:3.2 matrix-project:808.v5a_b5f56d6966 maven-plugin:3.23 metrics:4.2.18-442.v02e107157925 mina-sshd-api-common:2.10.0-69.v28e3e36d18eb mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_ msbuild:1.30 node-iterator-api:49.v58a_8b_35f8363 okhttp-api:4.11.0-157.v6852a_a_fa_ec11 opentelemetry:2.16.0 pam-auth:1.10 parameterized-trigger:2.46 pipeline-build-step:505.v5f0844d8d126 pipeline-github-lib:42.v0739460cda_c4 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:685.v8ee9ed91d574 pipeline-input-step:477.v339683a_8d55e pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2144.v077a_d1928a_40 pipeline-model-definition:2.2144.v077a_d1928a_40 pipeline-model-extensions:2.2144.v077a_d1928a_40 pipeline-rest-api:2.33 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2144.v077a_d1928a_40 pipeline-stage-view:2.33 plain-credentials:143.v1b_df8b_d3b_e48 plugin-util-api:3.3.0 prism-api:1.29.0-7 publish-over:0.22 publish-over-cifs:0.16 pubsub-light:1.17 resource-disposer:0.23 run-condition:1.7 scm-api:676.v886669a_199aa script-security:1275.v23895f409fb_d shelve-project-plugin:3.2 snakeyaml-api:2.2-111.vc6598e30cc65 sse-gateway:1.26 ssh-credentials:308.ve4497b_ccd8f4 ssh-slaves:2.916.vd17b_43357ce4 sshd:3.312.v1c601b_c83b_0e structs:325.vcb_307d2a_2782 subversion:2.17.3 timestamper:1.26 token-macro:384.vf35b_f26814ec trilead-api:2.84.v72119de229b_7 variant:60.v7290fc0eb_b_cd warnings-ng:10.4.0 workflow-aggregator:596.v8c21c963d92d workflow-api:1267.vd9b_a_ddd9eb_47 workflow-basic-steps:1042.ve7b_140c4a_e0c workflow-cps:3787.v8f5dcd14a_fa_c workflow-durable-task-step:1289.v4d3e7b01546b workflow-job:1346.v180a_63f40267 workflow-multibranch:756.v891d88f2cd46 workflow-scm-step:415.v434365564324 workflow-step-api:639.v6eca_cd8c04aa workflow-support:848.v5a_383b_d14921 ws-cleanup:0.45 xcode-plugin:2.0.17-565.v1c48051d46ef xunit:3.1.3

Results:

org.gitlab4j.api.GitLabApiException: authenticity_token not found, aborting!
    at org.gitlab4j.api.utils.AccessTokenUtils.login(AccessTokenUtils.java:616)
    at org.gitlab4j.api.utils.AccessTokenUtils.createPersonalAccessToken(AccessTokenUtils.java:159)
    at io.jenkins.plugins.gitlabserverconfig.servers.helpers.GitLabPersonalAccessTokenCreator.doCreateTokenByCredentials(GitLabPersonalAccessTokenCreator.java:141)
    at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
    at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:397)
    at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:409)
    at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:78)
    at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26)
    at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:207)
    at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:140)
    at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:558)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:59)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
    at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:289)
    at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:59)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:836)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
    at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:475)
    at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
    at org.kohsuke.stapler.Stapler.invoke(Stapler.java:698)
    at org.kohsuke.stapler.Stapler.service(Stapler.java:248)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
    at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
    at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:163)
    at io.jenkins.plugins.opentelemetry.servlet.OpenTelemetryServletFilter._doFilter(OpenTelemetryServletFilter.java:231)
    at io.jenkins.plugins.opentelemetry.servlet.OpenTelemetryServletFilter.doFilter(OpenTelemetryServletFilter.java:57)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160)
    at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:248)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160)
    at jenkins.metrics.impl.MetricsFilter.doFilter(MetricsFilter.java:125)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160)
    at jenkins.util.HttpServletFilter$1.doFilter(HttpServletFilter.java:76)
    at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160)
    at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:166)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
    at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:154)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:94)
    at jenkins.security.AcegiSecurityExceptionFilter.doFilter(AcegiSecurityExceptionFilter.java:52)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
    at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:54)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:110)
    at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:101)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
    at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:97)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:63)
    at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
    at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:111)
    at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:172)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
    at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:53)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
    at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:86)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
    at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
    at jenkins.security.SuspiciousRequestFilter.doFilter(SuspiciousRequestFilter.java:38)
    at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
    at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:549)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
    at org.eclipse.jetty.server.Server.handle(Server.java:563)
    at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)
    at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
    at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272)
    at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:140)
    at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
    at java.base/java.lang.Thread.run(Thread.java:829)
krachynski commented 1 year ago

System log shows the following

Sep 11, 2023 8:17:27 PM WARNING io.jenkins.plugins.gitlabbranchsource.GitLabHookCreator register

Could not manage project hooks for krachynski/temperson on https://gitlab.company.local
org.gitlab4j.api.GitLabApiException: Invalid url given
    at org.gitlab4j.api.AbstractApi.validate(AbstractApi.java:678)
    at org.gitlab4j.api.AbstractApi.post(AbstractApi.java:323)
    at org.gitlab4j.api.ProjectApi.addHook(ProjectApi.java:2194)
    at io.jenkins.plugins.gitlabbranchsource.GitLabHookCreator.createWebHookWhenMissing(GitLabHookCreator.java:231)
    at io.jenkins.plugins.gitlabbranchsource.GitLabHookCreator.register(GitLabHookCreator.java:105)
    at io.jenkins.plugins.gitlabbranchsource.GitLabSCMSource.afterSave(GitLabSCMSource.java:775)
    at jenkins.branch.MultiBranchProject.fireSCMSourceAfterSave(MultiBranchProject.java:932)
    at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.completeNew(OrganizationFolder.java:1473)
    at jenkins.branch.OrganizationFolder$SCMSourceObserverImpl$1.complete(OrganizationFolder.java:1397)
    at jenkins.scm.api.trait.SCMNavigatorRequest.process(SCMNavigatorRequest.java:252)
    at jenkins.scm.api.trait.SCMNavigatorRequest.process(SCMNavigatorRequest.java:202)
    at io.jenkins.plugins.gitlabbranchsource.GitLabSCMNavigator.visitSources(GitLabSCMNavigator.java:305)
    at jenkins.branch.OrganizationFolder.computeChildren(OrganizationFolder.java:535)
    at com.cloudbees.hudson.plugins.folder.computed.ComputedFolder.updateChildren(ComputedFolder.java:269)
    at com.cloudbees.hudson.plugins.folder.computed.FolderComputation.run(FolderComputation.java:167)
    at jenkins.branch.OrganizationFolder$OrganizationScan.run(OrganizationFolder.java:920)
    at hudson.model.ResourceController.execute(ResourceController.java:101)
    at hudson.model.Executor.run(Executor.java:442)
krachynski commented 1 year ago

Further investigation suggests that GitLab might be trying to test the hook out after creation and it's sending a header that doesn't match what the plugin expects or what GitLab has documented.

krachynski commented 1 year ago

Unless there is an actual roundtrip with the system hook, this probably isn't what's causing this exception.

rhit-liub4 commented 8 months ago

Jenkins: 2.440.2
OS: Windows 11
java: 17.0.6

I am not getting the same results over here

Environment Ant Plugin Version497.v94e7d9fffa_b_9 Apache HttpComponents Client 4.x API Plugin Version4.5.14-208.v438351942757 ASM API Plugin Version9.6-3.v2e1fa_b_338cd7 Bootstrap 5 API Plugin Version5.3.3-1 bouncycastle API Plugin Version2.30.1.77-225.v26ea_c9455fd9 Branch API Plugin Version2.1152.v6f101e97dd77 Build Timeout Version1.32 Caffeine API Plugin Version3.1.8-133.v17b_1ff2e0599 Checks API plugin Version2.0.2 commons-lang3 v3.x Jenkins API Plugin Version3.13.0-62.v7d18e55f51e2 commons-text API Plugin Version1.11.0-95.v22a_d30ee5d36 Credentials Binding Plugin Version657.v2b_19db_7d6e6d Credentials Plugin Version1337.v60b_d7b_c7b_c9f Dark Theme Version439.vdef09f81f85e Display URL API Version2.200.vb_9327d658781 Durable Task Plugin Version550.v0930093c4b_a_6 ECharts API Plugin Version5.5.0-1 Email Extension Plugin Version2.105 Folders Plugin Version6.901.vb_4c7a_da_75da_3 Font Awesome API Plugin Version6.5.1-3 Git client plugin Version4.7.0 Git plugin Version5.2.1 GitHub API Plugin Version1.318-461.v7a_c09c9fa_d63 GitHub Branch Source Plugin Version1781.va_153cda_09d1b_ GitHub plugin Version1.38.0 GitLab API Plugin Version5.3.0-91.v1f9a_fda_d654f GitLab Branch Source Plugin Gradle Plugin Version2.10 Gson API Plugin Version2.10.1-15.v0d99f670e0a_7 Handy Uri Templates 2.x API Plugin Version2.1.8-30.v7e777411b_148 Instance Identity Version185.v303dc7c645f9 Ionicons API Version56.v1b_1c8c49374e Jackson 2 API Version2.16.2-378.v7e79818f53ce Jakarta Activation API Version2.1.3-1 Jakarta Mail API Version2.1.3-1 Java JSON Web Token (JJWT) Plugin Version0.11.5-77.v646c772fddb_0 JavaBeans Activation Framework (JAF) API Version1.2.0-6 JavaMail API Version1.6.2-9 JAXB plugin Version2.3.9-1 Jersey 2 API Version2.41-133.va_03323b_a_1396 Joda Time API Plugin Version2.12.7-29.v5a_b_e3a_82269a_ JQuery3 API Plugin Version3.7.1-2 JSON Api Plugin Version20240303-41.v94e11e6de726 JSON Path API Version2.9.0-52.v57de85cc4722 JUnit Plugin Version1259.v65ffcef24a_88 LDAP Version711.vb_d1a_491714dc Mailer Plugin Version472.vf7c289a_4b_420 Matrix Authorization Strategy Plugin Version3.2.2 Matrix Project Plugin Version822.824.v14451b_c0fd42 Mina SSHD API :: Common Version2.12.0-90.v9f7fb_9fa_3d3b_ Mina SSHD API :: Core Version2.12.0-90.v9f7fb_9fa_3d3b_ OkHttp Plugin Version4.11.0-172.vda_da_1feeb_c6e OWASP Markup Formatter Plugin Version162.v0e6ec0fcfcf6 PAM Authentication plugin Version1.10 Pipeline Version596.v8c21c963d92d Pipeline Graph Analysis Plugin Version216.vfd8b_ece330ca_ Pipeline: API Version1291.v51fd2a_625da_7 Pipeline: Basic Steps Version1049.v257a_e6b_30fb_d Pipeline: Build Step Version540.vb_e8849e1a_b_d8 Pipeline: Declarative Version2.2184.v0b_358b_953e69 Pipeline: Declarative Extension Points API Version2.2184.v0b_358b_953e69 Pipeline: GitHub Groovy Libraries Version42.v0739460cda_c4 Pipeline: Groovy Version3883.vb_3ff2a_e3eea_f Pipeline: Groovy Libraries Version704.vc58b_8890a_384 Pipeline: Input Step Version491.vb_07d21da_1a_fb_ Pipeline: Job Version1400.v7fd111b_ec82f Pipeline: Milestone Step Version111.v449306f708b_7 Pipeline: Model API Version2.2184.v0b_358b_953e69 Pipeline: Multibranch Version773.vc4fe1378f1d5 Pipeline: Nodes and Processes Version1331.vc8c2fed35334 Pipeline: REST API Plugin Version2.34 Pipeline: SCM Step Version427.v4ca_6512e7df1 Pipeline: Stage Step Version305.ve96d0205c1c6 Pipeline: Stage Tags Metadata Version2.2184.v0b_358b_953e69 Pipeline: Stage View Plugin Version2.34 Pipeline: Step API Version657.v03b_e8115821b_ Pipeline: Supporting APIs Version865.v43e78cc44e0d Plain Credentials Plugin Version179.vc5cb_98f6db_38 Plugin Utilities API Plugin Version4.1.0 Resource Disposer Plugin Version0.23 SCM API Plugin Version689.v237b_6d3a_ef7f Script Security Plugin Version1326.vdb_c154de8669 SnakeYAML API Plugin Version2.2-111.vc6598e30cc65 SSH Build Agents plugin Version2.948.vb_8050d697fec SSH Credentials Version322.v124df57ed808 Structs Plugin Version337.v1b_04ea_4df7c8 Theme Manager Version215.vc1ff18d67920 Timestamper Version1.26 Token Macro Plugin Version400.v35420b_922dcb_ Trilead API Plugin Version2.142.v748523a_76693 Variant Plugin Version60.v7290fc0eb_b_cd Workspace Cleanup Plugin Version0.45

After further investigation, I agree with krachynski that this may not be a problem stemming from the plugin. It rather may be a problem stemming from GitLab and how it is handling API requests.

I tried to replicate this problem in several ways: with different user logins, on both my local machine and remotely on a server, clearing the cache, etc.

Error I am encountering org.gitlab4j.api.GitLabApiException: Invalid state, aborting! at org.gitlab4j.api.utils.AccessTokenUtils.login(AccessTokenUtils.java:604) at org.gitlab4j.api.utils.AccessTokenUtils.createPersonalAccessToken(AccessTokenUtils.java:159) at io.jenkins.plugins.gitlabserverconfig.servers.helpers.GitLabPersonalAccessTokenCreator.doCreateTokenByCredentials(GitLabPersonalAccessTokenCreator.java:141) at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:732) at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:397) at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:409) at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:78) at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26) at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:207) at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:140) at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:558) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:59) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900) at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:289) at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:59) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:836) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900) at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:475) at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900) at org.kohsuke.stapler.Stapler.invoke(Stapler.java:698) at org.kohsuke.stapler.Stapler.service(Stapler.java:248) at javax.servlet.http.HttpServlet.service(HttpServlet.java:590) at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764) at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:163) at jenkins.util.HttpServletFilter$1.doFilter(HttpServletFilter.java:76) at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:160) at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:166) at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202) at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) at jenkins.ErrorAttributeFilter.doFilter(ErrorAttributeFilter.java:29) at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202) at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:154) at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202) at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:94) at jenkins.security.AcegiSecurityExceptionFilter.doFilter(AcegiSecurityExceptionFilter.java:52) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99) at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:54) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99) at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:110) at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:101) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99) at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:97) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:63) at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99) at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:111) at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:172) at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202) at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:53) at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202) at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:86) at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202) at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30) at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202) at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) at jenkins.security.SuspiciousRequestFilter.doFilter(SuspiciousRequestFilter.java:38) at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202) at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635) at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131) at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:569) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223) at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570) at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221) at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1384) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176) at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484) at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543) at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174) at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1306) at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122) at org.eclipse.jetty.server.Server.handle(Server.java:563) at org.eclipse.jetty.server.HttpChannel$RequestDispatchable.dispatch(HttpChannel.java:1598) at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:753) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:501) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:287) at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314) at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100) at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53) at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:421) at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:390) at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:277) at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:199) at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194) at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149) at java.base/java.lang.Thread.run(Thread.java:833)

Unless someone else is able to replicate this bug and/or believes this bug is not due to GitLab API requests, I recommend we mark the issue as closed.

jmini commented 2 weeks ago

As discussed in https://github.com/gitlab4j/gitlab4j-api/issues/987#issuecomment-2461464718 the GitLab branch source plugin should not try to create the personal access token in Gitlab.

The correct flow is:

The methods in AccessTokenUtils.java should not be used.