-
Bug
-
Resolution: Fixed
-
Critical
-
None
-
Jenkins Version: 2.302
pipeline-stage-view-plugin Version: 2.19
attachment image is exception stack.
When the FlowExecution 'isComplete' return true,get the 'Result' from WorkflowRun's function 'getResult',but maybe this moment result is null
original code is :
private void initStatus(WorkflowRun run) { FlowExecution execution = run.getExecution(); if (execution == null) { setStatus(StatusExt.NOT_EXECUTED); } else if (execution.getCauseOfFailure() != null) { setStatus(StatusExt.valueOf(execution.getCauseOfFailure())); } else if (execution.isComplete()) { Result r = run.getResult(); setStatus(StatusExt.valueOf(r)); } else if (isPendingInput(run)) { setStatus(StatusExt.PAUSED_PENDING_INPUT); } else { setStatus(StatusExt.IN_PROGRESS); } }
Maybe the correct code to get 'Result' is :
private void initStatus(WorkflowRun run) { FlowExecution execution = run.getExecution(); if (execution == null) { setStatus(StatusExt.NOT_EXECUTED); } else if (execution.getCauseOfFailure() != null) { setStatus(StatusExt.valueOf(execution.getCauseOfFailure())); } else if (execution.isComplete()) { Result r = run.getResult(); // ensure Result is not null if(null == r) { r =((FlowEndNode)execution.getCurrentHeads().get(0)).getResult(); } setStatus(StatusExt.valueOf(r)); } else if (isPendingInput(run)) { setStatus(StatusExt.PAUSED_PENDING_INPUT); } else { setStatus(StatusExt.IN_PROGRESS); } }