-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
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.