Tekton - Configure GitHub Credentials

Prerequisites

Getting Started

When using Tekton, building a pipeline will require code to be pulled from either a public or private repository. For security reasons an access token will need to be generated and configured on Tekton in order for it to pull any code from the repository. In this guide we will create and configure a github token for a tekton pipeline to gain access to the repository to pull code.

Generating the Token

First thing we need to do is generate the Github token. Open Github.com and login with your username and password.

tekton github login

Once logged in, Click on your picture icon in the top left. Then go to Settings → Developer Settings → Personal Access Tokens.

tekton access tokens

Here we want to generate a token, so Click on the Generate a Token. The token permissions need to be the repo which gives read and write access to the repository.

tekton git token

Once the token is created, make sure to copy it down. We will need it later.

Tekton Dashboard

Now we need to gain access to your tekton dashboard running in Openshift.

Open up a Terminal window and login to Openshift.

Once logged in run the following commands to find the tekton dashboard URL.

oc get route -n kabanero

From there, look for the name tekton-dashboard. It should look something like

NAME               HOST/PORT                                                                                                          PATH      SERVICES           PORT      TERMINATION          WILDCARD
icpa-landing       ibm-cp-applications.*.us-east.containers.appdomain.cloud                   icpa-landing       <all>     reencrypt/Redirect   None
kabanero-cli       kabanero-cli-kabanero.*.us-east.containers.appdomain.cloud                 kabanero-cli       <all>     passthrough          None
kabanero-index     kabanero-collections.*.us-east.containers.appdomain.cloud                  kabanero-index     <all>                          None
kabanero-landing   kabanero-landing-kabanero.*.us-east.containers.appdomain.cloud           kabanero-landing   <all>     passthrough          None
tekton-dashboard   tekton-dashboard-kabanero.*.us-east.containers.appdomain.cloud             tekton-dashboard   <all>     reencrypt/Redirect   None

We want to use the address that looks like tekton-dashboard-kabanero.us-east.containers.appdomain.cloud.

Next, open up a web browser and paste that into the address bar and hit enter.

tekton dashboard

Once on the dashboard, open up the Secrets tab that is found on the bottom left side of the screen.

tekton dashboard secrets

From there Select the Add Secret button on the right side of the screen.

Next, we want to fill in the form with the following information:

Name: tekton-github
Namespace: kabanero
Access To: Git Server
Username: <yourusername>
Password: <Generated Token>
Service Account: kabanero-operator
Server URL: tekton.dev/git-0:https://github.com
tekton create secret

Then click on Submit and your token is registered.