[JIRA] (JENKINS-48552) Please add possibility to get token from gitlab API token

2 views
Skip to first unread message

pteichner@googlemail.com (JIRA)

unread,
Feb 5, 2019, 6:01:01 AM2/5/19
to jenkinsc...@googlegroups.com
Peter Teichner commented on New Feature JENKINS-48552
 
Re: Please add possibility to get token from gitlab API token

I would also need this please - can this be upvoted somewhere?

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

Alexei.Moussatov@gmail.com (JIRA)

unread,
Apr 9, 2019, 9:38:04 AM4/9/19
to jenkinsc...@googlegroups.com

workarround

import com.cloudbees.plugins.credentials.CredentialsProviderdef credsList = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
        com.cloudbees.plugins.credentials.Credentials.class,Jenkins.instance,null,null);
def creds = credsList.findResult { it.id == "<YOUR-CREDS-ID>" ? it : null }
println("apiToken: ${creds.apiToken}")

where <YOUR-CREDS-ID> - creds id in Jenkins

kshettihewa@gmail.com (JIRA)

unread,
Aug 16, 2019, 2:48:02 AM8/16/19
to jenkinsc...@googlegroups.com
hhkkss commented on New Feature JENKINS-48552

Is there any other solution other than this workaround?

aburdajewicz@cloudbees.com (JIRA)

unread,
Sep 29, 2019, 8:08:02 PM9/29/19
to jenkinsc...@googlegroups.com

GitLab API Token is exactly a StringCredentials and should have been implemented as such. The GitLab plugin could instead accept String Credentials and an alias could be created for backward compatibility, see for example https://github.com/jenkinsci/kubernetes-plugin/blob/kubernetes-1.19.2/src/main/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesCloud.java#L719-L726.

This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages