Bug 206532 - [ews] commit-queue should verify patch committer and reviewer
Summary: [ews] commit-queue should verify patch committer and reviewer
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Aakash Jain
URL:
Keywords: InRadar
Depends on:
Blocks: 201934
  Show dependency treegraph
 
Reported: 2020-01-21 07:38 PST by Aakash Jain
Modified: 2020-03-20 14:20 PDT (History)
4 users (show)

See Also:


Attachments
Patch (5.08 KB, patch)
2020-02-25 14:36 PST, Aakash Jain
no flags Details | Formatted Diff | Diff
Patch (5.18 KB, patch)
2020-02-25 15:28 PST, Aakash Jain
no flags Details | Formatted Diff | Diff
Patch (5.44 KB, patch)
2020-02-26 09:44 PST, Aakash Jain
no flags Details | Formatted Diff | Diff
Patch (5.56 KB, patch)
2020-02-26 10:50 PST, Aakash Jain
jbedard: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Aakash Jain 2020-01-21 07:38:32 PST
commit-queue should verify patch committer and reviewer from https://trac.webkit.org/browser/webkit/trunk/Tools/Scripts/webkitpy/common/config/contributors.json and not land the patch in case committer and reviewer's don't have required privileges.
Comment 1 Radar WebKit Bug Importer 2020-01-21 07:38:47 PST
<rdar://problem/58758869>
Comment 2 Aakash Jain 2020-02-25 14:36:59 PST
Created attachment 391689 [details]
Patch
Comment 4 Aakash Jain 2020-02-25 15:28:32 PST
Created attachment 391692 [details]
Patch
Comment 5 Jonathan Bedard 2020-02-26 07:51:15 PST
Comment on attachment 391692 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391692&action=review

> Tools/BuildSlaveSupport/ews-build/steps.py:653
> +    def load_contributors(self):

This function is weird.

At the moment, we only call it in the constructor and it sets up a cache, where it will return values. But that doesn't make sense because it's called in the constructor.

Seems to me that we should either git rid of the early return and stop returning values since we don't actually use the returned values, or have this function only return the dictionary to the contributors which we then assign to the cache in the constructor.
Comment 6 Aakash Jain 2020-02-26 09:44:26 PST
Created attachment 391751 [details]
Patch
Comment 7 Aakash Jain 2020-02-26 10:00:18 PST
(In reply to Jonathan Bedard from comment #5)
> or have this function only return the dictionary of the contributors which we then assign to the cache in the constructor.
Done in updated patch.
Comment 8 Jonathan Bedard 2020-02-26 10:03:11 PST
Comment on attachment 391751 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391751&action=review

> Tools/BuildSlaveSupport/ews-build/steps.py:626
> +        if not self.contributors:

This new code made me realize that this data is cached at the class level, which I didn't notice before.

First, I'm not sure we should cache it, we want to pick up when new contributors are added, right? And reading contributors shouldn't take too long, it seems fine to do it every time we construct the step.

Second, we should declare load_contributors as a class method because that's what it is.
Comment 9 Aakash Jain 2020-02-26 10:50:49 PST
Created attachment 391755 [details]
Patch
Comment 10 Aakash Jain 2020-02-26 10:56:10 PST
(In reply to Jonathan Bedard from comment #8)
> First, I'm not sure we should cache it, we want to pick up when new contributors are added, right?
Agree, updated in new patch. Also buildbot loads the __init__ method at the 'buildbot start' time, which we don't want. So moved the call to load load_contributors() inside start() and deleted __init__.

Also I did some testing for network errors and improved error handling for the case when we are unable to load contributors.json. Tested in https://ews-build.webkit-uat.org/#/builders/26/builds/878

> Second, we should declare load_contributors as a class method because that's what it is.
We are using self._addToLog inside this method to display the error message in UI. Need to keep it instance method for that.
Comment 11 Jonathan Bedard 2020-02-26 11:22:43 PST
Comment on attachment 391755 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=391755&action=review

> Tools/BuildSlaveSupport/ews-build/steps.py:632
> +            return {}

My only question here is: Should we used the cached version if we fail to load?
Comment 12 Aakash Jain 2020-02-26 11:40:42 PST
(In reply to Jonathan Bedard from comment #11)
> My only question here is: Should we used the cached version if we fail to load?
Let's start with this simple approach for now. Will add the caching logic later if needed.
Comment 13 Aakash Jain 2020-02-26 11:42:51 PST
Committed r257498: <https://trac.webkit.org/changeset/257498>
Comment 14 Aakash Jain 2020-03-20 14:20:14 PDT
Seems to be working fine. e.g.: https://ews-build.webkit.org/#/builders/28/builds/99