Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save anton-yurchenko/18d631e6605b7d3c1b658db52c96df3a to your computer and use it in GitHub Desktop.
Save anton-yurchenko/18d631e6605b7d3c1b658db52c96df3a to your computer and use it in GitHub Desktop.
Jenkins Console Groovy Script to Print Credentials username/password
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