Coder Social home page Coder Social logo

ega4432 / tekton-git-clone-private-repo Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 5 KB

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

License: MIT License

openshift tekton pipeline ci kubernetes k8s openshift4 crc cicd

tekton-git-clone-private-repo's Introduction

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

tekton-git-clone-private-repo's People

Contributors

ega4432 avatar

Watchers

 avatar  avatar

tekton-git-clone-private-repo's Issues

appears to need SSH authentication but no SSH credentials have been provided

followed https://tekton.dev/docs/how-to-guides/clone-repository/, checked ssh key (works), but I am still getting the above message...

Another thread suggested creating the service account, but in that case it fails at the chmod step with "permission denied"

│ step-clone + '[' false '=' true ]                                                                                                                                                                               │
│ step-clone + '[' true '=' true ]                                                                                                                                                                                │
│ step-clone + cp -R /workspace/ssh-directory /home/git/.ssh                                                                                                                                                      │
│ step-clone + chmod 700 /home/git/.ssh                                                                                                                                                                           │
│ step-clone + chmod -R 400 /home/git/.ssh/id_rsa                                                                                                                                                                 │
│ step-clone + '[' false '=' true ]                                                                                                                                                                               │
│ step-clone + CHECKOUT_DIR=/workspace/output/                                                                                                                                                                    │
│ step-clone + '[' true '=' true ]                                                                                                                                                                                │
│ step-clone + cleandir                                                                                                                                                                                           │
│ step-clone + '[' -d /workspace/output/ ]                                                                                                                                                                        │
│ step-clone + rm -rf /workspace/output//lost+found                                                                                                                                                               │
│ step-clone + rm -rf '/workspace/output//.[!.]*'                                                                                                                                                                 │
│ step-clone + rm -rf '/workspace/output//..?*'                                                                                                                                                                   │
│ step-clone + test -z                                                                                                                                                                                            │
│ step-clone + test -z                                                                                                                                                                                            │
│ step-clone + test -z                                                                                                                                                                                            │
│ step-clone + git config --global --add safe.directory /workspace/output                                                                                                                                         │
│ step-clone + /ko-app/git-init '[email protected]:JustinGuese/documentLLMStartup.git' '-revision=' '-refspec=' '-path=/workspace/output/' '-sslVerify=true' '-submodules=true' '-depth=1' '-sparseCheckoutDire │
│ step-clone {"level":"warn","ts":1703678835.5665507,"caller":"git/git.go:271","msg":"URL(\"[email protected]:JustinGuese/xxxxxx.git\") appears to need SSH authentication but no SSH credentials have b │
│ step-clone {"level":"info","ts":1703678837.2663612,"caller":"git/git.go:176","msg":"Successfully cloned [email protected]:JustinGuese/xxxxxx.git@ 604fa7e64f9e41dda28ebab4619eced898d91d6e (grafted,  │
│ step-clone {"level":"info","ts":1703678837.2888606,"caller":"git/git.go:215","msg":"Successfully initialized and updated submodules in path /workspace/output/"} 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.