Skip to content
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

FileNotFoundException thrown when creating commit status #232

Closed
uohzxela opened this issue Feb 25, 2015 · 26 comments
Closed

FileNotFoundException thrown when creating commit status #232

uohzxela opened this issue Feb 25, 2015 · 26 comments

Comments

@uohzxela
Copy link

When the build process is triggered by a pull request made by a user in our Github organization, this exception message invariably appears in the console log. It is not a critical bug as we are able to deploy our app through the build process without any problems. Right now we are using Jenkins to deploy staging apps. However, this may be a potential problem and in that case, we don't want this exception issue to mess with our build process for production apps. We are using an access token from a bot that's a member of our Github organization. I am guessing the ghprb plugin fails to include the access token when it makes calls to the Github API, resulting in this response:

{
  "message": "Not Found",
  "documentation_url": "https://developer.github.com/v3"
}

The cause could be due to some of the updated plugin dependencies (we have updated all the plugins that we have) which break the ghprb build.

Exception message:

GitHub pull request #836 of commit d8a115d262b237d4cbd542bb04b63f84f0d40f28 automatically merged.
Setting status of d8a115d262b237d4cbd542bb04b63f84f0d40f28 to PENDING with url http://localhost:38080/job/hoteru-staging-all-branches/147/ and message: Merged build started.
FileNotFoundException means that the credentials Jenkins is using is probably wrong. Or that something is really wrong with github.
java.io.FileNotFoundException: https://api.github.com/repos/wego/hoteru/statuses/d8a115d262b237d4cbd542bb04b63f84f0d40f28
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1624)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
    at org.kohsuke.github.Requester.parse(Requester.java:383)
    at org.kohsuke.github.Requester._to(Requester.java:185)
    at org.kohsuke.github.Requester.to(Requester.java:160)
    at org.kohsuke.github.GHRepository.createCommitStatus(GHRepository.java:702)
    at org.kohsuke.github.GHRepository.createCommitStatus(GHRepository.java:714)
    at org.jenkinsci.plugins.ghprb.GhprbRepository.createCommitStatus(GhprbRepository.java:140)
    at org.jenkinsci.plugins.ghprb.GhprbRepository.createCommitStatus(GhprbRepository.java:122)
    at org.jenkinsci.plugins.ghprb.GhprbBuilds.onStarted(GhprbBuilds.java:81)
    at org.jenkinsci.plugins.ghprb.GhprbBuildListener.onStarted(GhprbBuildListener.java:19)
    at org.jenkinsci.plugins.ghprb.GhprbBuildListener.onStarted(GhprbBuildListener.java:12)
    at hudson.model.listeners.RunListener.fireStarted(RunListener.java:213)
    at hudson.model.Run.execute(Run.java:1714)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:89)
    at hudson.model.Executor.run(Executor.java:240)
@tobowers
Copy link

I'm seeing this too with:

Git Client Plugin 1.15.0
Git Plugin 2.3.4
GitHub API Plugin 1.59
GitHub Plugin 1.10
GitHub pull request builder plugin 1.16-8

@brettlangdon
Copy link

I also see this.

ghprb v1.17

@tobowers
Copy link

tobowers commented Apr 2, 2015

For us it turned out that we had the right permissions for the app, but the user didn't have write access to the repository we were trying to update.

@brettlangdon
Copy link

@tobowers interesting, I did add write access for our jenkins bot, but I wish I didn't have to do that.

The access token I am using for the pull request builder allows repo which should cover repo:status.

@bilalyasar
Copy link

@tobowers @brettlangdon Do you have any solution?, also i am suffering with the same problem.

@brettlangdon
Copy link

