Search in sources :

Example 1 with LocalServiceProvider

use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.LocalServiceProvider in project halyard by spinnaker.

the class LocalDeployer method deploy.

@Override
public RemoteAction deploy(LocalServiceProvider serviceProvider, DeploymentDetails deploymentDetails, GenerateService.ResolvedConfiguration resolvedConfiguration, List<SpinnakerService.Type> serviceTypes) {
    List<LocalService> enabledServices = serviceProvider.getLocalServices(serviceTypes).stream().filter(i -> resolvedConfiguration.getServiceSettings(i.getService()).getEnabled()).collect(Collectors.toList());
    Map<String, String> installCommands = enabledServices.stream().filter(i -> !resolvedConfiguration.getServiceSettings(i.getService()).getSkipLifeCycleManagement()).reduce(new HashMap<>(), (commands, installable) -> {
        String command = String.join("\n", installable.installArtifactCommand(deploymentDetails), installable.stageProfilesCommand(deploymentDetails, resolvedConfiguration));
        commands.put(installable.getService().getCanonicalName(), command);
        return commands;
    }, (m1, m2) -> {
        m1.putAll(m2);
        return m1;
    });
    String installCommand = serviceProvider.getInstallCommand(deploymentDetails, resolvedConfiguration, installCommands);
    RemoteAction result = new RemoteAction();
    result.setAutoRun(true);
    result.setScript(installCommand);
    return result;
}
Also used : RedisService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.RedisService) 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) Collectors(java.util.stream.Collectors) LocalService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.LocalService) ClouddriverService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ClouddriverService) Slf4j(lombok.extern.slf4j.Slf4j) Component(org.springframework.stereotype.Component) List(java.util.List) LocalServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.LocalServiceProvider) Jedis(redis.clients.jedis.Jedis) 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) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction) LocalService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.LocalService)

Example 2 with LocalServiceProvider

use of com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.LocalServiceProvider in project halyard by spinnaker.

the class LocalGitDeployer method prep.

@Override
public RemoteAction prep(LocalServiceProvider serviceProvider, DeploymentDetails deploymentDetails, SpinnakerRuntimeSettings runtimeSettings, List<SpinnakerService.Type> serviceTypes) {
    LocalGitServiceProvider localGitServiceProvider = (LocalGitServiceProvider) serviceProvider;
    List<LocalGitService> enabledServices = localGitServiceProvider.getLocalGitServices(serviceTypes);
    List<String> prepCommands = enabledServices.stream().filter(i -> !runtimeSettings.getServiceSettings(i.getService()).getSkipLifeCycleManagement()).map(s -> {
        s.commitWrapperScripts();
        return s.prepArtifactCommand(deploymentDetails);
    }).collect(Collectors.toList());
    String prepCommand = localGitServiceProvider.getPrepCommand(deploymentDetails, prepCommands);
    RemoteAction result = new RemoteAction();
    result.setAutoRun(true);
    result.setScript(prepCommand);
    return result;
}
Also used : List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) Component(org.springframework.stereotype.Component) LocalServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.LocalServiceProvider) LocalGitServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.git.LocalGitServiceProvider) LocalGitService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.git.LocalGitService) SpinnakerRuntimeSettings(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction) SpinnakerService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerService) Collectors(java.util.stream.Collectors) LocalGitServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.git.LocalGitServiceProvider) LocalGitService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.git.LocalGitService) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction)

Aggregations

RemoteAction (com.netflix.spinnaker.halyard.core.RemoteAction)2 SpinnakerRuntimeSettings (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings)2 SpinnakerService (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerService)2 LocalServiceProvider (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.LocalServiceProvider)2 List (java.util.List)2 Collectors (java.util.stream.Collectors)2 Slf4j (lombok.extern.slf4j.Slf4j)2 Component (org.springframework.stereotype.Component)2 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 ClouddriverService (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.ClouddriverService)1 RedisService (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.RedisService)1 LocalService (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.LocalService)1 LocalGitService (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.git.LocalGitService)1 LocalGitServiceProvider (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.git.LocalGitServiceProvider)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Jedis (redis.clients.jedis.Jedis)1