Skip to content

Instantly share code, notes, and snippets.

View renan-alm's full-sized avatar

Renan Alm renan-alm

View GitHub Profile
@renan-alm
renan-alm / get-jenkins-creds.groovy
Last active August 19, 2024 06:20
Gist to get all credentials from a Jenkins instance
// Source: https://stackoverflow.com/questions/34795050/how-do-i-list-all-of-my-jenkins-credentials-in-the-script-console
// To be used at a jenkins_instance_url/script, example https://jenkins.corp.net/script
import java.nio.charset.StandardCharsets;
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
com.cloudbees.plugins.credentials.Credentials.class
)
for (c in creds) {
println(c.id)