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"));
}
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;
}
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();
}
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");
}
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;
}
Aggregations