use of com.thoughtworks.go.config.remote.ConfigReposConfig in project gocd by gocd.
the class GoConfigMother method configWithConfigRepo.
public static CruiseConfig configWithConfigRepo() {
CruiseConfig cruiseConfig = new BasicCruiseConfig();
cruiseConfig.setConfigRepos(new ConfigReposConfig(ConfigRepoConfig.createConfigRepoConfig(git("https://github.com/tomzo/gocd-indep-config-part.git"), "myplugin", "id2")));
return cruiseConfig;
}
use of com.thoughtworks.go.config.remote.ConfigReposConfig in project gocd by gocd.
the class GoConfigWatchListTest method shouldNotifyConfigListenersWhenConfigChanges.
@Test
public void shouldNotifyConfigListenersWhenConfigChanges() throws Exception {
final ChangedRepoConfigWatchListListener listener = mock(ChangedRepoConfigWatchListListener.class);
watchList.registerListener(listener);
when(cruiseConfig.getConfigRepos()).thenReturn(new ConfigReposConfig());
watchList.onConfigChange(cruiseConfig);
verify(listener, times(1)).onChangedRepoConfigWatchList(notNull(ConfigReposConfig.class));
}
use of com.thoughtworks.go.config.remote.ConfigReposConfig in project gocd by gocd.
the class ConfigReposControllerV4 method index.
String index(Request req, Response res) {
ConfigReposConfig repos = allRepos();
ConfigReposConfig userSpecificRepos = repos.stream().filter(configRepoConfig -> authHelper.doesUserHasPermissions(currentUsername(), getAction(req), CONFIG_REPO, configRepoConfig.getId())).collect(toCollection(ConfigReposConfig::new));
String etag = entityHashingService.hashForEntity(userSpecificRepos);
setEtagHeader(res, etag);
if (fresh(req, etag)) {
return notModified(res);
}
return jsonizeAsTopLevelObject(req, w -> ConfigReposConfigRepresenterV4.toJSON(w, userSpecificRepos));
}
use of com.thoughtworks.go.config.remote.ConfigReposConfig in project gocd by gocd.
the class BasicEnvironmentConfig method validate.
@Override
public void validate(ValidationContext validationContext) {
// each of these references is defined in this.origin
for (EnvironmentPipelineConfig pipelineRefConfig : this.pipelines) {
ConfigReposConfig configRepos = validationContext.getConfigRepos();
PipelineConfig pipelineConfig = validationContext.getPipelineConfigByName(pipelineRefConfig.getName());
if (pipelineConfig == null) {
// other rule will error that we reference unknown pipeline
continue;
}
if (validationContext.shouldCheckConfigRepo()) {
if (!configRepos.isReferenceAllowed(this.origin, pipelineConfig.getOrigin()))
pipelineRefConfig.addError(EnvironmentPipelineConfig.ORIGIN, String.format("Environment defined in %s cannot reference a pipeline in %s", this.origin, displayNameFor(pipelineConfig.getOrigin())));
}
}
}
use of com.thoughtworks.go.config.remote.ConfigReposConfig in project gocd by gocd.
the class UpdateConfigRepoCommand method update.
@Override
public void update(CruiseConfig preprocessedConfig) {
ConfigReposConfig configRepos = preprocessedConfig.getConfigRepos();
configRepos.replace(configRepos.getConfigRepo(repoIdToUpdate), newConfigRepo);
}
Aggregations