How to update Git bot Pipeline API token

Issue

  • How to update the token for a Git Provider (GitHub, Bitbucket) bot
  • How to update Jenkins X token for GitHub bot
  • How to update Jenkins X token for Bitbucket bot

Environment

Resolution

There is an API token per Git Provider (bot) linked to your Jenkins X cluster. An API token is added during the installation process. You can also add new Git providers by jx-create-git-server.

Steps

1. The credentials used by a pipeline are stored in a Kubernetes secret. Note, in the below example GitHub is used as the SCM. To list the secrets, run

kubectl get secrets | grep pipeline             

the output should look similar to:

NAME                                      TYPE                          DATA     AGE
jx-pipeline-git-github-github             Opaque                        2        63d

2. Export the secret into secrets-jx-pipeline-git-github-github.yaml file

kubectl get secret jx-pipeline-git-github-github -o yaml > secrets-jx-pipeline-git-github-github.yaml

3. Encode (base64) the new API token

echo -n <new-apitoken> | base64

and copy it into the data.password field in the secrets-jx-pipeline-git-github-github.yaml file.

4. Apply the changes

kubectl apply -f secrets-jx-pipeline-git-github-github.yaml

Tested product/plugin versions

  • Jenkins X 1.3.980
jx                 1.3.980
jenkins x platform 0.0.3690
Kubernetes cluster v1.11.7-gke.12
kubectl            v1.13.4
helm client        v2.13.0+g79d0794
helm server        v2.13.0+g79d0794
git                git version 2.7.4
Operating System   Ubuntu 16.04.6 LTS
  • GitHub

Have more questions?

0 Comments

Please sign in to leave a comment.