Skip to content

Instantly share code, notes, and snippets.

@pjdarton
pjdarton / listJenkinsCredentials.groovy
Created December 19, 2019 12:10
Lists all Jenkins credentials. Requires admin access to Jenkins.
import com.cloudbees.hudson.plugins.folder.Folder
import com.cloudbees.jenkins.plugins.sshcredentials.SSHUserPrivateKey
import com.cloudbees.plugins.credentials.Credentials
import com.cloudbees.plugins.credentials.CredentialsProvider
import com.cloudbees.plugins.credentials.common.PasswordCredentials
import com.cloudbees.plugins.credentials.common.UsernameCredentials
import jenkins.plugins.openstack.compute.auth.OpenstackCredentialv3
import org.jenkinsci.plugins.plaincredentials.StringCredentials
Set<Credentials> getAllCredentials() {