Jenkins Credentials Store Access via Groovy

后端 未结 3 819
长情又很酷
长情又很酷 2021-01-31 09:35

I have found a way to access the credentials store in Jenkins:

def getPassword = { username ->
    def creds = com.cloudbees.plugins.credentials.CredentialsPr         


        
3条回答
  •  不要未来只要你来
    2021-01-31 10:17

    The official solution n the jenkins wiki

    Printing a list of all the credentials in the system and their IDs.

    def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
            com.cloudbees.plugins.credentials.Credentials.class,
            Jenkins.instance,
            null,
            null
    );
    for (c in creds) {
        println(c.id + ": " + c.description)
    }
    

提交回复
热议问题