@bilalyasar giving jenkins write access to the repo is what solved it for me :(

@neuroticnerd
Copy link

@janinko @uohzxela @tobowers @brettlangdon @bilalyasar

Updating Jenkins + plugins also began producing this error in our instance. Granting the machine-users group in our GitHub organization write access to the repositories is also what finally solved this annoying issue for us as well. I really don't like the idea of having to grant machine-users write access to repositories just for Jenkins to be able to update status though.

Since it appeared to work just fine before updating plugins, I have to assume that something changed either in the plugins or GitHub's API (thus forcing plugin changes). Seeing as it had continued working right up until updating plugins, I'm inclined to believe that it is a change in a related plugin rather than the GitHub API. Is write access a new inherent requirement imposed by GitHub's API, or was it just a change in a plugin that could be updated to revert to the previous behavior of only requiring read access?

(I apologize for not being more useful, I'd look into it myself if I weren't so busy with current deadlines!)

@hcldan
Copy link
Contributor

hcldan commented May 7, 2015

I am seeing this. And I'm seeing that the comment fallback is no longer working.

@ocxo
Copy link

ocxo commented May 18, 2015

Ran into this as well. Fix for us was to set the username in the "Admin list" section of the job config to the username of the user whose token we are associating with the plugin. Very strange.

DavidTanner added a commit to jenkinsci/ghprb-plugin that referenced this issue May 19, 2015
Fix issue janinko#232 due to changes in underlying api
@alexkli
Copy link

alexkli commented May 20, 2015

Same here.

Fix for us was to set the username in the "Admin list" section of the job config to the username of the user whose token we are associating with the plugin.

This fixed it for us as well!

Versions:

  • github enterprise 2.1.6
  • jenkins: 1.606
  • github pull request builder plugin: 1.17
  • github API plugin: 1.66
  • git client plugin: 1.16.1
  • github plugin: 1.11.1

There is also a jira issue: https://issues.jenkins-ci.org/browse/JENKINS-27056

@mboersma
Copy link

mboersma commented Jul 6, 2015

set the username in the "Admin list" section of the job config to the username of the user whose token we are associating with the plugin

This workaround didn't help us. Did you need to have the admin user as the only entry in the "Admin list" field?

I can't find a workaround for this issue despite having tried everything suggested here and at jenkinsci#117 and https://issues.jenkins-ci.org/browse/JENKINS-27056. We get multiple errors about "FileNotFound" trying to hit something on the v3 (Enterprise) GitHub API, which we are not using. We're using 1.24.5 of GHRPB, and the latest available of everything else.

Does anyone know which old versions of GH API and / or GHPRB still work? I'm glad to go back to a last known good version, but can't figure out what that would be...

@ocxo
Copy link

ocxo commented Jul 6, 2015

Do you have 2FA enabled on the account you're using to talk to the API?

@mboersma
Copy link

mboersma commented Jul 6, 2015

Do you have 2FA enabled on the account you're using to talk to the API?

No.

@alexkli
Copy link

alexkli commented Jul 6, 2015

@mboersma see version list above or below, our current set of versions that works fine:

  • github enterprise 2.1.6
  • jenkins: 1.606
  • github pull request builder plugin: 1.24.2
  • github API plugin: 1.68
  • git client plugin: 1.17.1
  • github plugin: 1.11.3

@mboersma
Copy link

mboersma commented Jul 6, 2015

We're not using GH enterprise, which is why the error message seems indicative of a bug:

{
  "message": "Not Found",
  "documentation_url": "https://developer.github.com/v3"
}

GH PR builder plugin had the same bug for us with version 1.24.2, just fyi.

@DavidTanner
Copy link
Collaborator

In the latest, 1.24.8 you can turn off the status updates so you don't need write access.

@xutian
Copy link

xutian commented Jul 16, 2015

@DavidTanner
how to turn off it, thanks ?

@JussiPakkanen
Copy link

I get this same issue even though I have done all the workarounds listed here:

  • add username to admins
  • no 2FA
  • username has write permissions to repo
  • the auth token has permissions for absolutely everything

The project I'm trying to use this for is https://github.com/sailfish-sdk/sailfish-qtcreator.

Plugin version 1.27.

@JussiPakkanen
Copy link

There is something weirder going on with the credential integration. If I click on the "add credentials" button on the page, and add a credential, it does not show up in the dropdown menu. Refreshing the page does not help. Adding it via the global credentials menu does work (once), but only for a username/password combo. Secret text credentials do not show up in the dropdown menu no matter what you do, even though the wiki page says they should work.

@juharris
Copy link

Is anyone else still getting this issue?

@juharris
Copy link

Seems to work now in 1.29.

@cratliff
Copy link

I recently updated to 1.29 and I am still seeing theses errors. Jenkins is successfully writing a comment, But these errors still occur.

@hcldan
Copy link
Contributor

hcldan commented Oct 2, 2015

This error is caused because the account you have told ghprb to use does not have commit access to the repository it is using (despite what you may have checked off when making the security token (you can't grant access you do not have))

By default, it tries to use an api to write a commit status which requires write access.
My fix listed above fixes the issue where was not properly detecting that error, and it now falls back to posting a comment. You will still see the errors in the jenkins console, but they are harmless.

The maintainers here might have a better way of handling the logging, I was much more concerned with getting the commenting working again which broke after an api change.

@draganHR
Copy link

I had same issue and problem was that team didn't have repository permission.
I had to open /orgs/<organization>/teams/<team>/repositories, and add repository to specific team.

AtkinsChang referenced this issue in AtkinsChang/ghprb Dec 5, 2015
@andrewfraley
Copy link

To save anyone else the hassle, if you want to fall back to comments on the PR, go into Configure System and then under the GitHub Pull Request Builder section, check the box for "Use comments to report results when updating commit status fails"

@ykhandelwal913
Copy link

i am facing this issue with github pull request plugin- 1.35.0
jenkins: 1.642
githubapi: 1.82
github enterprise 2.1.6

Can someone help me?

nosmo pushed a commit to nosmo/ghprb-plugin that referenced this issue Dec 12, 2018
Fix issue janinko#232 due to changes in underlying api
Ladicek added a commit to rhoar-ci/jenkins-jobs that referenced this issue Apr 12, 2019
For some reason, GHPRB isn't able to change commit status in GitHub
without this change. See also [1] or [2].

[1] janinko/ghprb#232
[2] https://issues.jenkins-ci.org/browse/JENKINS-27056
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests