Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion api/cloud/jira_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ def get_project_by_project_id_or_key(project_id_or_key):
return jira_cloud_api.get_project_by_project_id_or_key(project_id_or_key)


def create_issue(project, issue_type, issue_summary, dry_run):
def create_issue(project, issue_type, issue_summary, dry_run, issue_description=""):
request_body = {"fields": {"summary": issue_summary, "issuetype": {"id": issue_type}, "project": {"id": project}}}
if issue_description != "":
# See https://www.atlassian.com/blog/developer/creating-a-jira-cloud-issue-in-a-single-rest-call
request_body["fields"]["description"] = {"type": "doc", "version": 1, "content": [ {"type": "paragraph", "content": [ {"text": issue_description, "type": "text"} ] } ] }
if dry_run:
message = f"Created issue folder with the summary: {issue_summary}"
write_logging_dry_run_message(message, request_body)
Expand Down
3 changes: 2 additions & 1 deletion utilities/migrate_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ def create_issue_folders_in_cloud(project_key, data_center_tree_folders, dry_run
return cloud_tree_issue_folders

for folder in data_center_tree_folders:
issue_description = folder["description"] if "description" in folder.keys() else ""
response = cloud_jira_helper.create_issue(project_id, int(folder_issue_type), folder["summary"],
dry_run=dry_run)
dry_run=dry_run, issue_description=issue_description)
if response is not None:
if response.status_code == 201:
created_issue = response.json()
Expand Down
4 changes: 2 additions & 2 deletions utilities/transform_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ def read_and_process_tree_items(data_input, _data_output, level=1):

position_increment = 0
for folder in data_input["folders"]:
data_folders = {"id": folder["id"], "summary": folder["name"], "folders": folder["folders"], "issues": folder["issues"]}
data_folders = {"id": folder["id"], "summary": folder["name"], "description": folder["description"], "folders": folder["folders"], "issues": folder["issues"]}

if "absolutePosition" in folder:
position = folder["absolutePosition"]
else:
position = folder["position"]
position_increment = position_increment + 1

_data_output.append({"parent": root, "id": folder["id"], "summary": folder["name"], "position": position,
_data_output.append({"parent": root, "id": folder["id"], "summary": folder["name"], "description": folder["description"], "position": position,
"level": level, "is_folder": True})
read_and_process_tree_items(data_folders, _data_output, level + 1)

Expand Down