[JIRA] (JENKINS-55552) NullPointerException when using Credentials Binding Plugin
Title: Message Title tony kerz commented on JENKINS-2 Re: NullPointerException when using Credentials Binding Plugin thanks p cowlinator you are the man! i burned a few hours on this until i came across your post! i'll have to second the vote to not crash hard when one of the args isn't passed Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-55552) NullPointerException when using Credentials Binding Plugin
Title: Message Title p cowlinator updated an issue Jenkins / JENKINS-2 NullPointerException when using Credentials Binding Plugin Change By: p cowlinator A NullPointerException with no stacktrace is experienced when trying to run the following pipeline:{code:java}pipeline {agent anystages {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' }}}}}{code}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. Add Comment
[JIRA] (JENKINS-55552) NullPointerException when using Credentials Binding Plugin
Title: Message Title p cowlinator updated an issue Jenkins / JENKINS-2 NullPointerException when using Credentials Binding Plugin Change By: p cowlinator Priority: Major Minor Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-55552) NullPointerException when using Credentials Binding Plugin
Title: Message Title p cowlinator commented on JENKINS-2 Re: NullPointerException when using Credentials Binding Plugin I have found a resolution for this issue. By including the "usernameVariable" argument, the null reference exception goes away: withCredentials([usernamePassword(credentialsId: 'mysecret', passwordVariable: 'SECRET2', usernameVariable: 'USELESS')]) { Please no longer require arguments that may not be useful to the user; or, document that all arguments are required and print a more helpful error when they are not provided. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-55552) NullPointerException when using Credentials Binding Plugin
Title: Message Title p cowlinator created an issue Jenkins / JENKINS-2 NullPointerException when using Credentials Binding Plugin Issue Type: Bug Assignee: Unassigned Components: credentials-binding-plugin Created: 2019-01-11 23:33 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. Priority: Major Reporter: p cowlinator 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