private void postSettlement() { try { getPauseAction().remove(this); run.save(); } catch (IOException | InterruptedException | TimeoutException x) { LOGGER.log(Level.WARNING, "failed to remove InputAction from " + run, x); } finally { if (node != null) { try { PauseAction.endCurrentPause(node); } catch (IOException x) { LOGGER.log(Level.WARNING, "failed to end PauseAction in " + run, x); } } else { LOGGER.log(Level.WARNING, "cannot set pause end time for {0} in {1}", new Object[] {getId(), run}); } } }
@Override public void onTaskCompleted(String taskId, String taskStatus, @Nullable String qgStatus) { if (taskId.equals(step.taskId)) { try { PauseAction.endCurrentPause(getContext().get(FlowNode.class)); SonarQubeWebHook.get().removeListener(this); log("SonarQube task '%s' status is '%s'", step.taskId, taskStatus); switch (taskStatus) { case WsClient.CETask.STATUS_SUCCESS: log("SonarQube task '%s' completed. Quality gate is '%s'", step.taskId, qgStatus); handleQGStatus(qgStatus); break; case WsClient.CETask.STATUS_FAILURE: case WsClient.CETask.STATUS_CANCELED: getContext().onFailure(new IllegalStateException("SonarQube analysis '" + step.getTaskId() + "' failed: " + taskStatus)); break; default: throw new IllegalStateException("Unexpected task status: " + taskStatus); } } catch (IOException | InterruptedException e) { LOGGER.log(Level.WARNING, "Error during WaitForQualityGateStep", e); } } } }
@Override public void stop(Throwable cause) throws Exception { PauseAction.endCurrentPause(getContext().get(FlowNode.class)); SonarQubeWebHook.get().removeListener(this); getContext().onFailure(cause); }