Adding Jira approval stages and steps
Use Jira issues to approve or reject a Pipeline or stage at any point in its execution.
You can use Jira issues to approve or reject a Pipeline or stage at any point in its execution.
During deployment, a Jira issue's fields are evaluated according to criteria you define and its approval/rejection determines if the Pipeline or stage may proceed.
The Jira Approval step can be added in a Jira Approval stage or in a Continuous Delivery stage. The Jira Approval step prevents 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.
To create or update Jira issues, go to Create Jira issues in CD stages and Update Jira issues in CD stages.
Visual summary
The following video shows you how to use the Jira Create, Jira Update, and Jira Approval steps:
Limitations
The Jira Approval step reads a limited set of Jira field types:
Harness supports only Jira fields of type
Option,Array,Any,Number,Date, andString. Harness does not integrate with Jira fields that manage users, issue links, or attachments. This means that Jira fields like Assignee and Sprint are not accessible in the Harness Jira integration.Array-type fields (such as Labels) cannot be used in the Conditions section of approval criteria. Only string and option-type fields are supported for key-value criteria. To evaluate array-type fields, use JEXL expressions in the JEXL Expression field instead. For example, to check if a label exists, use
<+issue.Labels>.indexOf('your-label') >= 0.
Jira approval stages and steps
You can use Jira Approvals in two ways:
Jira Approval step: You can add a Jira Approval step to any Continuous Delivery or Approval stage.
Jira Approval stage: The Jira Approval stage includes Jira Create, Jira Approval, and Jira Update steps:

You do not need to use the Jira Create and Jira Update steps with the Jira Approval step, but they are included in the Jira Approval stage because the stage is meant to create a Jira issue, approve or reject based on its settings, and then update the Jira issue in one stage.
You can also use the Jira Create, Jira Approval, and Jira Update steps within a non-Approval stage.
The Jira Create and Jira Update steps are described in other topics. This topic describes the Jira Approval step only.
See:
Add a Jira Approval step
In a CD or Approval stage, click Add Step, and then click Jira Approval.
When you add a Jira Approval stage, Harness automatically adds Jira Create, Jira Approval, and Jira Update steps. This topic covers only the Jira Approval step.
In Name, enter a name that describes the step.
In Timeout, enter how long you want Harness to try to complete the step before failing (and initiating the stage or step Failure Strategy).
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 is one day.
Jira communication can take a few minutes. Do not use a brief timeout.
The maximum is 3w 3d 20h 30m. In Jira Connector, create or select the Jira Connector to use.
In Project, select the Jira project that contains the issue you want to evaluate.
In Issue Key, enter the Jira issue key of the issue you want to evaluate.
In Retry Interval, set how long the step should wait to fetch details again for calculating Approval or Rejection criteria.
Pass Jira issue keys with expressions
In Issue Key, you can use an expression to reference the issue key from another Jira Create or Jira Update step.
The following video demonstrates how to pass an issue key:
The expression follows the format <+pipeline.stages.STAGE_ID.spec.execution.steps.STEP_ID.issue.key>.
There are two ways to get the information for the expression:
Use the standard expression: In the Jira Update step Issue Key, select Expression, and then paste the expression
<+pipeline.stages.STAGE_ID.spec.execution.steps.STEP_ID.issue.key>with the correctSTAGE_IDandSTEP_IDvalues for the Jira Create step that creates the issue key.
Expression option selected for the Issue Key field Copy the expression from an executed step: Select a successful execution, and click the Jira Create step in the execution.
Click the Output tab, locate the Key setting, and click the copy button.

Output tab showing the issue key to copy Now you have the expression that references the issue key from this step.
Go back to the Jira Update step. Select Edit Pipeline.
In Issue Key, select Expression.

Expression pasted into the Issue Key field In Issue Key, paste in the expression you copied from the previous Jira Create/Update step.
With either method, the Jira Update step will use the issue created by the Jira Create step.
A Jira Create step creates a new, independent Jira issue every time it runs. If you use the same issue ID in Jira Approval, each run approves a new issue.
Set approval criteria
The Approval Criteria in the step determines if the Pipeline or stage is approved or rejected.

Whether the Pipeline/stage stops executing depends on the stage or step Failure Strategy. You can specify criteria using Conditions and/or JEXL Expression. If you use them in combination they both must evaluate to True for the step to be successful.
In Conditions, use the Jira field, operator, and value to define approval criteria. Four supported operators are =, !=, in, and not in. For example:
The condition for the
Statusfield to be inApproved,Done, orPublishedcan be specified as:
The condition for the
Statusfield to not be in eitherBlocked,Invalid, orTo Docan be specified as:
The condition for the
Statusfield to be inApproved,Done, orPublishedwithoutIssue Typecan be specified as:
In JEXL Expression, you can use JEXL expressions. You can use a JEXL expression if the field is set to Fixed value, Runtime input, or Expression.
Using JEXL expressions for array-type fields
Array-type fields like Labels cannot be evaluated using the Conditions section. Instead, use JEXL expressions to check these fields.
For example, to approve when a specific label exists on the Jira issue:
This expression returns true if the Labels array contains "your-label".
Additional examples:
Check if Labels contains "fed":
Check if Labels contains "approved" OR "verified":
Check if Labels contains "high-priority" AND Status is "Done":
Set rejection criteria
In Optional Configuration, in Rejection Criteria, you can define criteria for rejecting the approval.
If you add rejection criteria it is used in addition to the settings in Approval Criteria.
Advanced settings
In Advanced, you can use the following options:
Apply and test
Click Apply Changes. The Jira Update step is added to the stage.
Run the Pipeline.
When the Jira Approval step is reached, you can see its approval and rejection criteria:

You can also click the JIRA Ticket Pending Approval link to open the ticket.
The step can take a few minutes to receive information from Jira.
Issue expressions
You can use <+issue> to refer to the value in the Issue Key setting.
For example, <+issue.Status> == "Done" in the Approval Criteria JEXL Expression checks whether the status of the issue in Issue Key is Done:

Status is an issue field. You can use any issue field.
Referencing JIRA fields with spaces or special characters
When referencing JIRA custom fields that contain spaces or special characters in their names, you must enclose the field name in single quotes (') within the Harness expression. Without quotes, the expression evaluation will fail.
Examples:
Fields with spaces, correct syntax:
Fields without spaces, no quotes needed:
Complex expression combining both:
This expression checks if:
The "Risk Level" custom field equals "High" AND the Labels field contains "crm-approved", OR
The "Risk Level" custom field equals "Low"
Incorrect syntax (the expression fails):
Additional examples:
Refresh status during execution
You can do a manual status refresh in the Pipeline Studio Execution view.
When the step is waiting for a response from Jira, you can use the Refresh button to immediately fetch the latest status of the approval ticket instead of waiting for the polling interval.
Use the refresh option when:
The approval condition in Jira was updated after the step began execution.
You need quicker response handling for fast-track approvals such as incident mitigations or emergency changes.
To use the refresh button:
Execute a pipeline with a Jira Approval step.
In the Pipeline Studio Execution view, locate the approval step.
If the step is in a waiting state, click the Refresh button.
The step re-evaluates the condition and proceeds if the criteria are met.
Notes
To add comments in you can use Comment key. Use
\\for line breaks.

For more information about approval log limitations, go to Deployment logs and limitations.
Last updated
Was this helpful?