private static List<String> aggregateProfilesInPath(String basePath, String relativePath) { String filePrefix; if (!relativePath.isEmpty()) { filePrefix = relativePath + File.separator; } else { filePrefix = relativePath; } File currentPath = new File(basePath, relativePath); return Arrays.stream(currentPath.listFiles()) .map(f -> f.isFile() ? Collections.singletonList(filePrefix + f.getName()) : aggregateProfilesInPath(basePath, filePrefix + f.getName())) .reduce(new ArrayList<>(), (a, b) -> { a.addAll(b); return a; }); }
public ResolvedConfiguration generateConfigWithOptionalServices(String deploymentName, List<SpinnakerService.Type> serviceTypes) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); if (serviceTypes.isEmpty()) { serviceTypes = serviceProvider .getServices() .stream() .map(SpinnakerService::getType) .collect(Collectors.toList()); } return generateConfig(deploymentName, serviceTypes); }
List<String> userProfileNames = aggregateProfilesInPath(userProfilePath.toString(), ""); Map<String, Profile> outputProfiles = processProfiles(spinnakerStaging, profiles); profileMessage += " and discovered " + customProfiles.size() + " custom profile" + pluralModifier + " for " + service.getCanonicalName(); DaemonTaskHandler.message(profileMessage); mergeProfilesAndPreserveProperties(outputProfiles, processProfiles(spinnakerStaging, customProfiles));
@RequestMapping(value = "/{deploymentName:.+}/generate/", method = RequestMethod.POST) DaemonTask<Halconfig, String> generateConfig(@PathVariable String deploymentName, @ModelAttribute ValidationSettings validationSettings, @RequestParam(required = false) List<String> serviceNames) { List<String> finalServiceNames = serviceNames != null ? serviceNames : Collections.emptyList(); Supplier<String> buildResponse = () -> { GenerateService.ResolvedConfiguration configuration = generateService.generateConfigWithOptionalServices(deploymentName, finalServiceNames.stream() .map(SpinnakerService.Type::fromCanonicalName) .collect(Collectors.toList())); return configuration.getStagingDirectory(); }; StaticRequestBuilder<String> builder = new StaticRequestBuilder<>(buildResponse); builder.setSeverity(validationSettings.getSeverity()); if (validationSettings.isValidate()) { builder.setValidateResponse(() -> deploymentService.validateDeployment(deploymentName)); } return DaemonTaskHandler.submitTask(builder::build, "Generate config"); }
List<String> userProfileNames = aggregateProfilesInPath(userProfilePath.toString(), ""); Map<String, Profile> outputProfiles = processProfiles(spinnakerStaging, profiles); profileMessage += " and discovered " + customProfiles.size() + " custom profile" + pluralModifier + " for " + service.getCanonicalName(); DaemonTaskHandler.message(profileMessage); mergeProfilesAndPreserveProperties(outputProfiles, processProfiles(spinnakerStaging, customProfiles));
public ResolvedConfiguration generateConfigWithOptionalServices(String deploymentName, List<SpinnakerService.Type> serviceTypes) { DeploymentConfiguration deploymentConfiguration = deploymentService.getDeploymentConfiguration(deploymentName); SpinnakerServiceProvider<DeploymentDetails> serviceProvider = serviceProviderFactory.create(deploymentConfiguration); if (serviceTypes.isEmpty()) { serviceTypes = serviceProvider .getServices() .stream() .map(SpinnakerService::getType) .collect(Collectors.toList()); } return generateConfig(deploymentName, serviceTypes); }
private static List<String> aggregateProfilesInPath(String basePath, String relativePath) { String filePrefix; if (!relativePath.isEmpty()) { filePrefix = relativePath + File.separator; } else { filePrefix = relativePath; } File currentPath = new File(basePath, relativePath); return Arrays.stream(currentPath.listFiles()) .map(f -> f.isFile() ? Collections.singletonList(filePrefix + f.getName()) : aggregateProfilesInPath(basePath, filePrefix + f.getName())) .reduce(new ArrayList<>(), (a, b) -> { a.addAll(b); return a; }); }
resolvedConfiguration = generateService.generateConfig(deploymentName, Collections.emptyList()); } else { resolvedConfiguration = generateService.generateConfig(deploymentName, serviceTypes);
resolvedConfiguration = generateService.generateConfig(deploymentName, Collections.emptyList()); } else { resolvedConfiguration = generateService.generateConfig(deploymentName, serviceTypes);