Skip to content

Commit d79f0b3

Browse files
authored
Move documentation from README to docs/ folder (#482)
1 parent 4137521 commit d79f0b3

File tree

5 files changed

+310
-307
lines changed

5 files changed

+310
-307
lines changed

.secrets.baseline

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -115,16 +115,7 @@
115115
"is_verified": false,
116116
"line_number": 13
117117
}
118-
],
119-
"README.md": [
120-
{
121-
"type": "Hex High Entropy String",
122-
"filename": "README.md",
123-
"hashed_secret": "04e78d6e804f2b59e6cb282cb9ed2c7bfd8a9737",
124-
"is_verified": false,
125-
"line_number": 244
126-
}
127118
]
128119
},
129-
"generated_at": "2023-04-11T14:18:10Z"
120+
"generated_at": "2023-04-25T15:55:52Z"
130121
}

README.md

Lines changed: 16 additions & 297 deletions
Original file line numberDiff line numberDiff line change
@@ -12,172 +12,6 @@ System to sync Bugzilla bugs to Jira issues.
1212
- The events are transformed into Jira issues
1313
- The system sets the `see_also` field of the Bugzilla bug with the URL to the Jira issue
1414

15-
## Action Configuration
16-
The system reads the actions configuration from a YAML file, one per environment. Each entry controls the synchronization between Bugzilla tickets and the Jira issues.
17-
18-
19-
Below is a full example of an action configuration:
20-
```yaml
21-
- whiteboard_tag: example
22-
allow_private: false
23-
bugzilla_user_id: 514230
24-
description: example configuration
25-
module: jbi.actions.default
26-
parameters:
27-
jira_project_key: EXMPL
28-
```
29-
30-
A bit more about the different fields...
31-
- `whiteboard_tag`
32-
- string
33-
- The tag to be matched in the Bugzilla `whiteboard` field
34-
- `allow_private` (optional)
35-
- bool [true, false]
36-
- default: false
37-
- If false bugs that are not public will not be synchronized. Note that in order to synchronize
38-
private bugs the bugzilla user that JBI runs as must be in the security groups that are making
39-
the bug private.
40-
- `bugzilla_user_id`
41-
- a bugzilla user id, a list of user ids, or a literal "tbd" to signify that no bugzilla user id is available
42-
- If an issue arises with the workflow, communication will be established with these users
43-
- Please enter the user information for one or more stakeholders
44-
- `description`
45-
- string
46-
- Please enter a description; for example, team name or project use-case.
47-
- `enabled` (optional)
48-
- bool [true, false]
49-
- default: true
50-
- If false, matching events will not be synchronized
51-
- `module` (optional)
52-
- string
53-
- default: [jbi.actions.default](jbi/actions/default.py)
54-
- The specified Python module must be available in the `PYTHONPATH`
55-
- `parameters` (optional)
56-
- dict
57-
- default: {}
58-
- The parameters will be validated to ensure the selected action accepts the specified values
59-
60-
61-
[View 'nonprod' configurations here.](config/config.nonprod.yaml)
62-
63-
[View 'prod' configurations here.](config/config.prod.yaml)
64-
65-
66-
## Available Actions
67-
68-
### Default
69-
The `jbi.actions.default` action will take the list of steps to be executed when
70-
the Webhook is received from configuration.
71-
When none is specified, it will create or update the Jira issue, publish comments when
72-
assignee, status, or resolution are changed, or when a comment is posted on the Bugzilla ticket.
73-
74-
It will also set the Jira issue URL in the Bugzilla bug `see_also` field, and add a link
75-
to the Bugzilla ticket on the Jira issue.
76-
77-
**Parameters**
78-
79-
- `jira_project_key` (**mandatory**)
80-
- string
81-
- The Jira project identifier
82-
- `steps` (optional)
83-
- mapping [str, list[str]]
84-
- If defined, the specified steps are executed. The group of steps listed under `new` are executed when a Bugzilla event occurs on a ticket that is unknown to Jira. The steps under `existing`, when the Bugzilla ticket is already linked to a Jira issue. The steps under `comment` when a comment is posted on a linked Bugzilla ticket.
85-
If one of these groups is not specified, the default steps will be used.
86-
- `jira_components` (optional)
87-
- list [str]
88-
- If defined, the created issues will be assigned the specified components.
89-
- `sync_whiteboard_labels` (optional)
90-
- boolean
91-
- Whether to sync the Bugzilla status whiteboard labels to Jira. Defaults to `true`.
92-
- `status_map` (optional)
93-
- mapping [str, str]
94-
- If defined, map the Bugzilla bug status (or resolution) to Jira issue status
95-
- `resolution_map` (optional)
96-
- mapping [str, str]
97-
- If defined, map the Bugzilla bug resolution to Jira issue resolution
98-
99-
Minimal configuration:
100-
```yaml
101-
whiteboard_tag: example
102-
bugzilla_user_id: 514230
103-
description: minimal configuration
104-
parameters:
105-
jira_project_key: EXMPL
106-
```
107-
108-
Full configuration, that will set assignee, change the Jira issue status and resolution.
109-
110-
```yaml
111-
- whiteboard_tag: fidefe
112-
bugzilla_user_id: 514230
113-
description: full configuration
114-
module: jbi.actions.default
115-
parameters:
116-
jira_project_key: FIDEFE
117-
steps:
118-
new:
119-
- create_issue
120-
- maybe_delete_duplicate
121-
- add_link_to_bugzilla
122-
- add_link_to_jira
123-
- maybe_assign_jira_user
124-
- maybe_update_issue_resolution
125-
- maybe_update_issue_status
126-
existing:
127-
- update_issue
128-
- add_jira_comments_for_changes
129-
- maybe_assign_jira_user
130-
- maybe_update_issue_resolution
131-
- maybe_update_issue_status
132-
comment:
133-
- create_comment
134-
status_map:
135-
ASSIGNED: In Progress
136-
FIXED: Closed
137-
WONTFIX: Closed
138-
DUPLICATE: Closed
139-
INVALID: Closed
140-
INCOMPLETE: Closed
141-
WORKSFORME: Closed
142-
REOPENED: In Progress
143-
resolution_map:
144-
FIXED: Done
145-
DUPLICATE: Duplicate
146-
WONTFIX: "Won't Do"
147-
```
148-
149-
In this case if the bug changes to the NEW status the action will attempt to set the linked Jira
150-
issue status to "In Progress". If the bug changes to RESOLVED FIXED it will attempt to set the
151-
linked Jira issue status to "Closed". If the bug changes to a status not listed in `status_map` then
152-
no change will be made to the Jira issue.
153-
### Available Steps
154-
155-
- `create_issue`
156-
- `maybe_delete_duplicate`
157-
- `add_link_to_bugzilla`
158-
- `add_link_to_jira`
159-
- `maybe_assign_jira_user`:
160-
It will attempt to assign the Jira issue the same person as the bug is assigned to. This relies on
161-
the user using the same email address in both Bugzilla and Jira. If the user does not exist in Jira
162-
then the assignee is cleared from the Jira issue. The Jira account that JBI uses requires the "Browse
163-
users and groups" global permission in order to set the assignee.
164-
- `maybe_update_issue_resolution`:
165-
If the Bugzilla ticket resolution field is specified in the `resolution_map` parameter, it will set the
166-
Jira issue resolution.
167-
- `maybe_update_issue_status`:
168-
If the Bugzilla ticket status field is specified in the `status_map` parameter, it will set the
169-
Jira issue status.
170-
- `update_issue`
171-
- `add_jira_comments_for_changes`
172-
- `maybe_assign_jira_user`
173-
- `maybe_update_issue_resolution`
174-
- `maybe_update_issue_status`
175-
- `create_comment`
176-
177-
### Custom Actions
178-
179-
If you're looking for a unique capability for your team's data flow, you can add your own Python methods and functionality[...read more here.](jbi/actions/README.md)
180-
18115
## Diagram Overview
18216

