Using Manual Harness Approval Steps in CD Stages

Updated 1 month ago by Michael Cretzman

You can specify Harness User Group(s) to approve or reject a stage at any point in its execution. During deployment, the User Group members use the Harness Manager to approve or reject the deployment manually.

Approvals are usually added in between stage steps to prevent the stage execution from proceeding without an approval.

For example, in a Kubernetes Blue Green Deployment, you might want to add an approval step between the Stage Deployment step, where the new app version is deployed to the staging environment, and the Swap Primary with Stage step, where production traffic is routed to the pods for the new version.

Other approval methods are:

In this topic:

Before You Begin

Visual Summary

Here's a manual approval step during the execution of a Pipeline:

An approver can approve/reject the step, stopping the Pipeline. The approver can also add comments and define variables for use by subsequent approvers and steps.

Here's a quick video that walks you through setting up and running the step:

Here's what a manual approval step looks like in YAML:

YAML Example
- step:
type: HarnessApproval
name: Harness Approval Step
identifier: Harness_Approval_Step
timeout: 1d
spec:
approvalMessage: Test
includePipelineExecutionHistory: true
approvers:
userGroups:
- docs
minimumCount: 1
disallowPipelineExecutor: false
approverInputs:
- name: foo
defaultValue: bar

Step 1: Add Approval Step

In a CD stage, in Execution, click Add Step.

Click Harness Approval. The Harness Approval settings appear.

Step 2: Set Timeout

Set a default for the step timeout. Leave enough time for the Users in Approvers to see and respond to the waiting step.

The default timeout for an Approval step is 1d (24 hours). You can use w  for week, d  for day, h  for hour, m  for minutes, s  for seconds and ms for milliseconds. For example, 1d for one day.

The maximum timeout duration is 24 days.

The timeout countdown appears when the step in executed.

Option: Add Message

In Approval Message, add the message for the Users in Approvers.

Include Pipeline execution history in approval details: enable this option to show approvers the Pipeline's execution history. This can help an approver compare the current execution info with historical data.

Step 3: Select Approvers

In User Groups, select the Harness User Groups that will approve the step.

See Add and Manage User Groups.

In Number of approvers that are required at this step, enter how many of the Users in the User Groups must approve the step.

Option: Prevent Approval by Pipeline Executor

If you don't want the User that initiated the Pipeline execution to approve this step, select the Disallow the executor from approving the pipeline option.

Even if the User is in the User Group selected in User Group, they won't be able to approve this step.

Option: Approver Inputs

In Inputs to be provided by approver, you can enter variables and when the approver views the step, they can provide new values for the variables.

If there are multiple approvers, the first approver sees the variables as you entered them in the step. If the first approver enters new values, the next approver sees the values the first approver entered.

A third approver will see all of the variables the first and second approver provided.

The variable values entered by the final approver populate the expressions created from the inputs.

For example, if there were three approvers and you added a Shell Script step that referenced the input variables with an expression, the expression would render the variable values entered by the final, third approver.

You can reference input variables using the approverInputs expression:

<+pipeline.stages.[stage_name].spec.execution.steps.[step_name].output.approverInputs.[variable_name]>

These variables can serve as inputs to later stages of the same Pipeline, where they support conditional execution or user overrides. 

For example, in a subsequent step's Conditional Execution settings, you could use an expression that only runs the step if the expression evaluates to 1.

<+pipeline.stages.Shell_Script.spec.execution.steps.Harness_Approval_Step.output.approverInputs.foo> == 1

Option: Advanced Settings

See:

See Also


Please Provide Feedback