Customize Environment Cleanup
KubeRocketCI provides capabilities to fully operate the CI/CD flow, starting from building applications to deploying its new release. The operation flow is designed to be seamless for most of the users. However, there may be cases where more specialized actions are necessary. These might include custom procedures for managing the deletion of application resources.
Create Custom Clean Pipelineβ
Delete pipeline is a typical Tekton pipeline but with its own instructions. The custom delete pipeline creation involves the following steps:
Clean pipeline consists of Trigger Template, Pipeline, and Task custom resources. To create a custom clean pipeline, follow the steps below:
- Create and apply the TriggerTemplate custom resource. Refer to the example TriggerTemplate. Ensure to set the appropriate pipeline type in the labels:
...
labels:
app.edp.epam.com/pipelinetype: clean
...
...
spec:
taskRunTemplate:
serviceAccountName: tekton
pipelineRef:
name: clean-custom
...
- Create and apply the Pipeline custom resource. Refer to the example Pipeline. Ensure to set the concrete task to trigger:
Additionally, set the concrete task to run:
tasks:
- name: clean
taskRef:
kind: Task
name: clean-custom
- Create and apply the Task custom resource. Refer to the example Task.
Enable Clean Pipelineβ
As soon as all the three custom resources are correctly configured and applied, you can select the newly created pipeline in the KubeRocketCI portal.
New Environmentsβ
To apply the newly created clean pipeline to your environments, follow the steps below:
- In the deployment flow details page, click the Create environment button:
- In the Create environment window, select the custom clean pipeline:
Existing Environmentsβ
If you need to change the delete pipeline in an already existing environment, follow the steps below:
- Navigate to the environment details page and click the Edit button:
- In the Edit environment window, select the custom clean pipeline:
As soon as the clean pipeline is created and selected within an environment, you can trigger it by clicking the Clean button.