jenkins-job-builder/tests/wrappers/fixtures/credentials-binding-ssh-minimal.xml
Ken Dreyer 787164e09a wrappers: omit blank settings for ssh-user-private-key credential
For the ssh-user-private-key credential-wrapper, the "key-file-variable"
setting is mandatory, but the "username-variable" and
"passphrase-variable" settings are optional.

Prior to this commit, if a user omitted "username-variable" or
"passphrase-variable" settings, JJB would write empty
<usernameVariable/> or <passphraseVariable/> entries. When both were
empty, the credentials-binding plugin would crash with an error:

  IllegalArgumentException("Cannot use the same key in both secretValues and publicValues")

To resolve this, do not write XML entries for these optional parameters
when the user does not specify them.

Add a minimal test case reproducer.

Change-Id: I94a4437eee6a8fdaf655c1a3bf69d46844b225bc
2022-06-09 16:37:50 -04:00

14 lines
579 B
XML

<?xml version="1.0" encoding="utf-8"?>
<project>
<buildWrappers>
<org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper>
<bindings>
<org.jenkinsci.plugins.credentialsbinding.impl.SSHUserPrivateKeyBinding>
<keyFileVariable>KEY_FILE_VARIABLE</keyFileVariable>
<credentialsId>34eb8759-264e-4265-90f0-cb252ab1d2bf</credentialsId>
</org.jenkinsci.plugins.credentialsbinding.impl.SSHUserPrivateKeyBinding>
</bindings>
</org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper>
</buildWrappers>
</project>