You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/projects/bot.md
+112Lines changed: 112 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -82,6 +82,8 @@ We publish two things (when issues are published):
82
82
83
83
For more information, read the [phabricator](/docs/phabricator.md) documentation.
84
84
85
+
See below, how to [test the publication on Phabricator](#test-the-publication-on-phabricator).
86
+
85
87
### Debug
86
88
87
89
The debug reporter lists all the issues in a public JSON artifact and sends an email to admins with the full list of issues.
@@ -97,3 +99,113 @@ Build errors are really bad, and we want to send an email to the developer when
97
99
The backend has no reporter as it's more tightly coupled to the bot system, but every issue is published on the backend.
98
100
99
101
Each Issue also has a unique hash calculated, using the modified lines source code, the issue summary. It's used to be able to compare issues between each other.
102
+
103
+
## Test the publication on Phabricator
104
+
### Submit a fake patch on Firefox
105
+
There is an [online documentation](https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html) that explains how to publish a patch on Firefox. Here are a few tips on how to simplify/accelerate this workflow.
106
+
107
+
In the repository, you can install dependencies using the command:
108
+
```
109
+
./mach bootstrap
110
+
```
111
+
:warning: Using `./mach build` as suggested in the documentation will result in a build that can take forever to complete.
112
+
113
+
Make a patch by editing one of Firefox files and then run the desired linter using the command:
114
+
```
115
+
./mach lint -l my_linter
116
+
```
117
+
118
+
For example, to run flake8 on the repository, you can use:
119
+
```
120
+
./mach lint -l flake8
121
+
```
122
+
123
+
### Retrieve `TRY_TASK_GROUP_ID` and `TRY_TASK_ID`
124
+
Once you have submitted a patch on Phabricator using `moz-phab`, you'll need to retrieve two values to run the Code Review Bot locally on this specific diff.
125
+
126
+
First, you have to find your patch on Phabricator, for example, this one was created for testing purposes:
127
+
https://phabricator.services.mozilla.com/D150515
128
+
129
+
Then you have two ways to retrieve the desired information.
130
+
131
+
#### First option
132
+
1. On the Phabricator page for your diff, find the **Build 111111: Source Code Analysis** link in the **Diff Detail** panel, next to the **Build Status** label.
133
+
2. Next to this link, you should have a link called **CI (Treeherder) Jobs**, click on it and you'll be redirected to Treeherder.
134
+
3. On the Treeherder page, find the green **D** next to **Gecko Decision Task opt** and click on it, a panel will appear on the bottom of the page.
135
+
4. On the left side of the newly opened panel, find the **Task** label and click on the task ID link next to it, a Taskcluster page will open.
136
+
5. On the top of the page, click on the **Task Group** link, next to **Gecko Decision Task**.
137
+
6. There you can retrieve the ID after `https://firefox-ci-tc.services.mozilla.com/tasks/groups/` in the URL, that's the `TRY_TASK_GROUP_ID` needed to launch the Code Review Bot.
138
+
7. Once you have this first ID, you can find the task named **code-review-issues** in the displayed list, click on it.
139
+
8. There you can retrieve the ID after `https://firefox-ci-tc.services.mozilla.com/tasks/` in the URL, that's the `TRY_TASK_ID` needed to launch the Code Review Bot.
140
+
141
+
***Example***
142
+
1. On https://phabricator.services.mozilla.com/D150515
143
+
2. Redirected to https://treeherder.mozilla.org/jobs?repo=try&revision=5ec034a3e77223ee58d2bad5689b99e09c61a4bb
144
+
3. Panel opened https://treeherder.mozilla.org/jobs?repo=try&revision=5ec034a3e77223ee58d2bad5689b99e09c61a4bb&selectedTaskRun=Y44yN6dtSsWQ6oyTYMYhQw.0
145
+
4. Redirected to https://firefox-ci-tc.services.mozilla.com/tasks/Y44yN6dtSsWQ6oyTYMYhQw
146
+
5. On https://firefox-ci-tc.services.mozilla.com/tasks/groups/Y44yN6dtSsWQ6oyTYMYhQw
147
+
6. Here `TRY_TASK_GROUP_ID=Y44yN6dtSsWQ6oyTYMYhQw`
148
+
7. On https://firefox-ci-tc.services.mozilla.com/tasks/LfiiQNAXR4WV9e1RT4PVsQ
149
+
8. Here `TRY_TASK_ID=LfiiQNAXR4WV9e1RT4PVsQ`
150
+
151
+
#### Second option
152
+
1. On the Phabricator page for your diff, retrieve your diff ID in the URL after `https://phabricator.services.mozilla.com/D`.
153
+
2. Then go to `https://firefox-ci-tc.services.mozilla.com/tasks/index/project.relman.production.code-review.phabricator.<diff_id>`.
154
+
3. Click on the first Indexed Task.
155
+
4. Under the **Data** label you'll have a JSON payload containing both needed information, `try_task_id` and `try_group_id`.
156
+
157
+
***Example***
158
+
1. On https://phabricator.services.mozilla.com/D150515, here `diff_id=150515`
159
+
2. Go to https://firefox-ci-tc.services.mozilla.com/tasks/index/project.relman.production.code-review.phabricator.150515
160
+
3. On https://firefox-ci-tc.services.mozilla.com/tasks/index/project.relman.production.code-review.phabricator.150515/AUAnqdfRTPq64aBFHS0g3Q
161
+
4. Here `TRY_TASK_ID=LfiiQNAXR4WV9e1RT4PVsQ` (`try_task_id`) and `TRY_TASK_GROUP_ID=Y44yN6dtSsWQ6oyTYMYhQw` (`try_group_id`)
162
+
163
+
### Launch the Code Review Bot
164
+
An example of a working development configuration:
**Note**: You can generate/find your Phabricator API Token on this page: https://phabricator.services.mozilla.com/settings/user/--phabricator_username--/page/apitokens/.
197
+
198
+
Then, you can create a script named `code_review_testing.sh`, containing the following lines:
0 commit comments