Skip to content

Commit aed62c0

Browse files
documentation fixes
1 parent 28fcdd8 commit aed62c0

File tree

3 files changed

+75
-42
lines changed

3 files changed

+75
-42
lines changed

docs/utility-guides/JiraConfluenceUtil.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ The `JiraConfluenceUtil` utility provides methods for interacting with Jira and
1313
- [Required Environment Variables](#required-environment-variables)
1414
- [Initialise the class](#initialise-the-class)
1515
- [Public Methods](#public-methods)
16-
- [get\_issue\_data](#get_issue_data)
17-
- [get\_issue\_summary\_in\_issue\_data](#get_issue_summary_in_issue_data)
18-
- [check\_attachment\_exists\_in\_issue\_data](#check_attachment_exists_in_issue_data)
19-
- [is\_valid\_jira\_reference](#is_valid_jira_reference)
20-
- [determine\_jira\_reference\_local](#determine_jira_reference_local)
21-
- [get\_environment\_metadata\_if\_available](#get_environment_metadata_if_available)
22-
- [is\_file\_is\_less\_than\_jira\_file\_limit](#is_file_is_less_than_jira_file_limit)
23-
- [upload\_test\_results\_dir\_to\_jira](#upload_test_results_dir_to_jira)
16+
- [`get_issue_data`](#get_issue_data)
17+
- [`get_issue_summary_in_issue_data`](#get_issue_summary_in_issue_data)
18+
- [`check_attachment_exists_in_issue_data`](#check_attachment_exists_in_issue_data)
19+
- [`is_valid_jira_reference`](#is_valid_jira_reference)
20+
- [`determine_jira_reference_local`](#determine_jira_reference_local)
21+
- [`get_environment_metadata_if_available`](#get_environment_metadata_if_available)
22+
- [`is_file_is_less_than_jira_file_limit`](#is_file_is_less_than_jira_file_limit)
23+
- [`upload_test_results_dir_to_jira`](#upload_test_results_dir_to_jira)
2424
- [Example Usage](#example-usage)
2525

2626
## Using the JiraConfluenceUtil class
@@ -60,7 +60,7 @@ util = JiraConfluenceUtil(results_dir="path/to/results")
6060

6161
## Public Methods
6262

63-
### get_issue_data
63+
### `get_issue_data`
6464

6565
```python
6666
get_issue_data(ticket_id: str) -> dict | None
@@ -70,7 +70,7 @@ Checks if a Jira issue exists and returns its data as a dictionary, or `None` if
7070

7171
---
7272

73-
### get_issue_summary_in_issue_data
73+
### `get_issue_summary_in_issue_data`
7474

7575
```python
7676
get_issue_summary_in_issue_data(issue_data: dict) -> str | None
@@ -80,7 +80,7 @@ Returns a summary string for the given Jira issue data in the format "[Ticket]:
8080

8181
---
8282

83-
### check_attachment_exists_in_issue_data
83+
### `check_attachment_exists_in_issue_data`
8484

8585
```python
8686
check_attachment_exists_in_issue_data(issue_data: dict, filename: str) -> bool
@@ -90,7 +90,7 @@ Checks if a Jira issue already has an attachment with the specified filename.
9090

9191
---
9292

93-
### is_valid_jira_reference
93+
### `is_valid_jira_reference`
9494

9595
```python
9696
is_valid_jira_reference(ticket_id: str) -> bool
@@ -100,7 +100,7 @@ Validates that the Jira ticket reference is in the expected format (e.g., `SCM-1
100100

101101
---
102102

103-
### determine_jira_reference_local
103+
### `determine_jira_reference_local`
104104

105105
```python
106106
determine_jira_reference_local() -> str
@@ -118,7 +118,7 @@ This is currently configured to search for the format `feature/[Jira Reference]`
118118
119119
---
120120

121-
### get_environment_metadata_if_available
121+
### `get_environment_metadata_if_available`
122122

123123
```python
124124
get_environment_metadata_if_available() -> str
@@ -133,7 +133,7 @@ designed to be overwritten.
133133
134134
---
135135

136-
### is_file_is_less_than_jira_file_limit
136+
### `is_file_is_less_than_jira_file_limit`
137137

138138
```python
139139
is_file_is_less_than_jira_file_limit(file_path: Path) -> bool
@@ -143,7 +143,7 @@ Checks if the file size is below the Jira upload limit (10MB).
143143

144144
---
145145

146-
### upload_test_results_dir_to_jira
146+
### `upload_test_results_dir_to_jira`
147147

148148
```python
149149
upload_test_results_dir_to_jira(

jira_upload.py

Lines changed: 58 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,27 @@
44
CI/CD operations.
55
66
The following environment variables need to be set (in local.env if running locally) before this can upload any files:
7-
- JIRA_URL: The Jira instance to upload to.
8-
- JIRA_PROJECT_KEY: The Jira project key that should be uploaded to.
9-
- JIRA_API_KEY: The API key to use to complete actions. Locally you should generate your own key, and use a bot in a pipeline/workflow.
7+
- JIRA_URL: The Jira instance to upload to.
8+
- JIRA_PROJECT_KEY: The Jira project key that should be uploaded to.
9+
- JIRA_API_KEY: The API key to use to complete actions. Locally you should generate your own key, and use a bot in a pipeline/workflow.
1010
1111
The following environment variables are optional:
12-
- JIRA_TICKET_REFERENCE: The Jira ticket to push to if set. If not, will attempt to derive the value from the git branch.
12+
- JIRA_TICKET_REFERENCE: The Jira ticket to push to if set. If not, will attempt to derive the value from the git branch.
1313
1414
The script itself can be executed using the following command:
1515
python jira_upload.py
1616
1717
The following arguments are supported in addition:
18-
--jira-ref <Jira Reference> = The Jira ticket to upload to. Will take precedence over auto-deriving from branch name and the set environment variable.
19-
--results-dir <Directory> = The directory to point to. If not set, points to test-results/ in this directory.
20-
--no-html = Don't include HTML files in the upload.
21-
--no-trace = Don't include Trace files (.zip) in the upload.
22-
--no-csv = Don't include CSV files in the upload.
23-
--no-screenshots = Don't include screenshots (.png) in the upload.
24-
--no-comment = Don't add a Jira comment highlighting the results.
25-
--no-env-data = Don't include environment data in the Jira comment.
26-
--overwrite-files = If a filename exists on the ticket that matches those in the results directory, overwrite them.
27-
--auto-confirm = Will not ask if you want to proceed if set, and will assume that yes has been pressed.
18+
--jira-ref <Jira Reference> = The Jira ticket to upload to. Will take precedence over auto-deriving from branch name and the set environment variable.
19+
--results-dir <Directory> = The directory to point to. If not set, points to test-results/ in this directory.
20+
--no-html = Don't include HTML files in the upload.
21+
--no-trace = Don't include Trace files (.zip) in the upload.
22+
--no-csv = Don't include CSV files in the upload.
23+
--no-screenshots = Don't include screenshots (.png) in the upload.
24+
--no-comment = Don't add a Jira comment highlighting the results.
25+
--no-env-data = Don't include environment data in the Jira comment.
26+
--overwrite-files = If a filename exists on the ticket that matches those in the results directory, overwrite them.
27+
--auto-confirm = Will not ask if you want to proceed if set, and will assume that yes has been pressed.
2828
"""
2929

3030
import argparse
@@ -38,10 +38,18 @@ def upload_jira_files(args: argparse.Namespace) -> None:
3838
Jira.
3939
"""
4040
try:
41-
jira_instance = JiraConfluenceUtil() if args.results_dir is None else JiraConfluenceUtil(results_dir=args.results_dir)
41+
jira_instance = (
42+
JiraConfluenceUtil()
43+
if args.results_dir is None
44+
else JiraConfluenceUtil(results_dir=args.results_dir)
45+
)
4246

4347
if args.jira_ref is not None:
44-
jira_ref = args.jira_ref if jira_instance.is_valid_jira_reference(args.jira_ref) else ""
48+
jira_ref = (
49+
args.jira_ref
50+
if jira_instance.is_valid_jira_reference(args.jira_ref)
51+
else ""
52+
)
4553
else:
4654
jira_ref = jira_instance.determine_jira_reference_local()
4755

@@ -57,7 +65,7 @@ def upload_jira_files(args: argparse.Namespace) -> None:
5765
include_csv=not args.no_csv,
5866
include_env_metadata=not args.no_env_data,
5967
add_comment=not args.no_comment,
60-
automatically_accept=args.auto_confirm
68+
automatically_accept=args.auto_confirm,
6169
)
6270
except Exception as e:
6371
print("An error has been encountered so exiting upload process")
@@ -69,15 +77,39 @@ def upload_jira_files(args: argparse.Namespace) -> None:
6977
parser = argparse.ArgumentParser(
7078
description="Upload test results from the test-results directory."
7179
)
72-
parser.add_argument("--jira-ref", type=str, help="Specify the Jira reference to upload to")
73-
parser.add_argument("--results-dir", type=str, help="Specify the results directory to upload from")
74-
parser.add_argument("--no-html", action="store_true", help="Don't include HTML files in upload")
75-
parser.add_argument("--no-trace", action="store_true", help="Don't include trace files")
80+
parser.add_argument(
81+
"--jira-ref", type=str, help="Specify the Jira reference to upload to"
82+
)
83+
parser.add_argument(
84+
"--results-dir", type=str, help="Specify the results directory to upload from"
85+
)
86+
parser.add_argument(
87+
"--no-html", action="store_true", help="Don't include HTML files in upload"
88+
)
89+
parser.add_argument(
90+
"--no-trace", action="store_true", help="Don't include trace files"
91+
)
7692
parser.add_argument("--no-csv", action="store_true", help="Don't include CSV files")
77-
parser.add_argument("--no-screenshots", action="store_true", help="Don't include screenshots")
78-
parser.add_argument("--no-comment", action="store_true", help="Don't include a comment")
79-
parser.add_argument("--no-env-data", action="store_true", help="Don't include environment metadata in comment")
80-
parser.add_argument("--overwrite-files", action="store_true", help="If files are already on the Jira ticket with the same name, overwrite them with this file.")
81-
parser.add_argument("--auto-confirm", action="store_true", help="Don't prompt to confirm actions before proceeding")
93+
parser.add_argument(
94+
"--no-screenshots", action="store_true", help="Don't include screenshots"
95+
)
96+
parser.add_argument(
97+
"--no-comment", action="store_true", help="Don't include a comment"
98+
)
99+
parser.add_argument(
100+
"--no-env-data",
101+
action="store_true",
102+
help="Don't include environment metadata in comment",
103+
)
104+
parser.add_argument(
105+
"--overwrite-files",
106+
action="store_true",
107+
help="If files are already on the Jira ticket with the same name, overwrite them with this file.",
108+
)
109+
parser.add_argument(
110+
"--auto-confirm",
111+
action="store_true",
112+
help="Don't prompt to confirm actions before proceeding",
113+
)
82114
args = parser.parse_args()
83115
upload_jira_files(args)

scripts/config/vale/styles/config/vocabularies/words/accept.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Dependabot
66
Gitleaks
77
Grype
88
idempotence
9+
Jira
910
OAuth
1011
Octokit
1112
onboarding

0 commit comments

Comments
 (0)