-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: PuneetPunamiya <ppunamiy@redhat.com>
- Loading branch information
1 parent
a44c523
commit 036b291
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Installing Manual Approval Gate | ||
|
||
NOTE:- You need to install [tektoncd/pipeline](https://github.com/tektoncd/pipeline/blob/main/docs/install.md) | ||
|
||
1. Manual Approval Gate Installation | ||
* On Kubernetes | ||
``` | ||
make apply | ||
``` | ||
* On Openshift | ||
``` | ||
make TARGET=openshift apply | ||
``` | ||
2. Install a pipelineRun which has approval task as one of the task in the pipelin | ||
- For example | ||
```yaml | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: PipelineRun | ||
metadata: | ||
generateName: pr-custom-task-beta- | ||
spec: | ||
pipelineSpec: | ||
tasks: | ||
- name: before | ||
taskSpec: | ||
steps: | ||
- image: busybox | ||
name: before | ||
script: echo before wait | ||
- name: wait 👈 Wait task with kind as `ApprovalTask` | ||
taskRef: | ||
apiVersion: openshift-pipelines.org/v1alpha1 | ||
kind: ApprovalTask | ||
runAfter: ['before'] | ||
- name: after | ||
taskSpec: | ||
steps: | ||
- image: busybox | ||
name: after | ||
script: echo after wait | ||
runAfter: ['wait'] | ||
``` | ||
Install the above pipelineRun | ||
```shell | ||
kubectl create -f <pipeline.yaml> | ||
``` | ||
**NOTE** :- _Once the pipelineRun is started after the execution of first task is done, it will create a customRun for that approval task and the pipeline will be in wait state till it gets the approval from the user. The name of the approvalTask is the same of customRun which is created. | ||
As of today only `"true"` and `"false"` are supported. If user passes the approval as `"true"` then pipeline will proceed to execute the further tasks and if `"false"` is provided then in that case it will fail the pipeline_ | ||
3. Now start the api server | ||
```shell | ||
go run ./cmd/approver/main.go | ||
``` | ||
4. Now approve/reject the approval task using curl request | ||
```shell | ||
curl --header "Content-Type: application/json" \ | ||
--request POST \ | ||
--data '{"approved":"false", "namespace":"default"}' \ | ||
http://localhost:8000/approvaltask/<approvalTaskName> | ||
``` |