jenkinsci/gitlab-plugin

Upgrading 1.1.32 to 1.4.3 causes credential errors

drewwells opened this issue · 8 comments

Before submitting an issue to I have first:

  • read the documentation on the homepage
  • searched for similar already existing issue

(if you have performed all the above, remove the paragraph and continue describing the issue with template below)

Issue

Context

  • Gitlab plugin version: 1.4.3
  • Gitlab version: 8.12.6
  • Jenkins version: 1.642.1
  • Job type: Pipeline, Freestyle, Matrix, etc.
    Freestyle

Logs & Traces

Please include any relevant log that could serve to better understand the source of your issue
For Jenkins Gitlab Plugin logs, follow instruction in User Support section.
For Gitlab logs, ask an administrator to provide you the relevant Gitlab logs.

This is the build log. I will report back with the plugin log when there's time to bring down our build process. It seems to be a credential change, perhaps related to environment variable changes? It's not clear what needs to change for this piece in the readme.

Checking out Revision a49e32c42f555d836bfc5095ea3b68785cc9f46b (origin/feature/statusIndexer)
 > /usr/dev_infra/platform/bin/git config core.sparsecheckout # timeout=10
 > /usr/dev_infra/platform/bin/git checkout -f a49e32c42f555d836bfc5095ea3b68785cc9f46b
 > /usr/dev_infra/platform/bin/git rev-list a49e32c42f555d836bfc5095ea3b68785cc9f46b # timeout=10
FATAL: null
java.lang.NullPointerException
	at com.cloudbees.plugins.credentials.matchers.IdMatcher.<init>(IdMatcher.java:56)
	at com.cloudbees.plugins.credentials.CredentialsMatchers.withId(CredentialsMatchers.java:132)
	at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.getApiToken(GitLabClientBuilder.java:124)
	at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.buildClient(GitLabClientBuilder.java:91)
	at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.buildClient(GitLabClientBuilder.java:101)
	at com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig.getClient(GitLabConnectionConfig.java:77)
	at com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty.getClient(GitLabConnectionProperty.java:35)
	at com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty.getClient(GitLabConnectionProperty.java:43)
	at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.updateCommitStatus(CommitStatusUpdater.java:35)
	at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.prebuild(GitLabCommitStatusPublisher.java:42)
	at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:837)
	at hudson.model.AbstractBuild$AbstractBuildExecution.preBuild(AbstractBuild.java:832)
	at hudson.model.Build$BuildExecution.doRun(Build.java:144)
	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
	at hudson.model.Run.execute(Run.java:1738)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:410)
An attempt to send an e-mail to empty list of recipients, ignored.
ERROR: Build step failed with exception
java.lang.NullPointerException
	at com.cloudbees.plugins.credentials.matchers.IdMatcher.<init>(IdMatcher.java:56)
	at com.cloudbees.plugins.credentials.CredentialsMatchers.withId(CredentialsMatchers.java:132)
	at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.getApiToken(GitLabClientBuilder.java:124)
	at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.buildClient(GitLabClientBuilder.java:91)
	at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.buildClient(GitLabClientBuilder.java:101)
	at com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig.getClient(GitLabConnectionConfig.java:77)
	at com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty.getClient(GitLabConnectionProperty.java:35)
	at com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty.getClient(GitLabConnectionProperty.java:43)
	at com.dabsquared.gitlabjenkins.publisher.MergeRequestNotifier.perform(MergeRequestNotifier.java:27)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
	at hudson.model.Build$BuildExecution.post2(Build.java:185)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
	at hudson.model.Run.execute(Run.java:1763)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:410)
Build step 'Add note with build status on GitLab merge requests' marked build as failure
ERROR: Build step failed with exception
java.lang.NullPointerException
	at com.cloudbees.plugins.credentials.matchers.IdMatcher.<init>(IdMatcher.java:56)
	at com.cloudbees.plugins.credentials.CredentialsMatchers.withId(CredentialsMatchers.java:132)
	at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.getApiToken(GitLabClientBuilder.java:124)
	at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.buildClient(GitLabClientBuilder.java:91)
	at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.buildClient(GitLabClientBuilder.java:101)
	at com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig.getClient(GitLabConnectionConfig.java:77)
	at com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty.getClient(GitLabConnectionProperty.java:35)
	at com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty.getClient(GitLabConnectionProperty.java:43)
	at com.dabsquared.gitlabjenkins.publisher.MergeRequestNotifier.perform(MergeRequestNotifier.java:27)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
	at hudson.model.Build$BuildExecution.post2(Build.java:185)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
	at hudson.model.Run.execute(Run.java:1763)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:410)
Build step 'Add vote for build status on GitLab merge requests' marked build as failure
ERROR: Build step failed with exception
java.lang.NullPointerException
	at com.cloudbees.plugins.credentials.matchers.IdMatcher.<init>(IdMatcher.java:56)
	at com.cloudbees.plugins.credentials.CredentialsMatchers.withId(CredentialsMatchers.java:132)
	at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.getApiToken(GitLabClientBuilder.java:124)
	at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.buildClient(GitLabClientBuilder.java:91)
	at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.buildClient(GitLabClientBuilder.java:101)
	at com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig.getClient(GitLabConnectionConfig.java:77)
	at com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty.getClient(GitLabConnectionProperty.java:35)
	at com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty.getClient(GitLabConnectionProperty.java:43)
	at com.dabsquared.gitlabjenkins.util.CommitStatusUpdater.updateCommitStatus(CommitStatusUpdater.java:35)
	at com.dabsquared.gitlabjenkins.publisher.GitLabCommitStatusPublisher.perform(GitLabCommitStatusPublisher.java:54)
	at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
	at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
	at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
	at hudson.model.Build$BuildExecution.post2(Build.java:185)
	at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:668)
	at hudson.model.Run.execute(Run.java:1763)
	at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
	at hudson.model.ResourceController.execute(ResourceController.java:98)
	at hudson.model.Executor.run(Executor.java:410)
Build step 'Publish build status to GitLab commit (GitLab 8.1+ required)' marked build as failure

Problem description

Describe your problem in a meaningful way:

  • what were you doing (simple push, merge request, MR with fork, ...)
  • what was expected
  • what occured finally

I'm not too surprised that making a version jump that large caused an issue. I would suggest trying to upgrade in smaller increments, by manually downloading and installing the plugin hpi files from the archive: http://updates.jenkins-ci.org/download/plugins/gitlab-plugin/ If you look at the plugin Changelog you can see which versions made changes to the credentials handling. I would try upgrading to those, then configure credentials as needed, and then upgrade again.

Specifically, this is going to be a question of needing a GitLab API credential to be stored in Jenkins (unrelated to the credentials needed to clone a repo), so that Jenkins can push build status to GitLab.

Upgraded to 1.2.0 and that went fine. The upgrade wiped the Gitlab token from configuration for some reason, so be sure to record that before performing the upgrade.

Thanks, so were you able to upgrade to the latest cleanly after going to 1.2.0? I want to update the documentation accordingly.

Just took it to 1.2.0, I'm working on 1.3.2 now.

Can you report back here on how it goes? I think it may be possible to go from 1.2 to the latest in one step, now that you are using the new credential storage stuff.

Upgrading to 1.2.0 didn't switch over to a newer credential management. But going 1.2.0 -> 1.4.3 did. Trying to figure out how to add my auth token now...

No issues after following the instructions here: https://github.com/jenkinsci/gitlab-plugin#configuring-access-to-gitlab.

Thanks for the great work!

Thanks, I updated the README accordingly with a note in the Known Issues section.