Last active
September 5, 2022 15:42
-
-
Save alkuzad/225ecee24b63f852f49a150d1e649c87 to your computer and use it in GitHub Desktop.
This file contains 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.* | |
import org.apache.commons.io.IOUtils | |
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 == "some-uuid-like-d0c63045-3999-43d1-80b4-17b361412500"){ | |
// For SecretFile | |
println(IOUtils.toString(creds.getContent(), "UTF-8")) | |
// For Username / Password | |
// println(creds.username) | |
// println(creds.password) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment