From the course: Learning OpenShift

Solution: Setup a CI/CD pipeline in your cluster - OpenShift Tutorial

From the course: Learning OpenShift

Solution: Setup a CI/CD pipeline in your cluster

(lively music) - [Instructor] In this challenge, we'll download source code from GitLab and build a container image, which we will store later on the OpenShift Container Registry. We will manually create a pipeline and its steps, then run it to verify that the execution was a success. Make sure that the Red Hat OpenShift Pipelines operator is installed on the cluster and that its status is succeeded. You should see a pipelines entry on the menu on the left, for both the administrator and developer perspectives. On the administrator perspective, create a new project called My First Pipeline. Navigate to the pipeline's menu on the OpenShift console and click on the create pipeline button. Doing this opens the Graphical pipeline builder. Scroll to the bottom of the screen and click the add workspace button. Name it My Workspace. A workspace is a shared storage space used to transfer data among tasks. Click the add task button and type clone and select the Git Clone Task by Red Hat. Click the add button. The task first appears with an exclamation icon because it lacks critical information. Click on the task object to open the parameters form on the right. Enter the URL of the Git repository. Scroll down to select the workspace you created previously. Hover over the Git Clone task and click the plus button on the right-hand side and ask a new task object to the pipeline. Click on it and search for Kaniko. Kaniko is an open source project to build container images, similar to Docker, Build That or Putman. Click install and add and click on the newly-created task object to provide some parameters. In the image field, provide this parameter. This image name points to the internal registry provided by OpenShift. Then scroll and select the same workspace as the previous task in the pipeline in the source field. Click on the create button to see the pipeline details screen. Open the actions menu on the right-hand side and click on the start entry. This action will create a new pipeline run object. Select a proper location for your workspace by creating a volume claim template, which will automatically provision a PVC with one gigabytes of space, enough for the needs of this context. The pipeline run object will start cloning the application source code and building the container image using Kaniko. After a few minutes, your pipeline will finish and if you navigate to the builds menu and open the image streams entry, you will see your image, my image, ready to be used. If you see the image, my image, in the registry for the project, my first pipeline, the exercise is complete. For those curious about Tekton, there are plenty of reusable tasks and pipelines available at the Tekton Hub at hub.tekton.dev.

Contents