jenkins gitlab plugin - credentials problems

2,352 views
Skip to first unread message

jo...@norricorp.f9.co.uk

unread,
Jan 3, 2017, 4:23:34 AM1/3/17
to Jenkins Users
Hi,
I set up various Jenkins jobs using the gitlab plugin several months ago and it worked. It was using previous versions. Both gitlab and Jenkins running on Mint 17.3 and both have been updated over the months. So that I now have
Gitlab plugin version: 1.4.3
  • Gitlab version: 8.15.2
  • Jenkins version: 2.38
  • Job type: Maven
    Then setup got put aside. Now returned to it to find that the Jenkins jobs were no longer running. Configure showed an error in Git/ Source code management section of

Failed to connect to repository : Command "git ls-remote -h git@mint-gitlab:norricorp/groovytest.git HEAD" returned status code 128:
stdout:
stderr: Permission denied, please try again.
Permission denied, please try again.
Permission denied (publickey,password).
fatal: Could not read from remote repository.
 Please make sure you have the correct access rights and the repository exists.

So I deleted the credentials in jenkins, created a new gitlab access token api key for a user called jenkins who had developer rights for the gitlab project and created a new credential in Jenkins. Error now gone.


But when I run the job, I get the error above in the console output.


Checking out Revision 78e2f92f3cc5dc9a43c42b0e76402d6d724be8e4 (refs/remotes/origin/master)

git config core.sparsecheckout # timeout=10
git checkout -f 78e2f92f3cc5dc9a43c42b0e76402d6d724be8e4
git rev-list 3abff1d1f38ce409f468f01a337bc3a7c3e43cd3 # timeout=10
ERROR: Processing failed due to a bug in the code. Please report this to jenkins...@googlegroups.com
java.lang.IllegalStateException: No credentials found for credentialsId: 1909e700-c4e3-4cac-a2ff-987b8990bb6c
at com.dabsquared.gitlabjenkins.gitlab.GitLabClientBuilder.getApiToken(GitLabClientBuilder.java:133)



I also tried creating a new job and get the following error.
javax.servlet.ServletException: java.lang.Error: org.gitlab.api.GitlabAPIException: {"message":"401 Unauthorized"}


So generally very confused about what is going on. In previous versions of jenkins and the gitlab plugin the Jenkins user can access Gitlab. Now the build is obviously getting through to git but not gitlab. Can someone please help?
Regards,
John

Mark Waite

unread,
Jan 3, 2017, 7:00:30 AM1/3/17
to Jenkins Users

There may be an additional location where you need to configure the gitlab api token. Look at the system configuration page to see if you can find an api token setting.

If that search doesn't find it, then you might try a recursive search through your Jenkins home directory looking for that credentials I'd. When you find the file, it's location in the directory structure will suggest where to look in the UI.

Mark Waite


--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/47af03a9-9aa5-44a7-bb25-f386abe62ffa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

jo...@norricorp.f9.co.uk

unread,
Jan 3, 2017, 10:24:20 AM1/3/17
to Jenkins Users
Hi Mark,
 I searched through /var/lib/Jenkins on the server.
The credentialsID is in com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig.xml so I have no idea where that might correspond to something in Jenkins.
The thing that most concerns me here is that it did work and was relatively easy to set up and now, after several Jenkins and plugin and gitlab upgrades, it does not work. And seems now to be very complicated. For instance, on build triggers for a job, (Build when a change is pushed to GitLab - advanced) I generated a secret key but did not want it so used previous page to back out. Agreed to leave page and yet the secret key is now there and saved.
The gitlab plugin seems to have taken steps backwards.

I also wonder if the instructions are keeping pace with changes?

John

jo...@norricorp.f9.co.uk

unread,
Jan 3, 2017, 12:04:01 PM1/3/17
to Jenkins Users
So this is what I did.
I had created credentials but let Jenkins create the ID. What I should have done is to use 1909e700-c4e3-4cac-a2ff-987b8990bb6c as the ID.
This is the value in the console log. It is also in com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig.xml.

Then run build and worked.

I am guessing I could also have taken the generated ID and changed com.dabsquared.gitlabjenkins.connection.GitLabConnectionConfig.xml.


Reply all
Reply to author
Forward
0 new messages