Skip to content

This is the Tekton Pipeline sample code to clone from a private GitHub repository.

License

Notifications You must be signed in to change notification settings

ega4432/tekton-git-clone-private-repo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tekton-git-clone-private-repo

Setup

Prepare SSH authentication

Paste secret key to the data in the secret.yaml.

>> cat ~/.ssh/id_rsa | base64
>> cat ~/.ssh/config | base64
>> cat ~/.ssh/known_hosts | base64
>> oc create -f secret.yaml

Register your public key to GitHub account. To register public key to go to Settings of your GitHub account page > SSH and GPG key > New SSH key and paste your public key.

Prepare the cluster

  1. Install and create tasks to the OpenShift cluster
# Clone task from tekton hub
>> oc apply -f https://raw.givthubusercontent.com/tektoncd/catalog/main/task/git-clone/0.5/git-clone.yaml

# Custom task
# ex) only showing README.md of the private repository
>> oc apply -f task.yaml

>> tkn task list
NAME           DESCRIPTION              AGE
output-readme                           11 seconds ago
git-clone      These Tasks are Git...   47 seconds ago
  1. Create a secret for SSH authentication
>> oc create -f secret.yaml
  1. Create a pipeline
>> oc create -f ./pipeline.yaml

Usage

Run the pipeline by executing the following command and check the result.

# Execute
>> oc create -f pipeline-run.yaml

# Check execution
>> tkn pr ls

# View log of the latest pipeline run
>> tkn pr logs -fL

About

This is the Tekton Pipeline sample code to clone from a private GitHub repository.

Topics

Resources

License

Stars

Watchers

Forks