Always return WORK_COMPLETE when a build finishes regardless of
the result. This is a change to the Zuul-Gearman protocol, however, Zuul is already compatible with this mode of operation. The new idea is that WORK_COMPLETE should be returned for every completed job, regardless of the result. The result of the build should be determined by the client by inspecting the data returned with the WORK_COMPLETE packet. WORK_FAIL should now instead be used to indicate that the job failed to run for some reason (perhaps the scheduler was, after all, unable to schedule a build that it had accepted from the gearman server). WORK_EXCEPTION continues to indicate something similar to WORK_FAIL, but with exception information attached. (At the moment, gearman-plugin should now only return WORK_COMPLETE or WORK_EXCEPTION; the option to use WORK_FAIL as described is a future enhancement.) Change-Id: I32187065dac7e83573636021faf964df8dfd63be
This commit is contained in:
parent
8e62012466
commit
af21876dfe
|
@ -176,8 +176,6 @@ public class StartJobWorker extends AbstractGearmanFunction {
|
|||
QueueTaskFuture<?> future = project.scheduleBuild2(0, new Cause.UserIdCause(), actions);
|
||||
|
||||
// check build and pass results back to client
|
||||
boolean jobResult = true;
|
||||
String jobFailureMsg = "";
|
||||
String jobData;
|
||||
|
||||
// This is a hack that relies on implementation knowledge. In
|
||||
|
@ -228,12 +226,7 @@ public class StartJobWorker extends AbstractGearmanFunction {
|
|||
}
|
||||
|
||||
exec = future.get();
|
||||
|
||||
jobData = buildStatusData(currBuild);
|
||||
if (sess != null) {
|
||||
sendData(jobData.getBytes());
|
||||
sess.driveSessionIO();
|
||||
}
|
||||
|
||||
if (offlineWhenComplete) {
|
||||
if (computer == null) {
|
||||
|
@ -247,19 +240,11 @@ public class StartJobWorker extends AbstractGearmanFunction {
|
|||
}
|
||||
}
|
||||
|
||||
// check Jenkins build results
|
||||
Result result = currBuild.getResult();
|
||||
if (result == Result.SUCCESS) {
|
||||
jobResult = true;
|
||||
} else {
|
||||
jobResult = false;
|
||||
}
|
||||
|
||||
// return result to client
|
||||
GearmanJobResult gjr = new GearmanJobResultImpl(
|
||||
this.jobHandle, jobResult,
|
||||
"".getBytes(), "".getBytes(),
|
||||
jobFailureMsg.getBytes(), 0, 0);
|
||||
this.jobHandle, true,
|
||||
jobData.getBytes(), "".getBytes(),
|
||||
"".getBytes(), 0, 0);
|
||||
return gjr;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue