Build Pipeline
This section provides details on the Build pipeline of the KubeRocket CI/CD pipeline framework. Explore below the pipeline purpose, stages and possible actions to perform.
Build Pipeline Purposeβ
The purpose of the Build pipeline contains the following points:
- Check out, test, tag and build an image from the mainstream branch after a patch set is submitted in order to inspect whether the integrated with the mainstream code fits all quality gates, can be built and tested;
- Be triggered if any new patch set is submitted;
- Tag a specific commit in Gerrit in case the build is successful;
- Build a Docker image with an application that can be afterward deployed using the Tekton/Argo CD Deploy pipeline.
Find below the functional diagram of the Build pipeline with the default stages:
Build Pipeline for Application and Libraryβ
The Build pipeline is triggered automatically after the Code Review pipeline is completed and the changes are submitted.
To review the Build pipeline, take the following steps:
-
Open Tekton Dashboard via Overview page of the UI Portal.
-
Review stages for the application and library codebases:
-
Init - initialization of the Code Review pipeline inputs;
-
Checkout - checkout of the application code;
-
Get-version - get the version from the pom.XML file and add the build number;
-
Compile - code compilation;
-
Tests - tests execution;
-
Sonar - Sonar launch that checks the whole code;
-
Build - artifact building and adding to Nexus;
-
Build-image - docker image building and adding to Docker Registry. The Build pipeline for the library has the same stages as the application except the Build-image stage, i.e. the Docker image is not building.
-
Push - artifact docker image pushing to Nexus and Docker Registry;
-
Git-tag - adding of the corresponding Git tag of the current commit to relate with the image, artifact, and build version.
-
After the Build pipeline runs all the stages successfully, the corresponding tag numbers will be created in Kubernetes/OpenShift and Nexus.
Check the Tag in Kubernetes/OpenShift and Nexusβ
-
After the Build pipeline is completed, check the tag name and the same with the commit revision. Simply navigate to Gerrit β Projects β List β select the project β Tags.
noteFor the Import strategy, navigate to the repository from which a codebase is imported β Tags. It is actual both for GitHub and GitLab.
-
Open the Kubernetes/OpenShift Overview page and click the link to Nexus and check the build of a new version.
-
Switch to Kubernetes β CodebaseImageStream (or OpenShift β Builds β Images) β click the image stream that will be used for deployment.
-
Check the corresponding tag.
Configure and Start Pipeline Manuallyβ
The Build pipeline can be started manually. To set the necessary stages and trigger the pipeline manually, take the following steps:
-
Open the Build pipeline for the created library.
-
Click the Build with parameters option from the left-side menu. Modify the stages by removing the whole objects massive:
{"name". "tests"}
where name is a key and tests is a stage name that should be executed. -
Open Tekton Dashboard or Component details page and check the successful execution of all stages.