bugbug
bugbug copied to clipboard
Create a `/diff/schedules` endpoint in the http_service
For test selection, we use the push/<branch>/<rev>/schedules
endpoint to figure out which tests should be scheduled on the given push. The service takes the branch and rev and downloads the raw diff from hg.mozilla.org
.
We can use the same service to choose which tests to run locally (via mach test
) as well. All we would need is an endpoint that allows the user to directly POST the diff(s) that they wish to process. We could call it diff/schedules
. Maybe schedules
is the wrong verb in this context and something like selects
would be better.
Related bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1626320
@ahal Can you please give more details about this? Should the API take the diff ID as a parameter or run it directly for the last commit?
@NisargKarun the idea here was to run the test selection on a diff that is uploaded by the user of the API. The actual raw diff, not an identifier. Note this is a pretty complex issue to start with, it'd be better to start with a good-first-issue.
Note this issue on its own wouldn't give us any benefit, we'd also need the accompanying bug above to use this API.
@NisargKarun if you want to work on it even if it is a little harder than a good-first-issue, I'm happy to help. The API would be similar to https://github.com/mozilla/bugbug/blob/c7d2737ee78a7f52f6105738f92884e9c394913a/http_service/bugbug_http/models.py#L119, but instead of pulling the commits from the remote repository (https://github.com/mozilla/bugbug/blob/c7d2737ee78a7f52f6105738f92884e9c394913a/http_service/bugbug_http/models.py#L126-L136), it should create a commit with the diff contents passed via POST.
Note: we should probably have two parameters for this API, one would be the base revision on which to apply the diff, and the other the actual contents of the diff. Otherwise, we might fail to apply the diff if we are not at the same base revision as the user. This can be a follow-up change though.
@marco-c Definitely like to work on this. I have worked on a few mozilla-central's mozlint bugs before. I will spend some time on this over the next few days and raise a PR.