Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!groovy
- import com.cloudbees.plugins.credentials.impl.*;
- import com.cloudbees.plugins.credentials.*;
- import com.cloudbees.plugins.credentials.domains.*;
- def env = System.getenv()
- def credential_id = "basic-auth-id"
- def credential_description = "Access to Bitbucket via username and password"
- def credential_username = env.BITBUCKET_USER
- def credential_password = ""
- credentials_store = SystemCredentialsProvider.getInstance().getStore()
- Credentials credentials = (Credentials) new UsernamePasswordCredentialsImpl(
- CredentialsScope.GLOBAL,
- credential_id,
- credential_description,
- credential_username,
- credential_password
- )
- credentials_store.addCredentials(Domain.global(), credentials)
Add Comment
Please, Sign In to add comment