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

(Add option to) Fail if git --reset fails #331

Open DanielFEvans opened 5 years ago

DanielFEvans commented 5 years ago

On our Jenkins server, we occasionally encounter problems when the plugin's call to git reset --hard <commit id> fails because the base commit is unavailable (usually indicating user error, i.e. that they have a modified base branch with commits that don't exist remotely). The plugin is aware that the command has failed, emitting a log warning stating Got non-zero exit code resetting to base commit <commit id>: 128, but does not exit and fail the build.

The issue we encounter is that the plugin then continues and runs arc patch, which hangs while trying to find the missing commit. Our Jenkins server then kills off the build when the timeout kicks in, and on Windows we find that this routinely leaves files locked open and/or a rogue git process started by arc patch still running in the background, requiring manual intervention.

Additionally, it's also a little unclear to developers why the build failed. This is because the log report relating to git reset --hard failing is about halfway down the log output, and doesn't stand out compared to the normal log output.

We would prefer it if the Plugin exited immediately on git reset --hard failing, making it clear that this is the cause of the problem, and preventing arc patch hanging while trying to find a nonexistent commit. However, I'm not sure if it's possible for git reset --hard to fail, but for the build to continue successfully, which would make the implementation of this request a bit more difficult.

artms commented 3 years ago

In our particular use case - we depend on git reset --hard not failing hard because we patched and made arc patch quite clever to find missing commit.

We can accept PR request where you make git reset --hard a hard failure for as an option for test job.