KubeRocketCI: Tekton Overview
KubeRocketCI is a platform that utilizes the Tekton stack to implement continuous integration and continuous delivery (CI/CD) pipelines, offering access to all Tekton features. It comes pre-configured with various Tekton resources, including pipelines, tasks, triggers, and other components. This documentation outlines how to interact with these Tekton resources within the KubeRocketCI platform, addressing common use cases, pipeline configuration, and execution processes.
Prerequisitesβ
Before executing pipelines, ensure that the project is onboarded to the KubeRocketCI platform and that the relevant branches are properly configured..
Pipeline Types in the Platformβ
KubeRocketCI supports four main types of pipelines:
-
Review Pipeline: This pipeline is initiated when a pull request is created. It aims to check code quality and run tests before the code can be merged.
-
Build Pipeline: This pipeline is triggered when a pull request is merged. It is responsible for building the application and generating deployable artifacts.
-
Deploy Pipeline: This pipeline handles the deployment of the application to a target environment, applying specific configurations.
-
Clean Pipeline: This pipeline is responsible for cleaning up any resources created during the deployment, ensuring a fresh environment for future deployments.
Each pipeline type is identified using specific labels in Kubernetes objects:
app.edp.epam.com/pipelinetype: review
β for review pipelines;app.edp.epam.com/pipelinetype: build
β for build pipelines;app.edp.epam.com/pipelinetype: deploy
β for deploy pipelines;app.edp.epam.com/pipelinetype: clean
β for clean pipelines.
Creating a Pipelineβ
To create a pipeline, you need to define and apply Tekton resources such as tasks, pipelines, and triggers in the cluster.
KubeRocketCI includes a library component for managing Tekton resources declaratively. This library integrates with Argo CD, enabling version control and automatic synchronization of pipeline definitions.
Below is the recommended flow for creating comprehensive and efficient Tekton pipelines:
- Start by modifying an existing pipeline example from the library to suit your needs.
- Test changes by applying resources directly to the cluster.
- Once verified, commit changes to the repository to ensure they are tracked and version-controlled.
- Check/apply changes in Argo CD.
Configuring Pipelines for Projectsβ
Proper pipeline configuration depends on its purpose. Pipeline configuration is different for CI and CD pipelines.
Review and Build Pipelines (CI)β
Two approaches are available for defining review and build pipelines:
- Useful for onboarding multiple projects with the same pipeline structure.
- Pipelines follow a naming pattern and are mapped to projects via project settings.
- Ideal for enabling different pipelines for different branches of a project.
- Pipelines are explicitly defined for specific branches.
Deploy and Clean Pipelinesβ
Deploy and Clean pipelines require the creation of a TriggerTemplate resource with appropriate labels:
app.edp.epam.com/pipelinetype: deploy
β for deploy pipelines;app.edp.epam.com/pipelinetype: clean
β for clean pipelines.
The TriggerTemplate defines parameters (e.g., service account name, timeout) and references the deploy pipeline in its pipelineRef field.
Trigger Pipelinesβ
A specific event triggers each pipeline type.
Review Pipelineβ
Trigger a review pipeline using one of the four methods:
- Create a pull request in the repository targeting a configured branch. The review pipeline will be triggered automatically once the pull request is created:
- Use the Run Again button on the PipelineRun details page in the KubeRocketCI portal (if a PipelineRun exists):
- Use the Rerun button on the PipelineRun details page in the Tekton dashboard (if a PipelineRun exists):
- Add a comment with the
/recheck
command on the pull request page:
The /recheck
command works for all the available Version Control Systems.
Build Pipelineβ
Overall, there are four methods of triggering a build pipeline:
-
Merge a pull request into a configured branch.
-
Use the Run Again button in the KubeRocketCI portal (if a PipelineRun exists):
- Use the Rerun button in the Tekton dashboard (if a PipelineRun exists):
- Use the Trigger Build PipelineRun button in the KubeRocketCI portal within the branches section:
Deploy Pipelineβ
Deploy pipelines can be triggered manually or automatically. Automatic triggers are implemented using the TriggerType custom resource. There are three ways to trigger a deploy pipeline:
- Use Configure Deploy and Start Deploy buttons in the KubeRocketCI portal:
-
Configure the pipeline with the
Auto
TriggerType to deploy automatically after the build pipeline finishes and a new artifact version is created. -
Use the
Auto-stable
TriggerType for deploying stable component versions while updating only the rebuilt component.
Clean Pipelineβ
Trigger the clean pipeline using the Clean button in the KubeRocketCI portal within the appropriate stage section.