Search in sources :

Example 6 with ConfigOrigin

use of com.thoughtworks.go.config.remote.ConfigOrigin in project gocd by gocd.

the class EnvironmentsRepresenter method origin.

private static void origin(OutputWriter writer, EnvironmentConfig environment, String agentUuid) {
    if (environment.containsAgentRemotely(agentUuid)) {
        ConfigOrigin originForAgent = environment.originForAgent(agentUuid).orElseThrow(() -> bomb(String.format("Did not expect config origin to be null for Environment: %s, Agent: %s", environment.name(), agentUuid)));
        writeConfigRepoOrigin(writer, (RepoConfigOrigin) originForAgent);
    } else {
        writeConfigXmlOrigin(writer);
    }
}
Also used : ConfigOrigin(com.thoughtworks.go.config.remote.ConfigOrigin) RepoConfigOrigin(com.thoughtworks.go.config.remote.RepoConfigOrigin)

Example 7 with ConfigOrigin

use of com.thoughtworks.go.config.remote.ConfigOrigin in project gocd by gocd.

the class GoFileConfigDataSource method areKnownPartialsSameAsValidPartials.

protected boolean areKnownPartialsSameAsValidPartials(List<PartialConfig> lastKnownPartials, List<PartialConfig> lastValidPartials) {
    if (lastKnownPartials.size() != lastValidPartials.size()) {
        return false;
    }
    final ArrayList<ConfigOrigin> validConfigOrigins = ListUtil.map(lastValidPartials, new ListUtil.Transformer<PartialConfig, ConfigOrigin>() {

        @Override
        public ConfigOrigin transform(PartialConfig partialConfig) {
            return partialConfig.getOrigin();
        }
    });
    PartialConfig invalidKnownPartial = ListUtil.find(lastKnownPartials, new ListUtil.Condition() {

        @Override
        public <T> boolean isMet(T item) {
            return !validConfigOrigins.contains(((PartialConfig) item).getOrigin());
        }
    });
    return invalidKnownPartial == null;
}
Also used : ConfigOrigin(com.thoughtworks.go.config.remote.ConfigOrigin) PartialConfig(com.thoughtworks.go.config.remote.PartialConfig)

Example 8 with ConfigOrigin

use of com.thoughtworks.go.config.remote.ConfigOrigin in project gocd by gocd.

the class EnvironmentAgentRepresenter method toJSON.

static void toJSON(OutputWriter writer, EnvironmentAgentConfig agent, EnvironmentConfig environmentConfig) {
    writer.add("uuid", agent.getUuid());
    ConfigOrigin origin = environmentConfig.isLocal() ? FILE_CONFIG_ORIGIN : ((MergeEnvironmentConfig) environmentConfig).getOriginForAgent(agent.getUuid());
    writer.addChild("origin", originWriter -> EntityConfigOriginRepresenter.toJSON(originWriter, origin));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) ConfigOrigin(com.thoughtworks.go.config.remote.ConfigOrigin)

Example 9 with ConfigOrigin

use of com.thoughtworks.go.config.remote.ConfigOrigin in project gocd by gocd.

the class EnvironmentPipelineRepresenter method toJSON.

static void toJSON(OutputWriter writer, EnvironmentPipelineConfig pipeline, EnvironmentConfig environmentConfig) {
    writer.add("name", pipeline.getName());
    ConfigOrigin origin = environmentConfig.isLocal() ? FILE_CONFIG_ORIGIN : ((MergeEnvironmentConfig) environmentConfig).getOriginForPipeline(pipeline.getName());
    writer.addChild("origin", originWriter -> EntityConfigOriginRepresenter.toJSON(originWriter, origin));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) ConfigOrigin(com.thoughtworks.go.config.remote.ConfigOrigin)

Example 10 with ConfigOrigin

use of com.thoughtworks.go.config.remote.ConfigOrigin in project gocd by gocd.

the class EnvironmentEnvironmentVariableRepresenter method toJSON.

public static void toJSON(OutputWriter writer, EnvironmentVariableConfig envVar, EnvironmentConfig environmentConfig) {
    EnvironmentVariableRepresenter.toJSON(writer, envVar);
    ConfigOrigin origin = environmentConfig.isLocal() ? FILE_CONFIG_ORIGIN : ((MergeEnvironmentConfig) environmentConfig).getOriginForEnvironmentVariable(envVar.getName());
    writer.addChild("origin", originWriter -> EntityConfigOriginRepresenter.toJSON(originWriter, origin));
}
Also used : FileConfigOrigin(com.thoughtworks.go.config.remote.FileConfigOrigin) ConfigOrigin(com.thoughtworks.go.config.remote.ConfigOrigin)

Aggregations

ConfigOrigin (com.thoughtworks.go.config.remote.ConfigOrigin)11 FileConfigOrigin (com.thoughtworks.go.config.remote.FileConfigOrigin)6 RepoConfigOrigin (com.thoughtworks.go.config.remote.RepoConfigOrigin)4 Test (org.junit.jupiter.api.Test)3 UIConfigOrigin (com.thoughtworks.go.config.remote.UIConfigOrigin)2 DependencyMaterialConfig (com.thoughtworks.go.config.materials.dependency.DependencyMaterialConfig)1 PartialConfig (com.thoughtworks.go.config.remote.PartialConfig)1 CanDeleteResult (com.thoughtworks.go.server.presentation.CanDeleteResult)1 Node (com.thoughtworks.go.util.Node)1