Jenkins CasC handling tokens Configurations As Code

1k views Asked by At

I've been trying to provide some tokens through CasC (BitBucket Plugin) but every time the Jenkins instance restarted then the tokens are not working. As I see that is happening because Jenkins use different salt and the Hash is changing. How i can provide in groovy the token in order to produce the secret ?

1

There are 1 answers

1
apr_1985 On

I dont use BitBucket but here is how I do this for Slack

---
credentials:
  system:
    domainCredentials:
      - credentials:
          - string:
              description: "Slack auth token"
              scope: GLOBAL
              id: "slack-token"
              secret: ${slack-token}

unclassified:
  slackNotifier:
    teamDomain: "apr-1985-slack-space"
    tokenCredentialId: slack-token

This is using the AWS SSM plugin to pull the credential out of the Parameter Store and add them to Jenkins.