Search in sources :

Example 11 with RemoteAction

use of com.netflix.spinnaker.halyard.core.RemoteAction in project halyard by spinnaker.

the class LocalGitService method commitWrapperScripts.

default void commitWrapperScripts() {
    Map<String, Object> bindings = new HashMap<>();
    bindings.put("git-root", getGitRoot());
    bindings.put("scripts-dir", getScriptsDir());
    bindings.put("artifact", getArtifact().getName());
    bindings.put("start-command", getStartCommand());
    TemplatedResource scriptResource = new StringReplaceJarResource("/git/start.sh");
    scriptResource.setBindings(bindings);
    String script = scriptResource.toString();
    new RemoteAction().setScript(script).commitScript(Paths.get(getScriptsDir(), getArtifact().getName() + "-start.sh"));
    scriptResource = new StringReplaceJarResource("/git/stop.sh");
    scriptResource.setBindings(bindings);
    script = scriptResource.toString();
    new RemoteAction().setScript(script).commitScript(Paths.get(getScriptsDir(), getArtifact().getName() + "-stop.sh"));
}
Also used : StringReplaceJarResource(com.netflix.spinnaker.halyard.core.resource.v1.StringReplaceJarResource) HashMap(java.util.HashMap) TemplatedResource(com.netflix.spinnaker.halyard.core.resource.v1.TemplatedResource) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction)

Example 12 with RemoteAction

use of com.netflix.spinnaker.halyard.core.RemoteAction 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)

Example 13 with RemoteAction

use of com.netflix.spinnaker.halyard.core.RemoteAction in project halyard by spinnaker.

the class KubernetesV1DistributedServiceProvider method clean.

@Override
public RemoteAction clean(AccountDeploymentDetails<KubernetesAccount> details, SpinnakerRuntimeSettings runtimeSettings) {
    KubernetesSharedServiceSettings kubernetesSharedServiceSettings = new KubernetesSharedServiceSettings(details.getDeploymentConfiguration());
    KubernetesV1ProviderUtils.kubectlDeleteNamespaceCommand(DaemonTaskHandler.getJobExecutor(), details, kubernetesSharedServiceSettings.getDeployLocation());
    return new RemoteAction();
}
Also used : KubernetesSharedServiceSettings(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.distributed.kubernetes.KubernetesSharedServiceSettings) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction)

Example 14 with RemoteAction

use of com.netflix.spinnaker.halyard.core.RemoteAction in project halyard by spinnaker.

the class LocalDebianServiceProvider method clean.

@Override
public RemoteAction clean(DeploymentDetails details, SpinnakerRuntimeSettings runtimeSettings) {
    String uninstallArtifacts = String.join("\n", getServices().stream().filter(s -> s != null && runtimeSettings.getServiceSettings(s).getEnabled()).map(s -> ((LocalDebianService) s).uninstallArtifactCommand()).collect(Collectors.toList()));
    Map<String, Object> bindings = new HashMap<>();
    TemplatedResource resource = new StringReplaceJarResource("/debian/uninstall.sh");
    bindings.put("uninstall-artifacts", uninstallArtifacts);
    return new RemoteAction().setScript(resource.setBindings(bindings).toString()).setAutoRun(true).setScriptDescription("This script apt-get purges all spinnaker components & deletes their config");
}
Also used : DeploymentDetails(com.netflix.spinnaker.halyard.deploy.deployment.v1.DeploymentDetails) java.util(java.util) ArtifactSourcesConfig(com.netflix.spinnaker.halyard.config.config.v1.ArtifactSourcesConfig) Autowired(org.springframework.beans.factory.annotation.Autowired) ArtifactService(com.netflix.spinnaker.halyard.deploy.services.v1.ArtifactService) GenerateService(com.netflix.spinnaker.halyard.deploy.services.v1.GenerateService) SpinnakerRuntimeSettings(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings) Collectors(java.util.stream.Collectors) Component(org.springframework.stereotype.Component) LocalServiceProvider(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.LocalServiceProvider) StringReplaceJarResource(com.netflix.spinnaker.halyard.core.resource.v1.StringReplaceJarResource) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction) BillOfMaterials(com.netflix.spinnaker.halyard.core.registry.v1.BillOfMaterials) SpinnakerService(com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerService) Strings(io.fabric8.utils.Strings) TemplatedResource(com.netflix.spinnaker.halyard.core.resource.v1.TemplatedResource) StringReplaceJarResource(com.netflix.spinnaker.halyard.core.resource.v1.StringReplaceJarResource) TemplatedResource(com.netflix.spinnaker.halyard.core.resource.v1.TemplatedResource) RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction)

Example 15 with RemoteAction

use of com.netflix.spinnaker.halyard.core.RemoteAction in project halyard by spinnaker.

the class Deployer method prep.

default RemoteAction prep(S serviceProvider, D deploymentDetails, SpinnakerRuntimeSettings runtimeSettings, List<SpinnakerService.Type> serviceTypes) {
    RemoteAction result = new RemoteAction();
    result.setAutoRun(true);
    result.setScript("");
    return result;
}
Also used : RemoteAction(com.netflix.spinnaker.halyard.core.RemoteAction)

Aggregations

RemoteAction (com.netflix.spinnaker.halyard.core.RemoteAction)18 SpinnakerService (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.SpinnakerService)8 SpinnakerRuntimeSettings (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.SpinnakerRuntimeSettings)7 DeploymentDetails (com.netflix.spinnaker.halyard.deploy.deployment.v1.DeploymentDetails)5 DeploymentConfiguration (com.netflix.spinnaker.halyard.config.model.v1.node.DeploymentConfiguration)4 AccountDeploymentDetails (com.netflix.spinnaker.halyard.deploy.deployment.v1.AccountDeploymentDetails)4 HashMap (java.util.HashMap)4 Collectors (java.util.stream.Collectors)4 Component (org.springframework.stereotype.Component)4 HalException (com.netflix.spinnaker.halyard.core.error.v1.HalException)3 StringReplaceJarResource (com.netflix.spinnaker.halyard.core.resource.v1.StringReplaceJarResource)3 TemplatedResource (com.netflix.spinnaker.halyard.core.resource.v1.TemplatedResource)3 BakeDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.BakeDeployer)3 Deployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.Deployer)3 DistributedDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.DistributedDeployer)3 KubectlDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.KubectlDeployer)3 LocalDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.LocalDeployer)3 LocalGitDeployer (com.netflix.spinnaker.halyard.deploy.deployment.v1.LocalGitDeployer)3 GenerateService (com.netflix.spinnaker.halyard.deploy.services.v1.GenerateService)3 LocalServiceProvider (com.netflix.spinnaker.halyard.deploy.spinnaker.v1.service.local.LocalServiceProvider)3