diff --git a/files/puppet_helper.groovy b/files/puppet_helper.groovy index b77e783ad..c1ce9c7ff 100644 --- a/files/puppet_helper.groovy +++ b/files/puppet_helper.groovy @@ -162,7 +162,7 @@ class Actions { ///////////////////////// // create credentials ///////////////////////// - void create_or_update_credentials(String username, String password, String description="", String private_key="") { + void create_or_update_credentials(String username, String password, String id="", String description="", String private_key="") { def global_domain = Domain.global() def credentials_store = Jenkins.instance.getExtensionList( @@ -170,10 +170,13 @@ class Actions { )[0].getStore() def credentials + if (id == "") { + id = null + } if (private_key == "" ) { credentials = new UsernamePasswordCredentialsImpl( CredentialsScope.GLOBAL, - null, + id, description, username, password @@ -187,7 +190,7 @@ class Actions { } credentials = new BasicSSHUserPrivateKey( CredentialsScope.GLOBAL, - null, + id, username, key_source, password, diff --git a/manifests/credentials.pp b/manifests/credentials.pp index 40810b2a6..853014eb9 100644 --- a/manifests/credentials.pp +++ b/manifests/credentials.pp @@ -21,6 +21,7 @@ $description = 'Managed by Puppet', $private_key_or_path = '', $ensure = 'present', + $uuid = '', ){ validate_string($ensure) @@ -35,11 +36,13 @@ validate_string($password) validate_string($description) validate_string($private_key_or_path) + validate_string($uuid) jenkins::cli::exec { "create-jenkins-credentials-${title}": command => [ 'create_or_update_credentials', $title, "'${password}'", + "'${uuid}'", "'${description}'", "'${private_key_or_path}'", ],