-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor
-
Component/s: credentials-binding-plugin
-
None
-
Environment:Jenkins server: runs on jenkins/jenkins:lts docker image (image id: 5907903170ad), with Jenkins version 2.150.1.
Credentials-binding-plugin version: 1.17.
Agent: runs on the server node.
A NullPointerException with no stacktrace is experienced when trying to run the following pipeline:
pipeline {
agent any
stages {
stage('stage usernameColonPassword') {
steps {
sh 'echo usernameColonPassword 1'
withCredentials([usernameColonPassword(credentialsId: 'mysecret', variable: 'SECRET')]) {
sh 'echo usernameColonPassword 2'
}
}
}
stage('stage usernamePassword') {
steps {
sh 'echo usernamePassword 3'
withCredentials([usernamePassword(credentialsId: 'mysecret', passwordVariable: 'SECRET2')]) {
sh 'echo usernamePassword 4'
}
}
}
}
}
where "mysecret" is a credential with it's "kind" being "username and password".
This exception causes the job to fail.
Â
Specifically, `usernameColonPassword` succeeds, while `usernamePassword` fails; `usernamePassword 4` is never printed to the log.
Â
This was the first time I have tried to run this script, so I have never observed this succeeding; for all I know, it has always failed.
Â
My workaround options are bad:Â either parse the password out of the `user:pass` format, or abandon the plugin.
Â
UPDATE: as mentioned in the comments, there is a better workaround. This ticket is now for removing or documenting the requirement for all arguments to be used, and creating a useful error message.