[JIRA] [github-branch-source-plugin] (JENKINS-33306) Stack trace printed when notifications privilege missing

2 views
Skip to first unread message

jglick@cloudbees.com (JIRA)

unread,
Mar 3, 2016, 3:07:02 PM3/3/16
to jenkinsc...@googlegroups.com
Jesse Glick created an issue
 
Jenkins / Improvement JENKINS-33306
Stack trace printed when notifications privilege missing
Issue Type: Improvement Improvement
Assignee: Jesse Glick
Components: github-branch-source-plugin
Created: 03/Mar/16 8:06 PM
Environment: GHE
Priority: Minor Minor
Reporter: Jesse Glick

If you build a pull request yet your scan credentials lack the notifications privilege, you get an ugly stack trace along the lines of

ERROR: Could not update commit status
java.io.FileNotFoundException: {"message":"Not Found","documentation_url":"..."}
	at org.kohsuke.github.Requester.handleApiError(Requester.java:527)
	at org.kohsuke.github.Requester._to(Requester.java:257)
	at org.kohsuke.github.Requester.to(Requester.java:203)
	at org.kohsuke.github.GHRepository.createCommitStatus(GHRepository.java:854)
	at org.jenkinsci.plugins.github_branch_source.GitHubBuildStatusNotification.createCommitStatus(GitHubBuildStatusNotification.java:78)
	at ...
Caused by: java.io.FileNotFoundException: .../api/v3/repos/.../.../statuses/...
	at ...
	at org.kohsuke.github.Requester.parse(Requester.java:483)
	at org.kohsuke.github.Requester._to(Requester.java:236)
... 17 more
Caused by: java.io.FileNotFoundException: ...
	at ...
	at org.kohsuke.github.Requester.parse(Requester.java:479)
... 18 more

Since this is a fairly predictable user error (or the user might even have just decided to deny this permission), it would be more appropriate to catch FileNotFoundException here and print a one-line warning to the build log saying that the commit status notification could not be sent, and leave it at that. (For diagnostic purposes the full exception could be logged at FINE.)

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo

recena@gmail.com (JIRA)

unread,
Mar 3, 2016, 5:21:02 PM3/3/16
to jenkinsc...@googlegroups.com
Manuel Jesús Recena Soto started work on Improvement JENKINS-33306
 
Change By: Manuel Jesús Recena Soto
Status: Open In Progress

recena@gmail.com (JIRA)

unread,
Mar 3, 2016, 5:21:02 PM3/3/16
to jenkinsc...@googlegroups.com

recena@gmail.com (JIRA)

unread,
Mar 3, 2016, 5:41:02 PM3/3/16
to jenkinsc...@googlegroups.com
Manuel Jesús Recena Soto commented on Improvement JENKINS-33306
 
Re: Stack trace printed when notifications privilege missing

Jesse Glick, the scope notifications is related with this. The scope required to update commit status is repo:status. In 1.3 pull requests building is limited to private repositories. To work with private repositories you need (in you personal access token) to set the scope repo and this scope involves the scopes: repo:status, repo_deployment and public_repo.

I agree with handling the exception in a best way but I'm not sure how I can reproduce it

Reply all
Reply to author
Forward
0 new messages