Search in sources :

Example 1 with BakeService

use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.bake.BakeService in project halyard by spinnaker.

the class BakeDeployer method deploy.

@Override
public RemoteAction deploy(BakeServiceProvider serviceProvider, DeploymentDetails deploymentDetails, GenerateService.ResolvedConfiguration resolvedConfiguration, List<SpinnakerService.Type> serviceTypes) {
    List<BakeService> enabledServices = serviceProvider.getPrioritizedBakeableServices(serviceTypes).stream().filter(i -> resolvedConfiguration.getServiceSettings(i.getService()).getEnabled()).collect(Collectors.toList());
    Map<String, String> installCommands = enabledServices.stream().reduce(new HashMap<>(), (commands, installable) -> {
        String command = String.join("\n", installable.installArtifactCommand(deploymentDetails), installable.stageStartupScripts(deploymentDetails, resolvedConfiguration));
        commands.put(installable.getService().getCanonicalName(), command);
        return commands;
    }, (m1, m2) -> {
        m1.putAll(m2);
        return m1;
    });
    String startupCommand = String.join("\n", enabledServices.stream().map(BakeService::getStartupCommand).filter(Objects::nonNull).collect(Collectors.toList()));
    String installCommand = serviceProvider.getInstallCommand(deploymentDetails, resolvedConfiguration, installCommands, startupCommand);
    RemoteAction result = new RemoteAction();
    result.setAutoRun(true);
    result.setScript(installCommand);
    return result;
}
Also used : HalException(com.netflix.spinnaker.halyard.core.error.v1.HalException) HashMap(java.util.HashMap) GenerateService(com.netflix.spinnaker.halyard.deploy.services.v1.GenerateService) SpinnakerRuntimeSettings(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings) BakeServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.bake.BakeServiceProvider) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) Component(org.springframework.stereotype.Component) List(java.util.List) BakeService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.bake.BakeService) Map(java.util.Map) Problem(com.netflix.spinnaker.halyard.core.problem.v1.Problem) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction) SpinnakerService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerService) Objects(java.util.Objects) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction) BakeService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.bake.BakeService)

Aggregations

RemoteAction (com.netflix.spinnaker.halyard.core.RemoteAction)1 HalException (com.netflix.spinnaker.halyard.core.error.v1.HalException)1 Problem (com.netflix.spinnaker.halyard.core.problem.v1.Problem)1 GenerateService (com.netflix.spinnaker.halyard.deploy.services.v1.GenerateService)1 SpinnakerRuntimeSettings (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings)1 SpinnakerService (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerService)1 BakeService (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.bake.BakeService)1 BakeServiceProvider (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.bake.BakeServiceProvider)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Objects (java.util.Objects)1 Collectors (java.util.stream.Collectors)1 Component (org.springframework.stereotype.Component)1