New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allow github reporter to work with git@ urls #3148
Conversation
@dragon512, thanks for your PR! By analyzing the history of the files in this pull request, we identified @hcwiley, @tardyp and @anish to be potential reviewers. |
Codecov Report
@@ Coverage Diff @@
## master #3148 +/- ##
==========================================
+ Coverage 88.25% 88.26% +<.01%
==========================================
Files 323 323
Lines 33712 33715 +3
==========================================
+ Hits 29753 29758 +5
+ Misses 3959 3957 -2
Continue to review full report at Codecov.
|
master/buildbot/reporters/github.py
Outdated
repoOwner, repoName = project.split('/') | ||
else: | ||
# Given we have a repository define try to get the owner and name | ||
elif sourcestamps[0]['repository']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please install codecov chrome extension or look at the report.
We require that those kind of changes are unit tested before they can be included in the code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe using the project
property is safe since github changes coming in via the www hook or PullrequestPoller
have the project property set to the correct value only timed/force schedulers would have to set that property.
master/buildbot/reporters/github.py
Outdated
@@ -94,10 +95,16 @@ def createStatus(self, | |||
if context is not None: | |||
payload['context'] = context | |||
|
|||
return self._http.post( | |||
if self.verbose: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is a separate feature which belongs to a separate PR. I think this would be better to put it in HttpBase reporter
master/buildbot/reporters/github.py
Outdated
repoOwner = repo[0] | ||
repoName = '.'.join(repo[1].split('.')[:-1]) | ||
# if this repo is in the form of git@ not http:// | ||
if sourcestamps[0]['repository'].startswith("git@"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this algorithm is useful not only for github, but also for bitbucket, gitlab, and all github clones.
We should factorize it in an utility function in (create new buildbot.util.repository_urls module)
def getUserAndProjectFromRepoUrl(repoUrl):
[...]
Looks like it should fix #3215 P.s. take a look #3305 |
Cool, I should pull this change in and redo the fix with this new util. |
@dragon512 please do. |
3b7d6b0
to
580eeb8
Compare
master/buildbot/reporters/github.py
Outdated
@@ -205,5 +216,6 @@ def createStatus(self, | |||
payload = {'body': description} | |||
|
|||
return self._http.post( | |||
'/'.join(['/repos', repo_user, repo_name, 'issues', issue, 'comments']), | |||
'/'.join(['/repos', repo_user, repo_name, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the goal of such wrapping here, and leave this one as is? (Since it is less 80 characters anyway)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I formatted with autopep8. It seems to want to do this. I don't know why. I switch it back and did the format again .. this went back to the two line statement.
I can see about making the line length longer and seeing it this will go away
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya I just tried again with --max-line-length 132
It was still reformatting this line. I can manually set it back
fae5711
to
60967c3
Compare
@tardyp I am unclear how this is failing worse. I rebased. I have a new test added to cover the basic three lines that had not been covered before. How is this reporting even worse coverage than before? |
repoName = giturl.repo | ||
|
||
if self.verbose: | ||
log.msg("Updating github status: repoOwner={repoOwner}, repoName={repoName}".format( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codecov says this line is not covered. that's fine to me. just fix the doc issue.
there is no real doc change, as this fixes the reporter to correct consume json data with git@ formatted URLs. this is more of a bug fix, vs a API change |
@dragon512 @tardyp means doc issue, i.e. it doesn't build because of spelling. Take a look test
|
@@ -0,0 +1 @@ | |||
GitHubStatusPush now support reporting to ssh style URLs, ie git@github.com:Owner/RepoName.git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please add link on GitHubStatusPush, format it with backtricks, and backtricks for git@github...
(mark it as code). And looks like spell check doesn't like this RepoName
. Or maybe later one. Anyway, you can add it to ignore list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I think I corrected it properly
@@ -136,12 +137,16 @@ def send(self, build): | |||
else: | |||
issue = None | |||
|
|||
if project: | |||
if "/" in project: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is it for? who can set project
to smth like repoOwner/repoName
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was for when I set project to "foobar" not "owner/repo" This protects the code and allow the code to use the meta data that was really sent to get the data. There is no documentation other than that the project is a meta value. there is nothing saying that it can have magic values. I been burned by this a few times.
Add some verbose messages that can be useful add a release note fragment add test code
fcb0e7d
to
bf6f0fc
Compare
@tardyp I think I have it. Sorry for the delay on finishing this. |
@tardyp Just a friendly ping. Is there anything holding back this PR from being merged? |
Allow GitHub to parse https:// and git@github.com:xxx style repository URLS correctly
Add some verbose messages that can be useful.
Contributor Checklist: