Created
August 31, 2021 00:02
-
-
Save felixguerrero12/b9c682552dad847d0826559c0a0d64c7 to your computer and use it in GitHub Desktop.
jenkins-credentials-extract
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
| def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials( | |
| com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class, | |
| Jenkins.instance, | |
| null, | |
| null | |
| ) | |
| for(c in creds) { | |
| if(c instanceof com.cloudbees.jenkins.plugins.sshcredentials.impl.BasicSSHUserPrivateKey){ | |
| println(String.format("id=%s desc=%s key=%s\n", c.id, c.description, c.privateKeySource.getPrivateKeys())) | |
| } | |
| if (c instanceof com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl){ | |
| println(String.format("id=%s desc=%s user=%s pass=%s\n", c.id, c.description, c.username, c.password)) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment