use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class GoDashboardCurrentStateLoader method instancesFor.
private PipelineInstanceModels instancesFor(PipelineConfig pipelineConfig, PipelineInstanceModels historyForDashboard) {
PipelineInstanceModels pims = findPIMsWithFallbacks(pipelineConfig, historyForDashboard);
boolean isCurrentlyLocked = pipelineLockService.isLocked(str(pipelineConfig.name()));
boolean isUnlockable = pipelineUnlockApiService.isUnlockable(str(pipelineConfig.name()));
for (PipelineInstanceModel instanceModel : pims) {
populateStagesWhichHaventRunFromConfig(instanceModel, pipelineConfig);
populateLockStatus(instanceModel, pipelineConfig.isLockable(), isCurrentlyLocked, isUnlockable);
}
return pims;
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class GoDashboardCurrentStateLoader method pipelineFor.
public GoDashboardPipeline pipelineFor(PipelineConfig pipelineConfig, PipelineConfigs groupConfig) {
List<String> pipelineNames = CaseInsensitiveString.toStringList(Collections.singletonList(pipelineConfig.getName()));
PipelineInstanceModels historyForDashboard = loadHistoryForPipelines(pipelineNames);
Permissions permissions = permissionsAuthority.permissionsForPipeline(pipelineConfig.name());
return createGoDashboardPipeline(pipelineConfig, permissions, historyForDashboard, groupConfig);
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class PipelineSqlMapDao method loadHistory.
private PipelineInstanceModels loadHistory(String pipelineName, List<Long> ids) {
if (ids.isEmpty()) {
return PipelineInstanceModels.createPipelineInstanceModels();
}
Map<String, Object> args = arguments("pipelineName", pipelineName).and("from", Collections.min(ids)).and("to", Collections.max(ids)).asMap();
PipelineInstanceModels history = PipelineInstanceModels.createPipelineInstanceModels((List<PipelineInstanceModel>) getSqlMapClientTemplate().queryForList("getPipelineHistoryByName", args));
for (PipelineInstanceModel pipelineInstanceModel : history) {
loadPipelineHistoryBuildCause(pipelineInstanceModel);
}
return history;
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldLoadPipelineHistoriesStartingAtTheSuppliedLabel.
@Test
public void shouldLoadPipelineHistoriesStartingAtTheSuppliedLabel() throws Exception {
PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", "dev");
mingleConfig.setLabelTemplate("LABEL:${COUNT}");
Pipeline pipeline1 = schedulePipelineWithStages(mingleConfig);
Pipeline pipeline2 = schedulePipelineWithStages(mingleConfig);
Pipeline pipeline3 = schedulePipelineWithStages(mingleConfig);
Pipeline pipeline4 = schedulePipelineWithStages(mingleConfig);
Pipeline pipeline5 = schedulePipelineWithStages(mingleConfig);
PipelineInstanceModels pipelineHistories = pipelineDao.loadHistory(pipeline1.getName(), 2, pipeline3.getLabel());
assertThat(pipelineHistories.size(), is(2));
assertThat(pipelineHistories.get(0).getLabel(), is(pipeline3.getLabel()));
assertThat(pipelineHistories.get(1).getLabel(), is(pipeline2.getLabel()));
}
use of com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels in project gocd by gocd.
the class PipelineSqlMapDaoIntegrationTest method shouldLoadPipelineHistories.
@Test
public void shouldLoadPipelineHistories() throws Exception {
String dev = "dev";
PipelineConfig mingleConfig = PipelineMother.twoBuildPlansWithResourcesAndMaterials("mingle", dev);
Pipeline mingle = schedulePipelineWithStages(mingleConfig);
Stage firstStage = mingle.getFirstStage();
Pipeline mingle2 = schedulePipelineWithStages(mingleConfig);
JobInstance instance = firstStage.getJobInstances().first();
jobInstanceDao.ignore(instance);
PipelineInstanceModels pipelineHistories = pipelineDao.loadHistory(mingle.getName(), 10, 0);
assertThat(pipelineHistories.size(), is(2));
StageInstanceModels stageHistories = pipelineHistories.first().getStageHistory();
assertThat(stageHistories.size(), is(1));
StageInstanceModel history = stageHistories.first();
assertThat(history.getName(), is(dev));
assertThat(history.getApprovalType(), is(GoConstants.APPROVAL_SUCCESS));
assertThat(history.getBuildHistory().size(), is(2));
assertThat(pipelineHistories.get(1).getName(), is("mingle"));
}
Aggregations