public void check(OperationResult result) { HealthStateType id = HealthStateType.general(HealthStateScope.forPipeline(pipelineName)); if (pipelinePauseService.isPaused(pipelineName)) { String message = String.format("Failed to trigger pipeline [%s]", pipelineName); result.conflict(message, String.format("Pipeline %s is paused", pipelineName), id); } else { result.success(id); } } }
public void automaticallyTriggerRelevantStagesFollowingCompletionOf(Stage stage) { if (!stage.isCompleted()) { return; } try { Pipeline pipeline = pipelineDao.loadPipeline(stage.getPipelineId()); unlockIfNecessary(pipeline, stage); if (pipelinePauseService.isPaused(pipeline.getName())) { return; } // if there has been a newer successful run of the previous stage, we should trigger off this stage again // in the same pipeline instance that the newer successful run happened in. //TODO: ChrisS & LYH : This is only accidentally working // if (shouldTriggerThisStageInNewerPipeline(pipeline, stage)) { triggerCurrentStageInNewerPipeline(pipeline.getName(), stage); } // if this stage completed successfully, we should try to trigger the next stage in this pipeline if (stage.isCompletedAndPassed()) { triggerNextStageInPipeline(pipeline, stage.getName(), DEFAULT_APPROVED_BY); } } catch (Exception ex) { String message = String.format("Failed to trigger next stage for %s.", stage.getName()); LOGGER.error(message, ex); throw ex; } }