Skip to content

Instantly share code, notes, and snippets.

@budgester
Created March 16, 2020 10:28
Show Gist options
  • Save budgester/c93d7836228169bf0447434468c5e9ee to your computer and use it in GitHub Desktop.
Save budgester/c93d7836228169bf0447434468c5e9ee to your computer and use it in GitHub Desktop.
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class,
Jenkins.instance,
null,
null
);
for (c in creds) {
println( ( c.properties.privateKeySource ? "ID: " + c.id + ", UserName: " + c.username + ", Private Key: " + c.getPrivateKey() : ""))
}
for (c in creds) {
println( ( c.properties.password ? "ID: " + c.id + ", UserName: " + c.username + ", Password: " + c.password : ""))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment