changes: add additional information to properties in GitHubPullrequestPoller#3074
changes: add additional information to properties in GitHubPullrequestPoller#3074tardyp merged 4 commits intobuildbot:masterfrom
Conversation
|
@noc0lour, thanks for your PR! By analyzing the history of the files in this pull request, we identified @DaulPavid to be a potential reviewer. |
|
@tardyp this is more a "design" question I guess, if we allow additional special properties to propagate from different source steps. |
|
You can look at the gerrit change source source code, it has similar code. |
|
A cool, I'll have a look, probably I want to flatten them as well. For the GH PR information I don't want to create the properties automatically as this would pollute them with too much stuff. |
|
indeed, this is a mistake that I made for gerrit design, we should have a whitelist configuration in the changesource (maybe fnmatch based). |
26cf8e5 to
ee917a1
Compare
Codecov Report
@@ Coverage Diff @@
## master #3074 +/- ##
=========================================
+ Coverage 88.29% 88.3% +0.01%
=========================================
Files 314 314
Lines 32926 32959 +33
=========================================
+ Hits 29071 29104 +33
Misses 3855 3855
Continue to review full report at Codecov.
|
cd47fc1 to
f13056f
Compare
|
I'd like to have the parsing of PRs in the webhook the same as it is in this PR poller. (e.g. add these changes there as well :) ). Should I just copy & paste ? |
|
Yes. The poller and webhook should stay in sync for what features they support. |
57d6210 to
a28783c
Compare
master/buildbot/changes/github.py
Outdated
| "github.mergeable", | ||
| "github.mergeable_state", | ||
| "github.merged_by", | ||
| ] |
There was a problem hiding this comment.
looks like a lot of properties for the defaults.
This should be configurable
master/buildbot/changes/github.py
Outdated
| if not any([ | ||
| prop.startswith(name) | ||
| for prop in self.GH_PROPERTY_WHITELIST | ||
| ]): |
There was a problem hiding this comment.
I would profer is you used fnmatch https://docs.python.org/2/library/fnmatch.html
There was a problem hiding this comment.
I looked into fnmatch but it didn't seem to provide a lot of flexibility if I use a preconfigured list. I'll look into making the list of properties configurable.
master/buildbot/www/hooks/github.py
Outdated
| return payload | ||
|
|
||
| def _get_PR_information(self, pr_info): | ||
| def flatten(properties, base, info_dict): |
There was a problem hiding this comment.
I dont like to copy the exact same code in two different places. maybe we should have it in a changes/github.py mixin class
|
I was thinking of a list of fnmatch expr
Le lun. 27 mars 2017 19:59, Andrej Rode <notifications@github.com> a écrit :
… ***@***.**** commented on this pull request.
------------------------------
In master/buildbot/changes/github.py
<#3074 (comment)>:
> @@ -171,6 +198,24 @@ def _getStateObjectId(self):
'%s/%s' % (self.owner, self.repo), self.db_class_name)
defer.returnValue(result)
+ def _parseGitHubPR(self, pr_info):
+ def flatten(properties, base, info_dict):
+ for k, v in iteritems(info_dict):
+ name = ".".join([base, k])
+ if not any([
+ prop.startswith(name)
+ for prop in self.GH_PROPERTY_WHITELIST
I looked into fnmatch but it didn't seem to provide a lot of flexibility
if I use a preconfigured list. I'll look into making the list of properties
configurable.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3074 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAGtIzDbXN6yKtez1jxNmMriXYE3gqXIks5rp3I_gaJpZM4Mo-5r>
.
|
|
I think the drawback of having a |
a28783c to
4515672
Compare
4515672 to
fc07f35
Compare
fc07f35 to
e908d9d
Compare
|
I have no idea why the coverage suddenly drops in files I did not even touch? And random things fail in the CI tests? @tardyp ? All files I touched have the same or better coverage. |
|
@noc0lour its because py3.5 tests fail, thus the coverage of py3 is not taken in account |
tardyp
left a comment
There was a problem hiding this comment.
looks good! need to fix the py3 tests though
| self.assertEqual(change['repository'], | ||
| 'https://github.com/defunkt/buildbot.git') | ||
| self.assertEqual(change['files'], ['README.md']) | ||
| self.assertDictContainsSubset(_GH_PARSED_PROPS, change['properties']) |
There was a problem hiding this comment.
this is deprecated in py3.2 (and we dont allow warnings)
https://docs.python.org/3/whatsnew/3.2.html?highlight=assertdictcontainssubset
you probably will need to replace that with a for k,v in _GH_PARSED_PROPS.items()
| self.assertEqual(change['repository'], | ||
| 'https://github.com/defunkt/buildbot.git') | ||
| self.assertEqual(change['files'], ['README.md']) | ||
| self.assertDictContainsSubset(_GH_PARSED_PROPS, change['properties']) |
| name = ".".join([base, k]) | ||
| if isinstance(v, dict): | ||
| flatten(properties, name, v) | ||
| elif any([fnmatch(name, expr) |
|
Yay, codecov is happy again :) |
|
anything left :) ? |
I want to checkout if this would have chances to get included into the main tree once I'm done refining it.
Basically I'd like to extract more information from the PR and add it to the properties which then can be used in the builders.
Yes, no? Or in a different way?