org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: Credentials 'mySSHkey' is of type 'SSH Username with private key' where 'com.cloudbees.plugins.credentials.common.StandardCertificateCredentials' was expected
The error message tells you that Binding implementation that you have chosen, i.e., `CertificateMultiBinding`, is expecting the credential of type `StandardCertificateCredentials`, but you have supplied a credential of type 'SSH Username with private key'.
Have you used Snippet Generator to get this pipeline code? If yes, then there might be a defect please raise it appropriately. If not, please use Snippet Generator to get the correct code.
I didn't use the Snippet Generator because there is not such "snippet". So I tried to figure out how could be with using the post's examples but with a sshUserPrivateKey type.
we use withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: '<CREDENTIAL_ID>', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']])
but it fails when we use a credential configured on folder level instead of global scope.
Found issue:
Credential will be found, but the variable USERNAME contains the CREDENTIAL_ID instead of the username. The same credential configure globally works.
Comments
7 comments
How can i get User-Scoped Credentials (Personal Credentials) ?
How can I get the username from a SSH Username with private key type credential? I was trying this:
node {
key = 'mySSHkey'
stage('Test') {
withCredentials([[$class: 'CertificateMultiBinding', credentialsId: key,
keystoreVariable: 'keystore', aliasVariable: 'alias',
passwordVariable: 'pass']]) {
sh 'echo uname=$keystore alias=$alias pwd=$pass'
}
}
}
Jenkins complains with
Can you guide me about this?
The error message tells you that Binding implementation that you have chosen, i.e., `CertificateMultiBinding`, is expecting the credential of type `StandardCertificateCredentials`, but you have supplied a credential of type 'SSH Username with private key'.
Have you used Snippet Generator to get this pipeline code? If yes, then there might be a defect please raise it appropriately. If not, please use Snippet Generator to get the correct code.
I didn't use the Snippet Generator because there is not such "snippet". So I tried to figure out how could be with using the post's examples but with a sshUserPrivateKey type.
I've found this pull request on Credentials Binding plugin https://github.com/jenkinsci/credentials-binding-plugin/pull/18 and I think is not public available yet or something I'm not catching.
Hi Salvador,
As far as I can see from the Github changelog the feature was released in version 1.13
@Salvador - Where you able to fix this issue? Facing the same problem.
hi,
we use withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: '<CREDENTIAL_ID>', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']])
but it fails when we use a credential configured on folder level instead of global scope.
Found issue:
Credential will be found, but the variable USERNAME contains the CREDENTIAL_ID instead of the username. The same credential configure globally works.
How can I solve this?
Please sign in to leave a comment.