Skip to content

Commit 6fcb1fc

Browse files
Config contact as bugzilla user id (#440)
* [DISCO] Adding bugzilla id as contact. * [config] convert contact's in actions to user id. * updates to action model; contacts are now int's and no longer email's. * [fxp] setting user_id based on investigated usage. * action configuration change; from email's to bugzilla user id. * Updates from review
1 parent d79caea commit 6fcb1fc

File tree

8 files changed

+72
-50
lines changed

8 files changed

+72
-50
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Below is a full example of an action configuration:
1919
```yaml
2020
- whiteboard_tag: example
2121
allow_private: false
22-
22+
bugzilla_user_id: 514230
2323
description: example configuration
2424
module: jbi.actions.default
2525
parameters:
@@ -36,10 +36,10 @@ A bit more about the different fields...
3636
- If false bugs that are not public will not be synchronized. Note that in order to synchronize
3737
private bugs the bugzilla user that JBI runs as must be in the security groups that are making
3838
the bug private.
39-
- `contact`
40-
- an email address, a list of email addresses, or a literal "tbd" to signify that no contact is available
41-
- If an issue arises with the workflow, communication will be established with these contacts
42-
- Please enter the contact information for one or more stakeholders
39+
- `bugzilla_user_id`
40+
- a bugzilla user id, a list of user ids, or a literal "tbd" to signify that no bugzilla user id is available
41+
- If an issue arises with the workflow, communication will be established with these users
42+
- Please enter the user information for one or more stakeholders
4343
- `description`
4444
- string
4545
- Please enter a description; for example, team name or project use-case.
@@ -98,7 +98,7 @@ to the Bugzilla ticket on the Jira issue.
9898
Minimal configuration:
9999
```yaml
100100
whiteboard_tag: example
101-
101+
bugzilla_user_id: 514230
102102
description: minimal configuration
103103
parameters:
104104
jira_project_key: EXMPL
@@ -108,7 +108,7 @@ Full configuration, that will set assignee, change the Jira issue status and res
108108

109109
```yaml
110110
- whiteboard_tag: fidefe
111-
111+
bugzilla_user_id: 514230
112112
description: full configuration
113113
module: jbi.actions.default
114114
parameters:
@@ -256,7 +256,7 @@ GET /whiteboard_tags/
256256
{
257257
"addons": {
258258
"whiteboard_tag": "addons",
259-
"contact": "[email protected]",
259+
"bugzilla_user_id": 514230,
260260
"description": "Addons whiteboard tag for AMO Team",
261261
"enabled": true,
262262
"module": "jbi.actions.default",

config/config.local.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# Action Config
33
- whiteboard_tag: devtest
4-
contact: tbd
4+
bugzilla_user_id: tbd
55
description: DevTest whiteboard tag
66
parameters:
77
jira_project_key: DevTest

config/config.nonprod.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
# Action Config
33
- whiteboard_tag: nonprodtest
4-
4+
bugzilla_user_id: 644672
55
description: Nonprod testing whiteboard tag (JBI Bin Project)
66
parameters:
77
jira_project_key: JB
88

99
- whiteboard_tag: flowstate
1010
allow_private: true
11-
11+
bugzilla_user_id: 91159
1212
description: Flowstate whiteboard tag
1313
parameters:
1414
jira_project_key: JB
@@ -32,7 +32,7 @@
3232
REOPENED: In Progress
3333

3434
- whiteboard_tag: fxcm
35-
35+
bugzilla_user_id: tbd
3636
description: Firefox Credential Management Team whiteboard tag
3737
parameters:
3838
jira_project_key: JB
@@ -65,7 +65,7 @@
6565
MOVED: Done
6666

6767
- whiteboard_tag: fxdroid
68-
68+
bugzilla_user_id: 430528
6969
description: Firefox Android Team Tag
7070
parameters:
7171
jira_project_key: JB
@@ -98,7 +98,7 @@
9898
MOVED: Closed
9999

100100
- whiteboard_tag: fxp
101-
101+
bugzilla_user_id: 396948
102102
description: Performance Team
103103
parameters:
104104
jira_project_key: JB
@@ -135,7 +135,7 @@
135135
MOVED: Done
136136

137137
- whiteboard_tag: sp3
138-
138+
bugzilla_user_id: 396948
139139
description: Speedometer 3
140140
parameters:
141141
jira_project_key: JB

config/config.prod.yaml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
22
# Action Config
33
- whiteboard_tag: addons
4-
contact: tbd
4+
bugzilla_user_id: tbd
55
description: Addons whiteboard tag for AMO Team
66
# module: jbi.actions.default
77
parameters:
88
jira_project_key: WEBEXT
99

1010
- whiteboard_tag: fidedi
11-
contact: tbd
11+
bugzilla_user_id: tbd
1212
description: Firefox Desktop Integration whiteboard tag
1313
parameters:
1414
jira_project_key: FIDEDI
1515

1616
- whiteboard_tag: fidefe
17-
17+
bugzilla_user_id: 159069
1818
description: Firefox Front End whiteboard tag
1919
parameters:
2020
jira_project_key: FIDEFE
@@ -43,7 +43,7 @@
4343
REOPENED: In Progress
4444

4545
- whiteboard_tag: flowstate
46-
46+
bugzilla_user_id: 91159
4747
description: Flowstate whiteboard tag
4848
parameters:
4949
jira_project_key: MR2
@@ -68,13 +68,13 @@
6868
REOPENED: In Progress
6969

7070
- whiteboard_tag: fxatps
71-
contact: tbd
71+
bugzilla_user_id: tbd
7272
description: Privacy & Security and Anti-Tracking Team whiteboard tag
7373
parameters:
7474
jira_project_key: FXATPS
7575

7676
- whiteboard_tag: fxcm
77-
77+
bugzilla_user_id: 713707
7878
description: Firefox Credential Management Team whiteboard tag
7979
parameters:
8080
jira_project_key: FXCM
@@ -107,7 +107,7 @@
107107
MOVED: Done
108108

109109
- whiteboard_tag: fxdroid
110-
110+
bugzilla_user_id: 430528
111111
description: Firefox Android Team Tag
112112
parameters:
113113
jira_project_key: FXDROID
@@ -140,7 +140,7 @@
140140
MOVED: Closed
141141

142142
- whiteboard_tag: fxp
143-
143+
bugzilla_user_id: 396948
144144
description: Performance Team
145145
parameters:
146146
jira_project_key: FXP
@@ -177,63 +177,63 @@
177177
MOVED: Done
178178

179179
- whiteboard_tag: fxsync
180-
contact: tbd
180+
bugzilla_user_id: 624105
181181
description: Firefox Sync Team whiteboard tag
182182
parameters:
183183
jira_project_key: SYNC
184184

185185
- whiteboard_tag: disco
186-
contact: tbd
186+
bugzilla_user_id: 624105
187187
description: DISCO whiteboard tag
188188
parameters:
189189
jira_project_key: DISCO
190190

191191
- whiteboard_tag: mv3
192-
contact: tbd
192+
bugzilla_user_id: tbd
193193
description: MV3 whiteboard tag
194194
parameters:
195195
jira_project_key: WEBEXT
196196

197197
- whiteboard_tag: nimbus
198-
contact: tbd
198+
bugzilla_user_id: 624105
199199
description: Nimbus whiteboard tag
200200
parameters:
201201
jira_project_key: EXP
202202

203203
- whiteboard_tag: prodtest
204-
204+
bugzilla_user_id: 644672
205205
description: Prod testing whiteboard tag (JBI Bin Project)
206206
parameters:
207207
jira_project_key: JB
208208

209209
- whiteboard_tag: proton
210-
contact: tbd
210+
bugzilla_user_id: tbd
211211
description: Proton whiteboard tag for Firefox Frontend
212212
parameters:
213213
jira_project_key: FIDEFE
214214

215215
- whiteboard_tag: relops
216-
contact: tbd
216+
bugzilla_user_id: tbd
217217
description: Release Operations Team Tag
218218
parameters:
219219
jira_project_key: RELOPS
220220

221221
- whiteboard_tag: remote-settings
222-
222+
bugzilla_user_id: 576226
223223
description: Remote Settings Server issues
224224
parameters:
225225
jira_project_key: SE
226226
jira_components:
227227
- "Remote Settings"
228228

229229
- whiteboard_tag: snt
230-
230+
bugzilla_user_id: 696039
231231
description: Search/NewTab Team Tag
232232
parameters:
233233
jira_project_key: SNT
234234

235235
- whiteboard_tag: sp3
236-
236+
bugzilla_user_id: 396948
237237
description: Speedometer 3
238238
parameters:
239239
jira_project_key: SP3

jbi/models.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,7 @@
1111
from typing import Any, Callable, Literal, Mapping, Optional, TypedDict
1212
from urllib.parse import ParseResult, urlparse
1313

14-
from pydantic import (
15-
BaseModel,
16-
EmailStr,
17-
Extra,
18-
Field,
19-
PrivateAttr,
20-
root_validator,
21-
validator,
22-
)
14+
from pydantic import BaseModel, Extra, Field, PrivateAttr, root_validator, validator
2315
from pydantic_yaml import YamlModel
2416

2517
from jbi import Operation
@@ -36,8 +28,7 @@ class Action(YamlModel):
3628

3729
whiteboard_tag: str
3830
module: str = "jbi.actions.default"
39-
# TODO: Remove the tbd literal option when all actions have contact info # pylint: disable=fixme
40-
contact: EmailStr | list[EmailStr] | Literal["tbd"]
31+
bugzilla_user_id: int | list[int] | Literal["tbd"]
4132
description: str
4233
enabled: bool = True
4334
allow_private: bool = False
@@ -129,17 +120,17 @@ def validate_actions( # pylint: disable=no-self-argument
129120
"""
130121
Inspect the list of actions:
131122
- Validate that lookup tags are uniques
132-
- If the action's contact is "tbd", emit a warning.
123+
- If the action's bugzilla_user_id is "tbd", emit a warning.
133124
"""
134125
tags = [action.whiteboard_tag.lower() for action in actions]
135126
duplicated_tags = [t for i, t in enumerate(tags) if t in tags[:i]]
136127
if duplicated_tags:
137128
raise ValueError(f"actions have duplicated lookup tags: {duplicated_tags}")
138129

139130
for action in actions:
140-
if action.contact == "tbd":
131+
if action.bugzilla_user_id == "tbd":
141132
warnings.warn(
142-
f"Provide contact data for `{action.whiteboard_tag}` action."
133+
f"Provide bugzilla_user_id data for `{action.whiteboard_tag}` action."
143134
)
144135

145136
return actions

tests/fixtures/bad-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
# Action Config
33
- whiteboard_tag: A
4-
contact: foobar
4+
bugzilla_user_id: foobar
55
description: test config
66
module: jbi.actions.default
77
parameters:

tests/fixtures/factories.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
def action_factory(**overrides):
1717
action = {
1818
"whiteboard_tag": "devtest",
19-
"contact": "tbd",
19+
"bugzilla_user_id": "tbd",
2020
"description": "test config",
2121
"module": "tests.fixtures.noop_action",
2222
"parameters": {

tests/unit/test_models.py

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ def test_model_serializes():
1010
action = Action.parse_obj(
1111
{
1212
"whiteboard_tag": "devtest",
13-
"contact": "[email protected]",
13+
"bugzilla_user_id": 123456,
1414
"description": "test config",
1515
"module": "tests.fixtures.bugzilla_action",
1616
}
@@ -21,6 +21,37 @@ def test_model_serializes():
2121
assert not serialized_action.get("caller")
2222

2323

24+
def test_model_with_user_list_serializes():
25+
"""Regression test to assert that action with initialized Bugzilla client serializes (with user id list)"""
26+
action = Action.parse_obj(
27+
{
28+
"whiteboard_tag": "devtest",
29+
"bugzilla_user_id": [123456, 654321, 000000, 111111],
30+
"description": "test config",
31+
"module": "tests.fixtures.bugzilla_action",
32+
}
33+
)
34+
action.caller(bug=None, event=None)
35+
serialized_action = jsonable_encoder(action)
36+
assert not serialized_action.get("_caller")
37+
assert not serialized_action.get("caller")
38+
39+
def test_model_with_user_list_of_one_serializes():
40+
"""Regression test to assert that action with initialized Bugzilla client serializes (with user id in list)"""
41+
action = Action.parse_obj(
42+
{
43+
"whiteboard_tag": "devtest",
44+
"bugzilla_user_id": [123456],
45+
"description": "test config",
46+
"module": "tests.fixtures.bugzilla_action",
47+
}
48+
)
49+
action.caller(bug=None, event=None)
50+
serialized_action = jsonable_encoder(action)
51+
assert not serialized_action.get("_caller")
52+
assert not serialized_action.get("caller")
53+
54+
2455
def test_no_actions_fails():
2556
with pytest.raises(ValueError) as exc_info:
2657
Actions.parse_obj([])

0 commit comments

Comments
 (0)