Created
February 9, 2021 12:41
-
-
Save GuyBarros/fbf4e7c9a051a7b763f5af76360be9a5 to your computer and use it in GitHub Desktop.
script to create approle credential
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from David