use of com.netflix.spinnaker.halyard.core.RemoteAction in project halyard by spinnaker.
the class DeployService method connectCommand.
public RemoteAction connectCommand(String deploymentName, List<String> serviceNames) {
DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName);
SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration);
SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration);
Deployer deployer = getDeployer(deploymentConfiguration);
DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration);
List<SpinnakerService.Type> serviceTypes = serviceNames.stream().map(SpinnakerService.Type::fromCanonicalName).collect(Collectors.toList());
if (serviceTypes.isEmpty()) {
serviceTypes.add(SpinnakerService.Type.DECK);
serviceTypes.add(SpinnakerService.Type.GATE);
}
RemoteAction result = deployer.connectCommand(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes);
result.setAutoRun(true);
result.commitScript(halconfigDirectoryStructure.getConnectScriptPath(deploymentName));
return result;
}
use of com.netflix.spinnaker.halyard.core.RemoteAction in project halyard by spinnaker.
the class DeployService method prep.
public RemoteAction prep(String deploymentName, List<String> serviceNames) {
DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName);
DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration);
Deployer deployer = getDeployer(deploymentConfiguration);
SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration);
SpinnakerRuntimeSettings runtimeSettings = serviceProvider.buildRuntimeSettings(deploymentConfiguration);
List<SpinnakerService.Type> serviceTypes = serviceNames.stream().map(SpinnakerService.Type::fromCanonicalName).collect(Collectors.toList());
if (serviceTypes.isEmpty()) {
serviceTypes = serviceProvider.getServices().stream().map(SpinnakerService::getType).collect(Collectors.toList());
}
RemoteAction action = deployer.prep(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes);
if (!action.getScript().isEmpty()) {
action.commitScript(halconfigDirectoryStructure.getPrepScriptPath(deploymentName));
}
return action;
}
use of com.netflix.spinnaker.halyard.core.RemoteAction in project halyard by spinnaker.
the class DeployService method clean.
public void clean(String deploymentName) {
DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName);
SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration);
DeploymentDetails deploymentDetails = getDeploymentDetails(deploymentConfiguration);
RemoteAction action = serviceProvider.clean(deploymentDetails, serviceProvider.buildRuntimeSettings(deploymentConfiguration));
action.commitScript(halconfigDirectoryStructure.getUnInstallScriptPath(deploymentName));
}
use of com.netflix.spinnaker.halyard.core.RemoteAction in project halyard by spinnaker.
the class KubectlDeployer method deploy.
@Override
public RemoteAction deploy(KubectlServiceProvider serviceProvider, AccountDeploymentDetails<KubernetesAccount> deploymentDetails, GenerateService.ResolvedConfiguration resolvedConfiguration, List<SpinnakerService.Type> serviceTypes) {
List<KubernetesV2Service> services = serviceProvider.getServicesByPriority(serviceTypes);
services.stream().forEach((service) -> {
ServiceSettings settings = resolvedConfiguration.getServiceSettings((SpinnakerService) service);
if (settings.getEnabled() != null && !settings.getEnabled()) {
return;
}
if (settings.getSkipLifeCycleManagement() != null && settings.getSkipLifeCycleManagement()) {
return;
}
DaemonTaskHandler.newStage("Deploying " + service.getServiceName() + " with kubectl");
KubernetesAccount account = deploymentDetails.getAccount();
String namespaceDefinition = service.getNamespaceYaml(resolvedConfiguration);
String serviceDefinition = service.getServiceYaml(resolvedConfiguration);
if (!KubernetesV2Utils.exists(account, namespaceDefinition)) {
KubernetesV2Utils.apply(account, namespaceDefinition);
}
if (!KubernetesV2Utils.exists(account, serviceDefinition)) {
KubernetesV2Utils.apply(account, serviceDefinition);
}
String resourceDefinition = service.getResourceYaml(deploymentDetails, resolvedConfiguration);
DaemonTaskHandler.message("Running kubectl apply on the resource definition...");
KubernetesV2Utils.apply(account, resourceDefinition);
});
return new RemoteAction();
}
use of com.netflix.spinnaker.halyard.core.RemoteAction 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;
}
Aggregations