Search in sources :

Example 1 with Artifacts

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();
}
Also used : Features(com.netflix.spinnaker.halyard.config.model.v1.node.Features) OperationHandler(com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)

Example 2 with Artifacts

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);
}
Also used : Artifacts(com.netflix.spinnaker.halyard.config.model.v1.node.Artifacts) DeploymentEnvironment(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentEnvironment) Providers(com.netflix.spinnaker.halyard.config.model.v1.node.Providers)

Example 3 with Artifacts

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());
    }
}
Also used : Artifacts(com.netflix.spinnaker.halyard.config.model.v1.node.Artifacts) DeploymentConfiguration(com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)

Aggregations

Artifacts (com.netflix.spinnaker.halyard.config.model.v1.node.Artifacts)2 OperationHandler (com.netflix.spinnaker.halyard.cli.services.v1.OperationHandler)1 DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)1 DeploymentEnvironment (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentEnvironment)1 Features (com.netflix.spinnaker.halyard.config.model.v1.node.Features)1 Providers (com.netflix.spinnaker.halyard.config.model.v1.node.Providers)1