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

[JENKINS-29470] - Prevent NPE in AbstractProject.checkout when agent disconnects during the build #3094

Merged
merged 4 commits into from Mar 4, 2018
Merged
@@ -1207,7 +1207,14 @@ public boolean checkout(AbstractBuild build, Launcher launcher, BuildListener li
return true; // no SCM

FilePath workspace = build.getWorkspace();
workspace.mkdirs();
if(workspace!=null){
workspace.mkdirs();
}
else{
LOGGER.log(Level.SEVERE,"Workspace does not exist!!");

This comment has been minimized.

Copy link
@daniel-beck

daniel-beck Oct 21, 2017

Member

This log message is not particularly useful.

  • Never use multiple exclamation points, or I shall be forced to quote Terry Pratchett 😉 In fact, it's fine to use none at all.
  • Which agent? (build.getBuiltOn() perhaps?)
    • Perhaps it would be useful to include the status of the agent, if safely feasible?
  • Which project?
  • In fact, it's even a misleading statement: The workspace is perhaps undefined, as Jenkins creates it if defined a few lines up. So the problem isn't existence (on the file system).
  • It's not a severe error of the system. WARNING should be fine.

With the current lack of information, the log message is pretty much useless.

This comment has been minimized.

Copy link
@oleg-nenashev

oleg-nenashev Oct 21, 2017

Member

The log message should also go to BuildListener listener IMHO. In such case there will be no need to specify the build.

This comment has been minimized.

Copy link
@jglick

jglick Oct 23, 2017

Member

No logging is needed at all. Just throw an AbortException.

return false;
}


boolean r = scm.checkout(build, launcher, workspace, listener, changelogFile);
if (r) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.