Steps to create a pipeline:
- Create custom or install existing reusable Tasks
- Create a Pipeline and PipelineResources to define your application's delivery pipeline
- Create a PersistentVolumeClaim to provide the volume/filesystem for pipeline execution or provide a VolumeClaimTemplate which creates a PersistentVolumeClaim
- Create a PipelineRun to instantiate and invoke the pipeline
- Sign up/Login to IBM Cloud: https://ibm.biz/ddc-emea
- OpenShift CLI and Tekton CLI. You can use the cloud shell to run your commands at https://shell.cloud.ibm.com/shell
- Get Red Hat OpenShift Clusters from: https://developer.ibm.com/openlabs/openshift
- Make sure you are on the Administrator perspective on the web console.
- Go to Operators > OperatorHub and search for 'OpenShift Pipelines'.
- Click on Red Hat OpenShift Pipelines Operator, and then install.
- Leave the default Settings and click on Subscribe.
- Once the operator is installed, you can find it in Operators > Installed Operators section.
- From the administrator perspective, go to Pipelines > Tasks and go to the 'Cluster Tasks' tab.
- Select the 'buildah' cluster task
- Click on 'Actions' dropdown from the top right, and select 'Edit Cluster Task'.
- Look for the variable
TLSVERIFY
in the YAML document. Notice that the default value ofTLSVERIFY
is set to true.
- Change the default value of
TLSVERIFY
fromtrue
tofalse
. Click 'Save' and then 'Reload' to save your changes.
- Create a project for the sample application that you will be using in this tutorial:
oc new-project ci-env
oc new-project dev-env
oc new-project stage-env
- Make sure you are in the
ci-env
project
oc project ci-env
- Run the following command to see the pipeline service account:
oc get serviceaccount pipeline
- Give required permissions for the pipeline service account in the
ci-env
project to be able to make changes indev-env
andstage-env
projects.
oc adm policy add-scc-to-user privileged system:serviceaccount:ci-env:pipeline -n ci-env
oc adm policy add-scc-to-user privileged system:serviceaccount:ci-env:pipeline -n dev-env
oc adm policy add-scc-to-user privileged system:serviceaccount:ci-env:pipeline -n stage-env
oc adm policy add-role-to-user edit system:serviceaccount:ci-env:pipeline -n ci-env
oc adm policy add-role-to-user edit system:serviceaccount:ci-env:pipeline -n dev-env
oc adm policy add-role-to-user edit system:serviceaccount:ci-env:pipeline -n stage-env
- create apply-manifest task
oc create -f https://raw.githubusercontent.com/IBMDeveloperMEA/oc-devops/main/tasks/apply-manifest-task.yaml -n ci-env
- create update-deployment task
oc create -f https://raw.githubusercontent.com/IBMDeveloperMEA/oc-devops/main/tasks/update-deployment-task.yaml -n ci-env
- create test-app task
oc create -f https://raw.githubusercontent.com/IBMDeveloperMEA/oc-devops/main/tasks/test-task.yaml -n ci-env
- List the tasks you just created
tkn task ls
- List ClusterTasks
tkn clustertask ls
- Create the pipeline using the following command
oc create -f https://raw.githubusercontent.com/IBMDeveloperMEA/oc-devops/main/pipeline.yaml -n ci-env
- Show the newly created pipeline
tkn pipeline ls
- Create PVC
oc create -f https://raw.githubusercontent.com/IBMDeveloperMEA/oc-devops/main/pvc.yaml -n ci-env
oc get pvc -n ci-env
- Trigger the pipeline
tkn pipeline start e2e-pipeline
- Get the list of existing pipelinerun
tkn pipelinerun ls
- Track the logs for your pipelinerun
tkn pipeline logs -f