Search in sources :

Example 36 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class BackupServiceH2IntegrationTest method saveAPipeline.

private Pipeline saveAPipeline() {
    PipelineConfig pipelineConfig = PipelineConfigMother.pipelineConfig("pipeline", new StageConfig(new CaseInsensitiveString("stage"), new JobConfigs(new JobConfig("job-one"))));
    pipelineConfig.materialConfigs().clear();
    SvnMaterialConfig onDirOne = MaterialConfigsMother.svnMaterialConfig("google.com", "dirOne", "loser", "boozer", false, "**/*.html");
    pipelineConfig.addMaterialConfig(onDirOne);
    Pipeline building = PipelineMother.building(pipelineConfig);
    return dbHelper.savePipelineWithMaterials(building);
}
Also used : SvnMaterialConfig(com.thoughtworks.go.config.materials.svn.SvnMaterialConfig) Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 37 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class CachedCurrentActivityService method stagesModel.

private List<StageJsonPresentationModel> stagesModel(PipelineConfig pipelineConfig) {
    List<StageJsonPresentationModel> presenters = new ArrayList<>();
    for (StageConfig stageConfig : pipelineConfig) {
        Stage mostRecentStage = stageService.mostRecentStageWithBuilds(CaseInsensitiveString.str(pipelineConfig.name()), stageConfig);
        Pipeline pipeline = pipelineService.pipelineWithModsByStageId(CaseInsensitiveString.str(pipelineConfig.name()), mostRecentStage.getId());
        presenters.add(stageModel(pipeline, mostRecentStage));
    }
    return presenters;
}
Also used : ArrayList(java.util.ArrayList) StageJsonPresentationModel(com.thoughtworks.go.server.presentation.models.StageJsonPresentationModel) Stage(com.thoughtworks.go.domain.Stage) StageConfig(com.thoughtworks.go.config.StageConfig) Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 38 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class PropertiesController method jobsSearch.

@RequestMapping("/repository/restful/properties/jobs/search")
public ModelAndView jobsSearch(@RequestParam("pipelineName") String pipelineName, @RequestParam("stageName") String stageName, @RequestParam("jobName") String jobName, @RequestParam(value = "limitPipeline", required = false) String limitPipeline, @RequestParam(value = "limitCount", required = false) Integer limitCount, HttpServletResponse response) throws Exception {
    Long limitPipelineId = null;
    if (limitPipeline != null) {
        Pipeline pipeline = pipelineService.findPipelineByCounterOrLabel(pipelineName, limitPipeline);
        if (pipeline != null) {
            limitPipelineId = pipeline.getId();
        } else {
            return notFound(String.format("The value [%s] of query parameter 'limitPipeline' is neither a pipeline counter nor label", limitPipeline)).respond(response);
        }
    }
    limitCount = limitCount == null ? 100 : limitCount;
    try {
        List<Properties> result = propertyService.loadHistory(pipelineName, stageName, jobName, limitPipelineId, limitCount);
        PropertiesService.PropertyLister propertyLister = PropertiesService.asCsv(jobName);
        return propertyLister.listPropertiesHistory(result).respond(response);
    } catch (Exception e) {
        String message = String.format("Error on listing properties history for job %s/%s/%s with limitPipeline=%s and limitCount=%s", pipelineName, stageName, jobName, limitPipeline, limitCount);
        LOGGER.error(message, e);
        return notFound(message + "\n" + e.getMessage()).respond(response);
    }
}
Also used : PropertiesService(com.thoughtworks.go.server.service.PropertiesService) Properties(com.thoughtworks.go.domain.Properties) Pipeline(com.thoughtworks.go.domain.Pipeline) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 39 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class PropertyDaoTest method createPipelineWithJobProperty.

private Pipeline createPipelineWithJobProperty(String pipelineName, Property property) {
    Pipeline pipeline = _createPassedPipeline(pipelineName);
    propertyDao.save(pipeline.getFirstStage().getJobInstances().first().getId(), property);
    return pipeline;
}
Also used : Pipeline(com.thoughtworks.go.domain.Pipeline)

Example 40 with Pipeline

use of com.thoughtworks.go.domain.Pipeline in project gocd by gocd.

the class PropertyDaoTest method shouldLoadAllPropertiesHistoryIfLimitPipelineNotSpecified.

@Test
public void shouldLoadAllPropertiesHistoryIfLimitPipelineNotSpecified() throws Exception {
    Pipeline oldPipeline = createPipelineWithJobProperty(PIPELINE1, property("key1", "value1"));
    Pipeline newPipeline = createPipelineWithJobProperty(PIPELINE1, property("key2", "value2"));
    List<Properties> history = propertyDao.loadHistory(PIPELINE1, STAGE1, PLAN1, null, Integer.MAX_VALUE);
    assertThat(history.size(), is(2));
}
Also used : Properties(com.thoughtworks.go.domain.Properties) Pipeline(com.thoughtworks.go.domain.Pipeline) Test(org.junit.Test)

Aggregations

Pipeline (com.thoughtworks.go.domain.Pipeline)177 Test (org.junit.jupiter.api.Test)73 Test (org.junit.Test)55 Stage (com.thoughtworks.go.domain.Stage)40 JobInstance (com.thoughtworks.go.domain.JobInstance)26 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)23 Username (com.thoughtworks.go.server.domain.Username)17 ServerHealthStateOperationResult (com.thoughtworks.go.server.service.result.ServerHealthStateOperationResult)16 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)14 PipelineConfig (com.thoughtworks.go.config.PipelineConfig)12 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)12 StageIdentifier (com.thoughtworks.go.domain.StageIdentifier)11 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)10 ModelAndView (org.springframework.web.servlet.ModelAndView)10 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)9 DependencyMaterial (com.thoughtworks.go.config.materials.dependency.DependencyMaterial)9 Modification (com.thoughtworks.go.domain.materials.Modification)9 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)7 PipelineState (com.thoughtworks.go.domain.PipelineState)6 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)6