Manual Approval in Pipelines
The manual approval feature gives users a smooth and controlled process of promoting applications from lower, non-critical environments, such as development or QA, to mission-critical environments like production. Additionally, it ensures that only thoroughly tested and verified changes are deployed to production, minimizing the risk of causing errors or instability.
Manual approval, at its simplest, is an integrable Tekton task that can be integrated into common Tekton pipelines. Its purpose is to pause pipeline execution until a user approves or rejects the task.
Prerequisites​
Please note that using the approval task requires you to install the tekton-custom-task Helm chart.
Enable Pipeline With Manual Approval​
KubeRocketCI offers a pre-defined deploy pipeline called deploy-with-approve. It contains an approval task and can be used for most application deployment cases. If you leverage the default deploy pipeline, you can easily switch it to deploy-with-approve. You can apply this pipeline to both existing and new environments.
New Environments​
To apply the deploy-with-approve pipeline template 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 deploy-with-approve pipeline:
Existing Environments​
If you need to change the default deploy pipeline template 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 another deploy pipeline:
Approve/Reject Deployment​
Once the deploy pipeline has been launched and reached the approval step, you will see a corresponding notification on the pipeline details page:
If the approval is rejected, the pipeline status will be failed:
If you don’t make a selection within the pipeline processing time, which is 60 minutes by default, you’ll see a crossed clock icon as the task run status, indicating that the pipeline has timed out:
You can set a custom timeout duration in the relevant TriggerTemplate.
If you choose the Approve option, the pipeline will proceed running:
Create Pipeline With Approval Task​
The custom deploy pipeline usage flow involves the following steps:
To create a deploy pipeline with a manual approval task, follow the steps below:
- Create and apply the TriggerTemplate custom resource. Refer to the example TriggerTemplate. Make sure to specify the correct pipeline type in the labels and provide the pipeline reference in the specifications:
...
labels:
app.edp.epam.com/pipelinetype: deploy
...
...
spec:
taskRunTemplate:
serviceAccountName: tekton
pipelineRef:
name: deploy-with-promote-approval
...
- Create and apply the Pipeline custom resource. Refer to the example Pipeline. Ensure you set the concrete approval task to run:
- name: approve
params:
- name: description
value: Promote versions to the next Environment?
runAfter:
- deploy-app
taskRef:
apiVersion: edp.epam.com/v1alpha1s
kind: ApprovalTask
name: approve