This repo contains scripts that are intended to accept a CSV file as an input to automate ticket upload to Jira. The script uses JIRA Rest API (v2 as of creation, but should work the same for higher versions)
- cp JiraTicketMakerInput-sample.csv JiraTicketMakerInput.csv
- Edit the contents of JiraTicketMakerInput.csv file to suit your purpose
- python3 JiraTicketMaker.py JiraTicketMakerInput.csv
- properties.json: The user of the script has to ensure there is a properties.json file created in their folder (wherever this repo is cloned). For obvious security reasons, my properties.json file is not provided in this repository.
{
"server": "https://jira.yourwebsite.com",
"api_token": "replace_this_text_with_token"
}API Token is typically available in User Profile (by clicking your "avatar" on top right corner of the Jira website)
- fields.json:
A
fields.jsonfile must also be present in the same folder. This is provided with this repository and user has to edit this file to match thier Jira structure. It defines the Jira issue type IDs, custom field IDs and link type names specific to your organisation, and is structured in three sections:
{
"issueTypes": {
"Story": "10001",
"Task": "10002"
},
"customFields": {
"DoR": "customfield_XXXXX",
"AcceptanceCriteria": "customfield_XXXXX",
"DoD": "customfield_XXXXX"
},
"linkTypes": {
"ParentFeatureLink": "Child of",
"TaskToStoryLink": "is child task of"
}
}- issueTypes: Maps the human-readable labels used in the CSV (
Story,Task) to the numeric issue type IDs in your Jira instance. - customFields: Maps field names (Definition of Ready, Acceptance Criteria, Definition of Done) to their
customfield_XXXXXIDs in your Jira instance. These IDs can vary between organisations — check with your Jira admin or inspect the field IDs via the Jira REST API. - linkTypes: Maps logical link names used in the script (ParentFeatureLink, TaskToStoryLink) to the actual link type name strings configured in your Jira instance (e.g.
"Child of","is child task of"). - Note: The values can vary between organisations — check with your Jira admin or via the Jira REST API (
https://jira.yourwebsite.com/rest/api/2/issue/ABC-100orhttps://jira.yourwebsite.com/rest/api/2/issueLinkType).
- The script accepts a CSV file as its only argument:
python3 JiraTicketMaker.py JiraTicketMakerInput.csv - This CSV file is typically created by the user (a Product Owner or a developer who works with Jira for tracking the progress)
- The CSV must have the following columns in order:
| Column | Description |
|---|---|
Project |
Jira project key (e.g. ABC) |
IssueType |
Story or Task |
Assignee |
Assignee's short user ID |
Summary |
Title of the ticket |
FeatureID |
Jira key of the parent Feature to link to (e.g. ABC-1) |
StoryID |
Jira key of the parent Story for Tasks. Use a Story's Summary text if the Story is being created in the same run and the key is not yet known — it will be resolved automatically. Use null if not applicable. |
TemplateID |
Jira key of an existing template ticket to copy Description, DoR, Acceptance Criteria and DoD from. E.g. ABC-100, ABC-101 |
Example:
Project,IssueType,Assignee,Summary,FeatureID,StoryID,TemplateID
ABC,Story,assignee_id,My Story Title,ABC-1,null,ABC-100
ABC,Task,assignee_id,My Task Title,ABC-1,My Story Title,ABC-101
Script automatically takes care of linking the tickets together based on the CSV input by reading the link types from the fields.json file.
Important thing to note: The column StoryID for "Story" is null. However, the column StoryID for “Task” should contain the title of the story so that linkages are taken care by the script in a 2-pass approach.
Assumptions:
- The script assumes that templates (ABC-100 and ABC-101) are manually created by the User in their Jira portal.
- The script assumes that Feature/Epic (ABC-1) is already provided in the Jira portal.