最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jenkins - In a Jenkinsfile, what are all the types that can be used with `withCredentials` - Stack Overflow

programmeradmin0浏览0评论

In a jenkinsfile, the "Credentials Binding" plugin can be used with withCredentials.

Example:

withCredentials([usernamePassword(etc)]) { ... }

What are all the credential types that can be used with withCredentials, what are their keywords and parameters, and how do they appear in the Jenkins server "credentials" GUI?

In a jenkinsfile, the "Credentials Binding" plugin can be used with withCredentials.

Example:

withCredentials([usernamePassword(etc)]) { ... }

What are all the credential types that can be used with withCredentials, what are their keywords and parameters, and how do they appear in the Jenkins server "credentials" GUI?

Share Improve this question asked Feb 3 at 21:30 cowlinatorcowlinator 8,8337 gold badges55 silver badges69 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Plugins can add their own credential types, but these are the most commonly used built-in credential types (as of Jenkins 2.452.1):

usernamePassword(               // "Username and Password" in the GUI
    credentialsId: 'cred',
    usernameVariable: 'user',
    passwordVariable: 'pass')

sshUserPrivateKey(              // "Username with private key" in the GUI
    credentialsId: 'cred',
    keyFileVariable: 'keyFilepath',
    usernameVariable: 'user',   // optional
    passphraseVariable: 'pass') // optional

string(                         // "Secret text" in the GUI
    credentialsId: 'cred',
    variable: 'str')

file(                           // "Secret file" in the GUI
    credentialsId: 'cred',
    variable: 'filePath')

certificate(                    // "Certificate" in the GUI, for PKCS#12 certificates
    credentialsId: 'cred',
    keystoreVariable: 'keystore',
    aliasVariable: 'alias',     // optional
    passwordVariable: 'pass')   // optional

You can find many more types in the documentation for the credentials binding plugin, but many of those listed do not seem to (by default) have any way of creating that type of credential via the GUI. It may be that they require plugins.

发布评论

评论列表(0)

  1. 暂无评论