public boolean isAutoApproved() { return !config.requiresApproval(); }
public boolean supportAutoApproval() { return !requiresApproval(); }
public String approvalType() { return requiresApproval() ? GoConstants.APPROVAL_MANUAL : GoConstants.APPROVAL_SUCCESS; }
public boolean requiresApproval() { if (isEmpty()) { return false; } return first().requiresApproval(); }
@Override public boolean requiresApproval(final CaseInsensitiveString pipelineName, final CaseInsensitiveString stageName) { PipelineConfig pipelineConfig = getPipelineConfigByName(pipelineName); if (pipelineConfig == null) { return false; } final StageConfig stageConfig = pipelineConfig.findBy(stageName); return stageConfig != null && stageConfig.requiresApproval(); }
public void unlockIfNecessary(Pipeline pipeline, Stage stage) { StageConfig nextStage = stageOrderService.getNextStage(pipeline, stage.getName()); boolean isLastStage = nextStage == null; boolean isUnlockable = goConfigService.isUnlockableWhenFinished(pipeline.getName()); boolean nextStageIsManual = nextStage != null && nextStage.requiresApproval(); boolean pipelineIsConsideredToBeComplete = stage.isCompleted() && (!stage.passed() || nextStageIsManual); if (isLastStage || (isUnlockable && pipelineIsConsideredToBeComplete)) { pipelineLockService.unlock(pipeline.getName()); } }
public void updateFutureStagesFrom(PipelineConfig pipelineConfig) { StageInstanceModel lastStage = this.last(); StageConfig nextStage = lastStage == null ? pipelineConfig.getFirstStageConfig() : pipelineConfig.nextStage(new CaseInsensitiveString(lastStage.getName())); while (nextStage != null && !this.hasStage(str(nextStage.name()))) { this.addFutureStage(str(nextStage.name()), !nextStage.requiresApproval()); nextStage = pipelineConfig.nextStage(nextStage.name()); } } }
assertThat(stage1.name(), is(new CaseInsensitiveString("stage1"))); assertThat(stage1.allBuildPlans().size(), is(1)); assertThat("Should require approval", stage1.requiresApproval(), is(true)); AdminsConfig admins = stage1.getApproval().getAuthConfig(); assertThat(admins, hasItem((Admin) new AdminRole(new CaseInsensitiveString("admin")))); assertThat("Should not require approval", stage2.requiresApproval(), is(false));
public static StageInstanceModels stageHistory(PipelineConfig pipelineConfig, Date modificationDate) { StageInstanceModels history = new StageInstanceModels(); for (StageConfig stageConfig : pipelineConfig) { StageInstanceModel item = new StageInstanceModel(CaseInsensitiveString.str(stageConfig.name()), "1", buildHistory(stageConfig, modificationDate)); item.setCounter("1"); item.setApprovalType(new InstanceFactory().createStageInstance(stageConfig, new DefaultSchedulingContext("anyone"), md5, new TimeProvider()).getApprovalType()); if (stageConfig.requiresApproval()) { item.setApprovedBy(APPROVED_BY); } else { item.setApprovedBy(GoConstants.DEFAULT_APPROVED_BY); } history.add(item); } return history; }