use of com.netflix.spinnaker.halyard.config.model.v1.node.Artifacts in project halyard by spinnaker.
the class EditFeaturesCommand method executeThis.
@Override
protected void executeThis() {
String currentDeployment = getCurrentDeployment();
Features features = new OperationHandler<Features>().setOperation(Daemon.getFeatures(currentDeployment, false)).setFailureMesssage("Failed to load features.").get();
int originalHash = features.hashCode();
features.setChaos(chaos != null ? chaos : features.isChaos());
features.setJobs(jobs != null ? jobs : features.isJobs());
features.setPipelineTemplates(pipelineTemplates != null ? pipelineTemplates : features.getPipelineTemplates());
features.setArtifacts(artifacts != null ? artifacts : features.getArtifacts());
features.setMineCanary(mineCanary != null ? mineCanary : features.getMineCanary());
features.setInfrastructureStages(infrastructureStages != null ? infrastructureStages : features.getInfrastructureStages());
if (originalHash == features.hashCode()) {
AnsiUi.failure("No changes supplied.");
return;
}
new OperationHandler<Void>().setOperation(Daemon.setFeatures(currentDeployment, !noValidate, features)).setSuccessMessage("Successfully updated features.").setFailureMesssage("Failed to edit features.").get();
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Artifacts in project halyard by spinnaker.
the class ClouddriverProfileFactory method setProfile.
@Override
protected void setProfile(Profile profile, DeploymentConfiguration deploymentConfiguration, SpinnakerRuntimeSettings endpoints) {
super.setProfile(profile, deploymentConfiguration, endpoints);
// We need to make modifications to this deployment configuration, but can't use helpful objects
// like the accountService on a clone. Therefore, we'll make the modifications in place and
// restore to the original state when the modifications are written out.
Providers originalProviders = deploymentConfiguration.getProviders().cloneNode(Providers.class);
Providers modifiedProviders = deploymentConfiguration.getProviders();
DeploymentEnvironment deploymentEnvironment = deploymentConfiguration.getDeploymentEnvironment();
if (deploymentEnvironment.getBootstrapOnly() != null && deploymentEnvironment.getBootstrapOnly()) {
String bootstrapAccountName = deploymentEnvironment.getAccountName();
removeBootstrapOnlyAccount(modifiedProviders, deploymentConfiguration.getName(), bootstrapAccountName);
}
Artifacts artifacts = deploymentConfiguration.getArtifacts();
List<String> files = backupRequiredFiles(modifiedProviders, deploymentConfiguration.getName());
files.addAll(backupRequiredFiles(artifacts, deploymentConfiguration.getName()));
if (deploymentConfiguration.getProviders() != null) {
processProviders(deploymentConfiguration.getProviders());
}
profile.appendContents(yamlToString(modifiedProviders)).appendContents(yamlToString(new ArtifactWrapper(artifacts))).appendContents(profile.getBaseContents()).setRequiredFiles(files);
deploymentConfiguration.setProviders(originalProviders);
}
use of com.netflix.spinnaker.halyard.config.model.v1.node.Artifacts in project halyard by spinnaker.
the class ArtifactProviderService method setArtifactProvider.
public void setArtifactProvider(String deploymentName, ArtifactProvider provider) {
DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName);
Artifacts artifacts = deploymentConfiguration.getArtifacts();
switch(provider.providerType()) {
case GCS:
artifacts.setGcs((GcsArtifactProvider) provider);
break;
case GITHUB:
artifacts.setGithub((GitHubArtifactProvider) provider);
break;
case HTTP:
artifacts.setHttp((HttpArtifactProvider) provider);
break;
default:
throw new IllegalArgumentException("Unknown provider type " + provider.providerType());
}
}
Aggregations