uber-archive / phabricator-jenkins-plugin

Jenkins plugin to integrate with Phabricator, Harbormaster, and Uberalls
https://wiki.jenkins-ci.org/display/JENKINS/Phabricator+Differential+Plugin
MIT License
368 stars 101 forks source link

Improve messaging when `arc` is missing on jenkins nodes #190

Open jdef opened 7 years ago

jdef commented 7 years ago

Original title: "FATAL: net.sf.json.JSONNull cannot be cast to java.lang.String"

context: I had a phab diff already under review. I updated it via the phab web UI by uploading a new .patch file with the latest changes.

CI bombed. Looking at the build logs I see this:

Checking out Revision 67cf3661e48c02f8a8a7df24a6714486fd760a26 (refs/remotes/origin/master)
 > git config core.sparsecheckout # timeout=10
 > git checkout -f 67cf3661e48c02f8a8a7df24a6714486fd760a26
 > git rev-list 67cf3661e48c02f8a8a7df24a6714486fd760a26 # timeout=10
[phabricator:harbormaster] Sending Harbormaster BUILD_URL via PHID: PHID-HMBT-utnue5zrz33sokyy3pob
[phabricator:conduit] Fetching differential from Conduit API
FATAL: net.sf.json.JSONNull cannot be cast to java.lang.String
java.lang.ClassCastException: net.sf.json.JSONNull cannot be cast to java.lang.String
    at com.uber.jenkins.phabricator.conduit.Differential.getBaseCommit(Differential.java:116)
    at com.uber.jenkins.phabricator.PhabricatorBuildWrapper.setUp(PhabricatorBuildWrapper.java:124)
    at hudson.model.Build$BuildExecution.doRun(Build.java:156)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
    at hudson.model.Run.execute(Run.java:1720)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:404)

it seems logical that a String could be null .. but the mechanism for achieving that translation here appears to be broken.

VeeeneX commented 7 years ago

I'm having the same problem! Same log file :/

ascandella commented 7 years ago

Interesting. Do you have a set of repro steps I can follow?

VeeeneX commented 7 years ago

@sectioneight Actually I fixed it somehow :smile:

ascandella commented 7 years ago

Cool! So uh... is there something we can document here to help others, or was this just something specifically broken about your setup?

VeeeneX commented 7 years ago

@sectioneight I think the problem was that I didn't install arc on machine

ascandella commented 7 years ago

Oh, that's not good, we definetely need to provide better documentation and error messages around that.

VeeeneX commented 7 years ago

@sectioneight I've created a fork for readme, but I'm not sure if error occured because of missing arc but it's fine to add it as requirement

Stefan-Schmidt commented 7 years ago

I see the same error log on my setup right now. Jenkins: 2.73.1 Phab plugin for jenkins: 1.9.7

I have arc installed on the machine. Jenkins is also reporting back failure into phab differentials already so I assume the conduit keys are setup correctly (correct me if I'm wrong).

From the readme in your repo I do have to setup any .arcrc config files or such. Is this correct or is some local configuration on the slaves needed?

Log file:

00:00:02.658 [phabricator:harbormaster] Sending Harbormaster BUILD_URL via PHID: PHID-HMBT-5v2ryrfoptqkntjvmvbe 00:00:03.579 [phabricator:send-harbormaster-uri] Harbormaster declined URI artifact: #1062: Duplicate entry 'uri-niNFz3MGey37' for key 'key_artifact' 00:00:03.579 [phabricator:harbormaster] Unable to send BUILD_URL to Harbormaster 00:00:05.081 [phabricator:conduit] Fetching differential from Conduit API 00:00:05.082 FATAL: net.sf.json.JSONNull cannot be cast to java.lang.String 00:00:05.083 java.lang.ClassCastException: net.sf.json.JSONNull cannot be cast to java.lang.String 00:00:05.083 at com.uber.jenkins.phabricator.conduit.Differential.getBaseCommit(Differential.java:116) 00:00:05.083 at com.uber.jenkins.phabricator.PhabricatorBuildWrapper.setUp(PhabricatorBuildWrapper.java:124) 00:00:05.083 at hudson.model.Build$BuildExecution.doRun(Build.java:157) 00:00:05.083 at hudson.plugins.project_inheritance.projects.InheritanceBuild$InheritanceBuildExecution.doRun(InheritanceBuild.java:220) 00:00:05.083 at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:496) 00:00:05.083 at hudson.model.Run.execute(Run.java:1737) 00:00:05.083 at hudson.plugins.project_inheritance.projects.InheritanceBuild.onRun(InheritanceBuild.java:172) 00:00:05.083 at hudson.plugins.project_inheritance.projects.InheritanceBuild.run(InheritanceBuild.java:165) 00:00:05.083 at hudson.model.ResourceController.execute(ResourceController.java:97) 00:00:05.083 at hudson.model.Executor.run(Executor.java:419) 00:00:05.083 Archiving artifacts

The duplicate message comes from the fact that I did try to rebuild the same job. The error itself is also available in the first log.

Some hints on what could be wrong here are appreciated. :)

Stefan-Schmidt commented 7 years ago

For me it failed on differentials created from raw diffs over the phab web UI. It started to work fine once I tested with real arc diffs.

Maybe the differential coming from the web UI are missing some patch metdata and thus the error gets triggered?

PJ127 commented 4 years ago

Exactly the same problem. This is confusing because one would expect it to work when updating a diff with a patch on the web user interface.