Search in sources :

Example 41 with PipelineInstanceModels

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;
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) PipelineInstanceModels.createPipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels.createPipelineInstanceModels) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) PipelineInstanceModel.createEmptyPipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel.createEmptyPipelineInstanceModel)

Example 42 with PipelineInstanceModels

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);
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) PipelineInstanceModels.createPipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels.createPipelineInstanceModels) Permissions(com.thoughtworks.go.config.security.Permissions)

Example 43 with PipelineInstanceModels

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;
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) PipelineInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel) CaseInsensitiveString(com.thoughtworks.go.config.CaseInsensitiveString)

Example 44 with PipelineInstanceModels

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()));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) Test(org.junit.Test)

Example 45 with PipelineInstanceModels

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"));
}
Also used : PipelineInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels) StageInstanceModels(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) StageInstanceModel(com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel) Test(org.junit.Test)

Aggregations

PipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels)45 Test (org.junit.Test)37 PipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModel)12 StageInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModels)8 PipelineInstanceModels.createPipelineInstanceModels (com.thoughtworks.go.presentation.pipelinehistory.PipelineInstanceModels.createPipelineInstanceModels)4 StageInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.StageInstanceModel)4 PipelineHistoryGroups (com.thoughtworks.go.server.presentation.models.PipelineHistoryGroups)4 EmptyPipelineInstanceModel (com.thoughtworks.go.presentation.pipelinehistory.EmptyPipelineInstanceModel)3 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)2 PipelineNotFoundException (com.thoughtworks.go.config.PipelineNotFoundException)2 Permissions (com.thoughtworks.go.config.security.Permissions)2 Modification (com.thoughtworks.go.domain.materials.Modification)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Matchers.anyString (org.mockito.Matchers.anyString)2 SqlMapClientTemplate (org.springframework.orm.ibatis.SqlMapClientTemplate)2 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)1 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)1 HgMaterial (com.thoughtworks.go.config.materials.mercurial.HgMaterial)1 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)1 PipelineDependencyGraphOld (com.thoughtworks.go.domain.PipelineDependencyGraphOld)1