Create Jira issues in CD stages
You can create a Jira issue as a step in the execution of a pipeline using the Create Jira step.
You can add the Create Jira step to a Harness CD stage or an approval stage.
You can also update Jira issues and add Jira approval stages and steps.
Before you begin
- Connect to Jira: You can add a Harness Jira connector before or during the Create Jira step setup.
Limitations
- Harness supports only Jira fields of type
User
,Option
,Array
,Any
,Number
,Date
, andString
. For example, multi value fields to allow users to select multiple options from a drop-down list. - Harness does not integrate with Jira fields that manage issue links or attachments.
- You can add unsupported Jira fields using an HTTP step. For more details, go to Use the HTTP step to set unsupported fields when creating Jira issues.
- While it's not a strict limitation, some users can forget that when you use a Jira Create step it creates a new, independent Jira issue every time it is run (as opposed to updating the same issue).
- It is important to remember that you should only add Jira Create to a stage if you want to create a new Jira issue on every run of the stage.
Add a Jira Create step
To add a Jira Create step, do the following:
-
In a Harness CD or Approval stage, in Execution, select Add Step.
-
Select Jira Create. The Jira Create step appears.
-
In Name, enter a name that describes the step.
-
In Timeout, enter how long you want Harness to try to create the issue before failing (and initiating the stage or step failure strategy).
-
In Jira Connector, create or select the Jira connector to use.
-
In Jira Project, select a Jira project from the list. A Jira project is used to create the issue key and ID when the issue is created. The unique issue number is created automatically by Jira.
-
In Issue Type, select a Jira issue type from the list of types in the Jira project you selected.
-
Select Apply Changes.
-
Select Save.
Add Issue fields
In Jira fields, you can select specific fields within a Jira issue. For more information on custom fields, go to Jira custom fields.
Review the limitations section to know more about the supported issue fields and limitations.
Jira Date field support
Among the custom fields Harness supports are Baseline End Date and Start Date Time. If your Jira project uses these fields, they are available in fields:
Once you have selected these fields, they are available under Optional Configuration.
You can also use advanced dates using Harness expressions and the current()
function. For example:
<+currentDate().plusDays(2).plusMonths(1)>
: current date plus one month and two days.<+currentTime()>
: for current date time fields.
Harness supports the following functions.
For date-only fields:
currentDate().plusYears(1).plusMonths(1).plusWeeks(1).plusDays(1)
For date and time fields:
currentTime().plusYears(1).plusMonths(1).plusWeeks(1).plusDays(1).plusHours(1).plusMinutes(1).plusSeconds(1).plusNanos(1)
The number 1 is used as an example. You can add whatever number you need.
Advanced settings
In Advanced, you can use the following options:
Apply and test
To apply changes and test, do the following:
-
Select Apply Changes. The Jira Create step is added to the stage.
-
Run the pipeline.
-
In the pipeline execution view, select the Jira Create step, and then select the Output tab. You can view all the fields for the new Jira issue you created.
-
Locate URL and copy its value.
-
In a new browser tab, paste the URL and press enter.
The new issue appears in Jira.
Parent issue support
Harness supports parent links (the issuelink
field in Jira).
This support enables you to do the following:
- The Jira Create step can now be used to create issues with existing issues as their parent.
- The Jira Update step can be used to update the parent of a specific issue.
- A sub-task can be created using the Jira Create step.
- A ticket parent can be provided by simply typing the parent issue key in Parent setting, such as
TJI-47890
.
To use parent links, do the following:
-
In the Jira Create or Update step, select Optional Configuration.
-
Select Fields.
-
In Add Jira Fields, select Parent, and select Add.
-
In the Value for Parent, add the parent issue key.