18317
``` mermaid
@@ -195,142 +29,27 @@ graph TD
19529
end
19630
```
19731

198-
## Development
199-
200-
- `make start`: run the application locally (http://localhost:8000)
201-
- `make test`: run the unit tests suites
202-
- `make lint`: static analysis of the code base
203-
204-
You may consider:
205-
206-
* Tweaking the application settings in the `.env` file (See `src/app/environment.py` for details)
207-
* Installing a pre-commit hook to lint your changes with `pre-commit install`
208-
209-
## Deployment
210-
211-
Software and configuration are deployed automatically:
212-
213-
- on NONPROD when a pull-request is merged
214-
- on PROD when a tag is pushed
215-
216-
| Env | Base URL |
217-
|---------|------------------------------------------------|
218-
| Nonprod | https://stage.jbi.nonprod.cloudops.mozgcp.net/ |
219-
| Prod | https://jbi.services.mozilla.com/ |
220-
221-
In order to view the configured Jira and Bugzilla, check the root URL:
222-
223-
```
224-
GET /
225-
226-
{
227-
"configuration": {
228-
"bugzilla_base_url": "https://bugzilla-dev.allizom.org",
229-
"jira_base_url": "https://mozit-test.atlassian.net/"
230-
},
231-
"description": "JBI v2 Platform",
232-
"documentation": "/docs",
233-
"title": "Jira Bugzilla Integration (JBI)",
234-
"version": "X.Y.Z"
235-
}
236-
```
237-
238-
In order to verify that a certain commit was deployed, check that the Github Actions executed successfully on the commit, and use the *Version* endpoint:
239-
240-
```
241-
GET /__version__
242-
243-
{
244-
"commit": "1ea792a733d704e0094fe6065ee64b2a3435f280",
245-
"version": "refs/tags/vX.Y.Z",
246-
"source": "https://github.com/mozilla/jira-bugzilla-integration",
247-
"build": "https://github.com/mozilla/jira-bugzilla-integration/actions/runs/2315380477"
248-
}
249-
```
250-
251-
In order to verify that a certain action is configured correctly and enabled, use the *Powered By JBI* endpoint: [https://${SERVER}/powered_by_jbi](https://jbi.services.mozilla.com/powered_by_jbi)
252-
253-
For the list of configured whiteboard tags:
254-
255-
```
256-
GET /whiteboard_tags/
257-
{
258-
"addons": {
259-
"whiteboard_tag": "addons",
260-
"bugzilla_user_id": 514230,
261-
"description": "Addons whiteboard tag for AMO Team",
262-
"enabled": true,
263-
"module": "jbi.actions.default",
264-
"parameters": {
265-
"jira_project_key": "WEBEXT"
266-
}
267-
}
268-
...
269-
}
270-
```
271-
272-
## Troubleshooting
273-
274-
### Bugzilla tickets are not showing up as issues on Jira
275-
276-
As a consumer, you can:
277-
278-
- Open https://jbi.services.mozilla.com/powered_by_jbi/ and check that your project is listed and enabled there
279-
- Open https://jbi.services.mozilla.com/__heartbeat__ and make sure everything is `true`
32+
## Documentation
28033

281-
If you have access to the configured Bugzilla account:
34+
* [Actions](docs/actions.md)
35+
* [Deployment](docs/deployment.md)
36+
* [Troubleshooting](docs/troubleshooting.md)
28237

283-
- Open https://bugzilla.mozilla.org/userprefs.cgi?tab=webhooks
284-
- Check that Webhook is still **enabled**
285-
- Check that WebHook is setup to be executed for your product
286-
- (*if applies*) Check that account can read the private bugs
38+
## Usage
28739

288-
### Log Explorer Queries Examples
40+
### How to onboard a new project?
28941

290-
* All incoming WebHooks:
42+
1. Add an entry for your whiteboard tag (eg. `famous-product`) in the [actions configuration files](config/). See [actions documentation](docs/actions.md))
43+
2. Open a pull-request with your action configuration changes
44+
3. Open a ticket to request the appropriate permissions to be given to the bot account (`Jira Automation`) on the Jira project ([example ticket](https://mozilla-hub.atlassian.net/servicedesk/customer/portal/4/SDD-12038))
29145

292-
```
293-
jsonPayload.Type="request.summary"
294-
jsonPayload.Fields.path="/bugzilla_webhook"
295-
```
296-
297-
* All action log entries:
46+
# Development
29847

299-
```
300-
jsonPayload.Type!="request.summary" AND
301-
(
302-
NOT jsonPayload.Fields.operation:* --Entries without `operation` field
303-
OR (jsonPayload.Fields.operation!="handle" AND jsonPayload.Fields.operation!="ignore")
304-
)
305-
```
306-
307-
* For bugs whose whiteboard contains a certain string:
308-
309-
```
310-
jsonPayload.Fields.bug.whiteboard=~"flowstate"
311-
```
312-
313-
* For a certain Bug number:
314-
315-
```
316-
jsonPayload.Fields.bug.id=1780798
317-
```
318-
319-
* For a certain Jira project:
320-
321-
```
322-
jsonPayload.Fields.action.parameters.jira_project_key="MR"
323-
```
324-
325-
326-
## Metrics
48+
- `make start`: run the application locally (http://localhost:8000)
49+
- `make test`: run the unit tests suites
50+
- `make lint`: static analysis of the code base
32751

328-
The following metrics are sent via StatsD:
52+
You may consider:
32953

330-
- `jbi.bugzilla.ignored.count`
331-
- `jbi.bugzilla.processed.count`
332-
- `jbi.action.execution.timer`
333-
- `jbi.jira.methods.*.count`
334-
- `jbi.jira.methods.*.timer`
335-
- `jbi.bugzilla.methods.*.count`
336-
- `jbi.bugzilla.methods.*.timer`
54+
* Tweaking the application settings in the `.env` file (See [jbi/environment.py](../jbi/environment.py) for details)
55+
* Installing a pre-commit hook to lint your changes with `pre-commit install`

0 commit comments

Comments
 (0)