use of com.thoughtworks.go.config.StageConfig in project gocd by gocd.
the class StageMother method failingStage.
public static Stage failingStage(String stageName) {
StageConfig stageConfig = StageConfigMother.twoBuildPlansWithResourcesAndMaterials(stageName);
Stage stage = scheduleInstance(stageConfig);
stage.setId(fakeId());
stage.getJobInstances().get(0).fail();
stage.getJobInstances().get(1).completing(JobResult.Passed);
return stage;
}
use of com.thoughtworks.go.config.StageConfig in project gocd by gocd.
the class PipelineMother method withTwoStagesOneBuildEach.
public static PipelineConfig withTwoStagesOneBuildEach(String pipelineName, String stageName, String stageName2) {
StageConfig stageConfig1 = com.thoughtworks.go.helper.StageConfigMother.oneBuildPlanWithResourcesAndMaterials(stageName);
StageConfig stageConfig2 = com.thoughtworks.go.helper.StageConfigMother.oneBuildPlanWithResourcesAndMaterials(stageName2);
MaterialConfigs materialConfigs = MaterialConfigsMother.defaultMaterialConfigs();
return new PipelineConfig(new CaseInsensitiveString(pipelineName), materialConfigs, stageConfig1, stageConfig2);
}
use of com.thoughtworks.go.config.StageConfig in project gocd by gocd.
the class StageMother method scheduledStage.
public static Stage scheduledStage(String pipelineName, int pipelineCounter, String stageName, int stageCounter, String buildName) {
StageConfig stageConfig = StageConfigMother.oneBuildPlanWithResourcesAndMaterials(stageName, buildName);
Stage stage = scheduleInstance(stageConfig);
stage.setCounter(stageCounter);
stage.setIdentifier(new StageIdentifier(pipelineName, pipelineCounter, "LABEL-" + pipelineCounter, stageName, "" + stageCounter));
stage.setId(fakeId());
for (JobInstance jobInstance : stage.getJobInstances()) {
jobInstance.setIdentifier(new JobIdentifier(pipelineName, pipelineCounter, "LABEL-" + pipelineCounter, stageName, "" + stageCounter, buildName, fakeId()));
}
return stage;
}
use of com.thoughtworks.go.config.StageConfig in project gocd by gocd.
the class StageMother method completedStageInstanceWithTwoPlans.
public static Stage completedStageInstanceWithTwoPlans(String stageName) {
StageConfig scheduledStageConfig = StageConfigMother.twoBuildPlansWithResourcesAndMaterials(stageName);
Stage completed = scheduleInstance(scheduledStageConfig);
passBuildInstancesOfStage(completed, new Date());
return completed;
}
use of com.thoughtworks.go.config.StageConfig in project gocd by gocd.
the class ConfigDbStateRepository method flushArtifactCleanupProhibitions.
private Object flushArtifactCleanupProhibitions() {
List<StageArtifactCleanupProhibited> existingEntries = getHibernateTemplate().find("from StageArtifactCleanupProhibited");
HashMap<Map.Entry<String, String>, StageArtifactCleanupProhibited> persistentStateMap = new HashMap<>();
for (StageArtifactCleanupProhibited persistentState : existingEntries) {
persistentState.setProhibited(false);
persistentStateMap.put(new AbstractMap.SimpleEntry<>(persistentState.getPipelineName(), persistentState.getStageName()), persistentState);
}
List<PipelineConfig> pipelineConfigs = goConfigService.currentCruiseConfig().allPipelines();
for (PipelineConfig pipelineConfig : pipelineConfigs) {
for (StageConfig stageConfig : pipelineConfig) {
StageArtifactCleanupProhibited stageArtifactCleanupProhibited = persistentStateMap.get(new AbstractMap.SimpleEntry<>(CaseInsensitiveString.str(pipelineConfig.name()), CaseInsensitiveString.str(stageConfig.name())));
if (stageArtifactCleanupProhibited == null) {
stageArtifactCleanupProhibited = new StageArtifactCleanupProhibited(CaseInsensitiveString.str(pipelineConfig.name()), CaseInsensitiveString.str(stageConfig.name()));
}
stageArtifactCleanupProhibited.setProhibited(stageConfig.isArtifactCleanupProhibited());
getHibernateTemplate().saveOrUpdate(stageArtifactCleanupProhibited);
}
}
return null;
}
Aggregations