Skip to content

Instantly share code, notes, and snippets.

@GuyBarros
Created February 9, 2021 12:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GuyBarros/fbf4e7c9a051a7b763f5af76360be9a5 to your computer and use it in GitHub Desktop.
Save GuyBarros/fbf4e7c9a051a7b763f5af76360be9a5 to your computer and use it in GitHub Desktop.
script to create approle credential
import hudson.util.Secret
import com.datapipe.jenkins.vault.credentials.*
import com.cloudbees.plugins.credentials.impl.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.domains.*
VaultAppRoleCredential customCredential = new VaultAppRoleCredential(
CredentialsScope.GLOBAL,
'custom-credential',
'My Custom Credential',
'role-id',
Secret.fromString('secret-id-text'),
'approle',
)
SystemCredentialsProvider.getInstance().getStore().addCredentials(Domain.global(), customCredential)
@GuyBarros
Copy link
Author

from David

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment