This guide is to run a sample application on openshift cluster using tekton
- Install Tekton
- Navigate to Operator Hub
- Search tekton
- Subscribe and Install
- clone the repo
$ git clone https://github.com/SaifRehman/nodejs-tekton-openshift.git
- Navigate to the directory
$ cd nodejs-tekton-openshift
- in
kubernetes
folder you have all kubernetes artifacts - in
tekton
folder you have tekton configuration tekton/resources.yaml
specified git repo and private images repotekton/task.yaml
specifies all the tasks, such as build push and deploy. each tasks has specific stepstekton/pipeline.yaml
configures pipeline and specifies what tasks to runtekton/pipelinerun.yaml
Runs the given pipeline
- Configure secret
- Create
docker.config.json
$ touch docker.config.json
- populate with the following data
{
"auths": {
"docker-registry.default.svc.cluster.local:5000": {
"auth": "c2E6ZXlKaGJHY2lPaUp<...skipped many lines ...>"
}
}
}
auth
entry needs to change- get secret
$ secret=$(oc get secret | grep pipeline-token | head -1 | awk '{print $1}')
- get token
$ token=$(oc get secret $secret -o jsonpath="{.data.token}")
token=$(echo $token | base64 --decode)
echo "sa:$token" | base64
-
copy it and paste it in auth
-
Create a docker secret
$ oc create configmap docker-config --from-file=config.json=docker.config.json
- Apply tekton yaml
$ oc apply -f resources.yaml
$ oc apply -f task.yaml
$ oc apply -f pipeline.yaml
$ oc apply -f pipelinerun.yaml
- Open openshift dashboard and navigate to pipeline and then pipeline run to see the running pipeline
ew