Merge "wrappers: omit blank settings for ssh-user-private-key credential"

This commit is contained in:
Zuul 2022-07-15 20:06:07 +00:00 committed by Gerrit Code Review
commit a191e0b174
3 changed files with 23 additions and 5 deletions

View File

@ -2207,11 +2207,11 @@ def credentials_binding(registry, xml_parent, data):
binding_xml, params, mapping, fail_required=True
)
elif binding_type == "ssh-user-private-key":
mapping = [
("key-file-variable", "keyFileVariable", None),
("username-variable", "usernameVariable", ""),
("passphrase-variable", "passphraseVariable", ""),
]
mapping = [("key-file-variable", "keyFileVariable", None)]
if "username-variable" in params:
mapping.append(("username-variable", "usernameVariable", None))
if "passphrase-variable" in params:
mapping.append(("passphrase-variable", "passphraseVariable", None))
helpers.convert_mapping_to_xml(
binding_xml, params, mapping, fail_required=True
)

View File

@ -0,0 +1,13 @@
<?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>

View File

@ -0,0 +1,5 @@
wrappers:
- credentials-binding:
- ssh-user-private-key:
credential-id: 34eb8759-264e-4265-90f0-cb252ab1d2bf
key-file-variable: KEY_FILE_VARIABLE