Commit Graph

3 Commits

Author SHA1 Message Date
Adam Romanek 23e6f39287 Fix SSH Agent plugin markup for empty list of users
There are cases when you want SSH Agent plugin to just start and stop
an SSH agent during the build, without adding any keys automatically.
One of such cases is when you want to use an SSH key stored on a
SmartCard -like device, such as NitroKey HSM.

So far, when the "users" property was set to an empty list then the
output XML markup didn't contain the <credentialIds/> tag and the plugin
was then crashing with NullPointerException.

Also, when the "users" property was set to a list with just one value
then the output XML markup was always generated in the "old style"
format (matching plugin versions < 1.5, so like almost 8 years old).

With this change, when using the "users" property the markup is
generated based on the actual plugin version installed in Jenkins. More
importantly, the generated markup is now properly handled by the plugin,
no matter if the input is an empty list or a list with one or more
entries.

Finally, fixed the parent of the <ignoreMissing> tag, which was wrongly
put under <credentialIds> tag when generating the "new style" markup
(1.5+), while it should simply be a top-level tag, laying next to
<credentialIds>, as in the corresponding implementation class [1].
This means the "ignore-missing-credentials" property was broken when the
"users" property was set to a list with more than one entry and it's now
fixed.

[1] https://github.com/jenkinsci/ssh-agent-plugin/blob/ssh-agent-1.5/src/main/java/com/cloudbees/jenkins/plugins/sshagent/SSHAgentBuildWrapper.java#L83

Change-Id: Ife5a08739da9ea1130f0ea7daa08c16675f6c75d
2022-02-13 17:47:39 +01:00
tanhengyeow fada164a7d ssh-agent-credentials: Support ignore-missing-credentials param
Change-Id: I5f78648600ef045dfe539a950daae14b304a74d9
Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
2018-07-29 17:10:14 +08:00
Max Rasskazov 68c9cabeb6 Add support of multiple credentials for ssh-agent-credentials wrapper
ssh-agent-credentials wrapper supports multiple credentials like
ssh-agent plugin v1.5
(https://wiki.jenkins-ci.org/display/JENKINS/SSH+Agent+Plugin)
via 'users' parameter. 'user' parameter is retained for backward
compatibility.

Change-Id: I8a21dd0e7cba210818ffe30bbc5c7e73b56211cb
Signed-off-by: Igor Gnatenko <ignatenko@mirantis.com>
2015-03-17 11:45:37 +00:00