I'm trying to get Jenkins to clone my BitBucket Mercurial project. It won't, because it talks about a credential issue - well, a bitbucket refuses everything that Jenkins provides.
I am almost 100% sure that Jenkins does not provide what it should provide, because when I run
hg clone --ssh="ssh -i /path/to/my/key" ssh://hg@bitbucket.org/my-org/my-repo
He clones a-OK. Content /path/to/my/keyis what I put in the key in the Jenkins credential manager. I checked that it was found in my jenkins file credentials.xml.
And yet, when am I trying to do my job? Cloning fails because
remote: Host key verification failed.
This makes me think that the problem is with what goes through the mercury plugin. But I do not see it in the log, because it is a kind of masked string and just displays as ******.
So I wanted to make sure that the credentials that go into the Hg plugin are actually what is in my file credentials.xml.
So far I have done it here:
import com.cloudbees.plugins.credentials.CredentialsProvider
import com.cloudbees.plugins.credentials.common.StandardUsernameCredentials
def creds = CredentialsProvider.all()
print creds
Which gives me a list of credential providers ... but I'm not sure where to go next. I was drowning in the documentation, trying to figure out how to get the accessible credentials that I want ... but not a cube.
(How) can I take what I have and display a list of my Jenkins credentials in the Groovy script console?