[Credentials Binding Plugin] How to specify the domain in withCredentials?

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[Credentials Binding Plugin] How to specify the domain in withCredentials?

Yuri Govorushchenko

I put credentials with same ids into different domains and thus need a way to specify the domain name on invoking `withCredentials` step in my script pipeline. Is it possible?
As a workaround currently I have to find the creds manually, but this approach lacks the password masking provided by the plugin:

def fetchCred(String domainName, String id) {
def credentialsStore = Jenkins.instance.getExtensionList('com.cloudbees.plugins.credentials.SystemCredentialsProvider')[0].getStore()
def domain = new Domain(domainName, null, null)
def creds = credentialsStore.getCredentials(domain)
def cred = creds.find { it.id == id }
assert (cred != null)


You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/593f9611-118d-412e-9fc9-018db9b47e19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.