credentials-binding: Add support for more options
Change-Id: I0d193dbab5967b362d92bde58c5a43bacac86bd2 Signed-off-by: Tan Heng Yeow <E0032242@u.nus.edu>
This commit is contained in:
parent
376dab1e52
commit
d30af4616a
@ -1856,6 +1856,24 @@ def credentials_binding(registry, xml_parent, data):
|
||||
* **secret-key** (`str`) Environment variable for the
|
||||
access secret key (Required for binding-type
|
||||
amazon-web-services)
|
||||
* **key-file-variable** (`str`) Environment variable
|
||||
to be set to the temporary path of the SSH key
|
||||
file during the build.
|
||||
* **username-variable** (`str`) Environment variable
|
||||
to be set to the username during
|
||||
the build. (optional)
|
||||
* **passphrase-variable** (`str`) Environment
|
||||
variable to be set to the password
|
||||
during the build. (optional)
|
||||
* **keystore-variable** (`str`) Environment
|
||||
variable to be set to the temporary
|
||||
keystore location during the build.
|
||||
* **password-variable** (`str`) Environment
|
||||
variable to be set to the password
|
||||
during the build.
|
||||
* **alias-variable** (`str`) Environment variable
|
||||
to be set to the keystore alias name
|
||||
of the certificate during the build.
|
||||
|
||||
Example:
|
||||
|
||||
@ -1887,7 +1905,16 @@ def credentials_binding(registry, xml_parent, data):
|
||||
'text': 'org.jenkinsci.plugins.credentialsbinding.impl.StringBinding',
|
||||
'amazon-web-services':
|
||||
'com.cloudbees.jenkins.plugins.awscredentials'
|
||||
'.AmazonWebServicesCredentialsBinding'
|
||||
'.AmazonWebServicesCredentialsBinding',
|
||||
'ssh-user-private-key':
|
||||
'org.jenkinsci.plugins.credentialsbinding'
|
||||
'.impl.SSHUserPrivateKeyBinding',
|
||||
'docker-server-creds-binding':
|
||||
'org.jenkinsci.plugins.docker.commons'
|
||||
'.credentials.DockerServerCredentialsBinding',
|
||||
'cert-multi-binding':
|
||||
'org.jenkinsci.plugins.credentialsbinding'
|
||||
'.impl.CertificateMultiBinding'
|
||||
}
|
||||
for binding in data:
|
||||
for binding_type, params in binding.items():
|
||||
@ -1911,6 +1938,22 @@ def credentials_binding(registry, xml_parent, data):
|
||||
]
|
||||
helpers.convert_mapping_to_xml(
|
||||
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', ''),
|
||||
]
|
||||
helpers.convert_mapping_to_xml(
|
||||
binding_xml, params, mapping, fail_required=True)
|
||||
elif binding_type == 'cert-multi-binding':
|
||||
mapping = [
|
||||
('keystore-variable', 'keystoreVariable', None),
|
||||
('password-variable', 'passwordVariable', None),
|
||||
('alias-variable', 'aliasVariable', None),
|
||||
]
|
||||
helpers.convert_mapping_to_xml(
|
||||
binding_xml, params, mapping, fail_required=True)
|
||||
else:
|
||||
mapping = [
|
||||
('variable', 'variable', None),
|
||||
|
@ -19,16 +19,32 @@
|
||||
<variable>config_text</variable>
|
||||
<credentialsId>b3e6f337-5d44-4f57-921c-1632d796caad</credentialsId>
|
||||
</org.jenkinsci.plugins.credentialsbinding.impl.StringBinding>
|
||||
<org.jenkinsci.plugins.docker.commons.credentials.DockerServerCredentialsBinding>
|
||||
<variable>config_docker_server</variable>
|
||||
<credentialsId>b3e6f337-5d44-4f57-921c-1632d796caae</credentialsId>
|
||||
</org.jenkinsci.plugins.docker.commons.credentials.DockerServerCredentialsBinding>
|
||||
<org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding>
|
||||
<usernameVariable>myUsername</usernameVariable>
|
||||
<passwordVariable>myPassword</passwordVariable>
|
||||
<credentialsId>b3e6f337-5d44-4f57-921c-1632d796caae</credentialsId>
|
||||
<credentialsId>b3e6f337-5d44-4f57-921c-1632d796caag</credentialsId>
|
||||
</org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding>
|
||||
<com.cloudbees.jenkins.plugins.awscredentials.AmazonWebServicesCredentialsBinding>
|
||||
<accessKeyVariable>AWS_ACCESS_KEY_ID</accessKeyVariable>
|
||||
<secretKeyVariable>AWS_SECRET_ACCESS_KEY</secretKeyVariable>
|
||||
<credentialsId>b3e6f337-5d44-4f57-921c-1632d796caaf</credentialsId>
|
||||
</com.cloudbees.jenkins.plugins.awscredentials.AmazonWebServicesCredentialsBinding>
|
||||
<org.jenkinsci.plugins.credentialsbinding.impl.SSHUserPrivateKeyBinding>
|
||||
<keyFileVariable>KEY_FILE_VARIABLE</keyFileVariable>
|
||||
<usernameVariable>USER_NAME_VARIABLE</usernameVariable>
|
||||
<passphraseVariable>PASSPHRASE_VARIABLE</passphraseVariable>
|
||||
<credentialsId>b3e6f337-5d44-4f57-921c-1632d796caah</credentialsId>
|
||||
</org.jenkinsci.plugins.credentialsbinding.impl.SSHUserPrivateKeyBinding>
|
||||
<org.jenkinsci.plugins.credentialsbinding.impl.CertificateMultiBinding>
|
||||
<keystoreVariable>KEYSTORE_VARIABLE</keystoreVariable>
|
||||
<passwordVariable>PASSWORD_VARIABLE</passwordVariable>
|
||||
<aliasVariable>ALIAS_VARIABLE</aliasVariable>
|
||||
<credentialsId>b3e6f337-5d44-4f57-921c-1632d796caaj</credentialsId>
|
||||
</org.jenkinsci.plugins.credentialsbinding.impl.CertificateMultiBinding>
|
||||
</bindings>
|
||||
</org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper>
|
||||
</buildWrappers>
|
||||
|
@ -12,9 +12,12 @@ wrappers:
|
||||
- text:
|
||||
credential-id: b3e6f337-5d44-4f57-921c-1632d796caad
|
||||
variable: config_text
|
||||
- docker-server-creds-binding:
|
||||
credential-id: b3e6f337-5d44-4f57-921c-1632d796caae
|
||||
variable: config_docker_server
|
||||
- credentials-binding:
|
||||
- username-password-separated:
|
||||
credential-id: b3e6f337-5d44-4f57-921c-1632d796caae
|
||||
credential-id: b3e6f337-5d44-4f57-921c-1632d796caag
|
||||
username: myUsername
|
||||
password: myPassword
|
||||
- credentials-binding:
|
||||
@ -22,3 +25,15 @@ wrappers:
|
||||
credential-id: b3e6f337-5d44-4f57-921c-1632d796caaf
|
||||
access-key: AWS_ACCESS_KEY_ID
|
||||
secret-key: AWS_SECRET_ACCESS_KEY
|
||||
- credentials-binding:
|
||||
- ssh-user-private-key:
|
||||
credential-id: b3e6f337-5d44-4f57-921c-1632d796caah
|
||||
key-file-variable: KEY_FILE_VARIABLE
|
||||
username-variable: USER_NAME_VARIABLE
|
||||
passphrase-variable: PASSPHRASE_VARIABLE
|
||||
- credentials-binding:
|
||||
- cert-multi-binding:
|
||||
credential-id: b3e6f337-5d44-4f57-921c-1632d796caaj
|
||||
keystore-variable: KEYSTORE_VARIABLE
|
||||
password-variable: PASSWORD_VARIABLE
|
||||
alias-variable: ALIAS_VARIABLE
|
||||
|
Loading…
Reference in New Issue
Block a user