private List<String> invertSelections(List<String> selectedPipelines) { List<String> unselectedPipelines = new ArrayList<>(); List<PipelineConfig> pipelineConfigList = cruiseConfig().getAllPipelineConfigs(); for (PipelineConfig pipelineConfig : pipelineConfigList) { String pipelineName = CaseInsensitiveString.str(pipelineConfig.name()); if (!selectedPipelines.contains(pipelineName)) { unselectedPipelines.add(pipelineName); } } return unselectedPipelines; }
public MaterialConfig findMaterialWithName( final CaseInsensitiveString pipelineName, final CaseInsensitiveString materialName) { MaterialConfigs materialConfigs = materialConfigsFor(pipelineName); for (MaterialConfig materialConfig : materialConfigs) { if (materialName.equals(materialConfig.getName())) { return materialConfig; } } LOGGER.error("material [" + materialName + "] not found in pipeline [" + pipelineName + "]"); return null; }
public JobConfigIdentifier translateToActualCase(JobConfigIdentifier identifier) { PipelineConfig pipelineConfig = getCurrentConfig() .pipelineConfigByName(new CaseInsensitiveString(identifier.getPipelineName())); String translatedPipelineName = CaseInsensitiveString.str(pipelineConfig.name()); StageConfig stageConfig = pipelineConfig.findBy(new CaseInsensitiveString(identifier.getStageName())); if (stageConfig == null) { throw new StageNotFoundException( new CaseInsensitiveString(identifier.getPipelineName()), new CaseInsensitiveString(identifier.getStageName())); } String translatedStageName = CaseInsensitiveString.str(stageConfig.name()); JobConfig plan = stageConfig.jobConfigByInstanceName(identifier.getJobName(), true); if (plan == null) { throw new JobNotFoundException( identifier.getPipelineName(), identifier.getStageName(), identifier.getJobName()); } String translatedJobName = plan.translatedName(identifier.getJobName()); return new JobConfigIdentifier(translatedPipelineName, translatedStageName, translatedJobName); }
private String setUpPipelineGroupsWithAdminPermissions() throws IOException { setCurrentUser("ram"); assertThat(CaseInsensitiveString.str(UserHelper.getUserName().getUsername()), is("ram")); configHelper.addPipelineWithGroup("studios", "go", "stage", "build1", "build2"); configHelper.setAdminPermissionForGroup("studios", "barrow"); configHelper.addPipelineWithGroup("consulting", "bcg", "stage", "build1", "build2"); configHelper.setAdminPermissionForGroup("consulting", "ram"); configHelper.addTemplate("newTemplate", "stage"); return goConfigDao.md5OfConfigFile(); }
public boolean isAdministrator(CaseInsensitiveString username) { return isAdministrator(username.toString()); }
public boolean isUserAdmin(Username username) { return isAdministrator(CaseInsensitiveString.str(username.getUsername())); }