Guest User

Untitled

a guest
Jan 29th, 2019
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. #!groovy
  2.  
  3. import com.cloudbees.plugins.credentials.impl.*;
  4. import com.cloudbees.plugins.credentials.*;
  5. import com.cloudbees.plugins.credentials.domains.*;
  6.  
  7. def env = System.getenv()
  8.  
  9. def credential_id = "basic-auth-id"
  10. def credential_description = "Access to Bitbucket via username and password"
  11. def credential_username = env.BITBUCKET_USER
  12. def credential_password = ""
  13.  
  14. credentials_store = SystemCredentialsProvider.getInstance().getStore()
  15.  
  16. Credentials credentials = (Credentials) new UsernamePasswordCredentialsImpl(
  17. CredentialsScope.GLOBAL,
  18. credential_id,
  19. credential_description,
  20. credential_username,
  21. credential_password
  22. )
  23. credentials_store.addCredentials(Domain.global(), credentials)
Add Comment
Please, Sign In to add comment