public RemoteAction prep(String deploymentName, List<String> serviceNames, List<String> excludeServiceNames) { 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()); } if (!excludeServiceNames.isEmpty()) { serviceTypes = serviceTypes .stream() .filter(serviceType -> !excludeServiceNames.contains(serviceType.getCanonicalName())) .collect(Collectors.toList()); } RemoteAction action = deployer.prep(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes); if (!action.getScript().isEmpty()) { action.commitScript(halconfigDirectoryStructure.getPrepScriptPath(deploymentName)); } return action; }
public RemoteAction prep(String deploymentName, List<String> serviceNames, List<String> excludeServiceNames) { 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()); } if (!excludeServiceNames.isEmpty()) { serviceTypes = serviceTypes .stream() .filter(serviceType -> !excludeServiceNames.contains(serviceType.getCanonicalName())) .collect(Collectors.toList()); } RemoteAction action = deployer.prep(serviceProvider, deploymentDetails, runtimeSettings, serviceTypes); if (!action.getScript().isEmpty()) { action.commitScript(halconfigDirectoryStructure.getPrepScriptPath(deploymentName)); } return action; }
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; }
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; }
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")); }
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")); }
@Override public 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/deck-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")); } }
action.commitScript(halconfigDirectoryStructure.getInstallScriptPath(deploymentName));
@Override public 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/deck-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")); }
action.commitScript(halconfigDirectoryStructure.getInstallScriptPath(deploymentName));
public RemoteAction install() { RemoteAction result = new RemoteAction(); String script = "#!/bin/bash\n" + "curl -LO https://storage.googleapis.com/spinnaker-artifacts/spin/$(curl -s https://storage.googleapis.com/spinnaker-artifacts/spin/latest)/linux/amd64/spin\n" + "chmod +x spin\n" + "sudo mv spin /usr/local/bin/spin"; result.setScript(script); result.setScriptDescription("The generated script will install the latest version of spin CLI"); result.setAutoRun(true); result.commitScript(halconfigDirectoryStructure.getSpinInstallScriptPath()); return result; } }
public RemoteAction install() { RemoteAction result = new RemoteAction(); String script = "#!/bin/bash\n" + "curl -LO https://storage.googleapis.com/spinnaker-artifacts/spin/$(curl -s https://storage.googleapis.com/spinnaker-artifacts/spin/latest)/linux/amd64/spin\n" + "chmod +x spin\n" + "sudo mv spin /usr/local/bin/spin"; result.setScript(script); result.setScriptDescription("The generated script will install the latest version of spin CLI"); result.setAutoRun(true); result.commitScript(halconfigDirectoryStructure.getSpinInstallScriptPath()); return result; } }
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)); }
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)); }