Created
July 19, 2021 11:16
-
-
Save anton-yurchenko/18d631e6605b7d3c1b658db52c96df3a to your computer and use it in GitHub Desktop.
Jenkins Console Groovy Script to Print Credentials username/password
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jenkins.* | |
import jenkins.model.* | |
import hudson.* | |
import hudson.model.* | |
def jenkinsCredentials = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials( | |
com.cloudbees.plugins.credentials.Credentials.class, | |
Jenkins.instance, | |
null, | |
null | |
); | |
for (creds in jenkinsCredentials) { | |
if(creds.id == "<credentials-name>"){ | |
println(creds.username) | |
println(creds.password) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment