public List<String> getAllApplicationNames(Release release) { List<String> appNames = new ArrayList<>(); List<? extends SpringCloudDeployerApplicationManifest> applicationSpecList = this.applicationManifestReader .read(release.getManifest().getData()); if (release.getPkg().getDependencies().size() == 0) { appNames.add(applicationSpecList.get(0).getApplicationName()); } else { for (SpringCloudDeployerApplicationManifest applicationManifestSpec : applicationSpecList) { appNames.add(applicationManifestSpec.getApplicationName()); } } return appNames; }
public List<String> getAllApplicationNames(Release release) { List<String> appNames = new ArrayList<>(); List<? extends SpringCloudDeployerApplicationManifest> applicationSpecList = this.applicationManifestReader .read(release.getManifest().getData()); if (release.getPkg().getDependencies().size() == 0) { appNames.add(applicationSpecList.get(0).getApplicationName()); } else { for (SpringCloudDeployerApplicationManifest applicationManifestSpec : applicationSpecList) { appNames.add(applicationManifestSpec.getApplicationName()); } } return appNames; }
@Override public StreamDeployment getStreamInfo(String streamName) { try { String manifest = this.manifest(streamName); List<SpringCloudDeployerApplicationManifest> appManifests = new SpringCloudDeployerApplicationManifestReader().read(manifest); Map<String, Map<String, String>> streamPropertiesMap = new HashMap<>(); for (SpringCloudDeployerApplicationManifest applicationManifest : appManifests) { Map<String, String> versionAndDeploymentProperties = new HashMap<>(); SpringCloudDeployerApplicationSpec spec = applicationManifest.getSpec(); String applicationName = applicationManifest.getApplicationName(); versionAndDeploymentProperties.putAll(spec.getDeploymentProperties()); versionAndDeploymentProperties.put(SkipperStream.SKIPPER_SPEC_RESOURCE, spec.getResource()); versionAndDeploymentProperties.put(SkipperStream.SKIPPER_SPEC_VERSION, spec.getVersion()); streamPropertiesMap.put(applicationName, versionAndDeploymentProperties); } return new StreamDeployment(streamName, new JSONObject(streamPropertiesMap).toString()); } catch (ReleaseNotFoundException e) { return new StreamDeployment(streamName); } }
@Override public StreamDeployment getStreamInfo(String streamName) { try { String manifest = this.manifest(streamName); List<SpringCloudDeployerApplicationManifest> appManifests = new SpringCloudDeployerApplicationManifestReader().read(manifest); Map<String, Map<String, String>> streamPropertiesMap = new HashMap<>(); for (SpringCloudDeployerApplicationManifest applicationManifest : appManifests) { Map<String, String> versionAndDeploymentProperties = new HashMap<>(); SpringCloudDeployerApplicationSpec spec = applicationManifest.getSpec(); String applicationName = applicationManifest.getApplicationName(); versionAndDeploymentProperties.putAll(spec.getDeploymentProperties()); versionAndDeploymentProperties.put(SkipperStream.SKIPPER_SPEC_RESOURCE, spec.getResource()); versionAndDeploymentProperties.put(SkipperStream.SKIPPER_SPEC_VERSION, spec.getVersion()); streamPropertiesMap.put(applicationName, versionAndDeploymentProperties); } return new StreamDeployment(streamName, new JSONObject(streamPropertiesMap).toString()); } catch (ReleaseNotFoundException e) { return new StreamDeployment(streamName); } }
private Map<String, String> deploy(Release replacingRelease, List<String> applicationNamesToUpgrade, AppDeployer appDeployer) { List<? extends SpringCloudDeployerApplicationManifest> applicationSpecList = this.applicationManifestReader .read(replacingRelease .getManifest().getData()); Map<String, String> appNameDeploymentIdMap = new HashMap<>(); for (SpringCloudDeployerApplicationManifest applicationManifest : applicationSpecList) { if (applicationNamesToUpgrade.contains(applicationManifest.getApplicationName())) { AppDeploymentRequest appDeploymentRequest = appDeploymentRequestFactory.createAppDeploymentRequest( applicationManifest, replacingRelease.getName(), String.valueOf(replacingRelease.getVersion())); // ============= // DEPLOY DEPLOY // ============= String deploymentId = appDeployer.deploy(appDeploymentRequest); appNameDeploymentIdMap.put(applicationManifest.getApplicationName(), deploymentId); } } return appNameDeploymentIdMap; } }
private Map<String, String> deploy(Release replacingRelease, List<String> applicationNamesToUpgrade, AppDeployer appDeployer) { List<? extends SpringCloudDeployerApplicationManifest> applicationSpecList = this.applicationManifestReader .read(replacingRelease .getManifest().getData()); Map<String, String> appNameDeploymentIdMap = new HashMap<>(); for (SpringCloudDeployerApplicationManifest applicationManifest : applicationSpecList) { if (applicationNamesToUpgrade.contains(applicationManifest.getApplicationName())) { AppDeploymentRequest appDeploymentRequest = appDeploymentRequestFactory.createAppDeploymentRequest( applicationManifest, replacingRelease.getName(), String.valueOf(replacingRelease.getVersion())); // ============= // DEPLOY DEPLOY // ============= String deploymentId = appDeployer.deploy(appDeploymentRequest); appNameDeploymentIdMap.put(applicationManifest.getApplicationName(), deploymentId); } } return appNameDeploymentIdMap; } }
private void updateStreamDefinitionFromReleaseManifest(String streamName, String releaseManifest) { List<SpringCloudDeployerApplicationManifest> appManifests = new SpringCloudDeployerApplicationManifestReader() .read(releaseManifest); Map<String, SpringCloudDeployerApplicationManifest> appManifestMap = new HashMap<>(); for (SpringCloudDeployerApplicationManifest am : appManifests) { String name = am.getSpec().getApplicationProperties().get(DataFlowPropertyKeys.STREAM_APP_LABEL); appManifestMap.put(name, am); } StreamDefinition streamDefinition = this.streamDefinitionRepository.findById(streamName) .orElseThrow(() -> new NoSuchStreamDefinitionException(streamName)); LinkedList<StreamAppDefinition> updatedStreamAppDefinitions = new LinkedList<>(); for (StreamAppDefinition appDefinition : streamDefinition.getAppDefinitions()) { StreamAppDefinition.Builder appDefinitionBuilder = StreamAppDefinition.Builder.from(appDefinition); SpringCloudDeployerApplicationManifest applicationManifest = appManifestMap.get(appDefinition.getName()); // overrides app definition properties with those from the release manifest appDefinitionBuilder.setProperties(applicationManifest.getSpec().getApplicationProperties()); updatedStreamAppDefinitions.addLast(appDefinitionBuilder.build(streamDefinition.getName())); } String dslText = new StreamDefinitionToDslConverter().toDsl(updatedStreamAppDefinitions); StreamDefinition updatedStreamDefinition = new StreamDefinition(streamName, dslText); logger.debug("Updated StreamDefinition: " + updatedStreamDefinition); // TODO consider adding an explicit UPDATE method to the streamDefRepository // Note: Not transactional and can lead to loosing the stream definition this.streamDefinitionRepository.delete(updatedStreamDefinition); this.streamDefinitionRepository.save(updatedStreamDefinition); this.auditRecordService.populateAndSaveAuditRecord( AuditOperationType.STREAM, AuditActionType.UPDATE, streamName, this.auditServiceUtils.convertStreamDefinitionToAuditData(streamDefinition)); }
.read(existingRelease.getManifest().getData()); List<? extends SpringCloudDeployerApplicationManifest> replacingApplicationSpecList = this.applicationManifestReader .read(replacingRelease.getManifest().getData()); if (existingRelease.getPkg().getDependencies().size() == replacingRelease.getPkg().getDependencies() .size()) {
.read(existingRelease.getManifest().getData()); List<? extends SpringCloudDeployerApplicationManifest> replacingApplicationSpecList = this.applicationManifestReader .read(replacingRelease.getManifest().getData()); if (existingRelease.getPkg().getDependencies().size() == replacingRelease.getPkg().getDependencies() .size()) {
private void updateStreamDefinitionFromReleaseManifest(String streamName, String releaseManifest) { List<SpringCloudDeployerApplicationManifest> appManifests = new SpringCloudDeployerApplicationManifestReader() .read(releaseManifest); Map<String, SpringCloudDeployerApplicationManifest> appManifestMap = new HashMap<>(); for (SpringCloudDeployerApplicationManifest am : appManifests) { String name = am.getSpec().getApplicationProperties().get(DataFlowPropertyKeys.STREAM_APP_LABEL); appManifestMap.put(name, am); } StreamDefinition streamDefinition = this.streamDefinitionRepository.findOne(streamName); LinkedList<StreamAppDefinition> updatedStreamAppDefinitions = new LinkedList<>(); for (StreamAppDefinition appDefinition : streamDefinition.getAppDefinitions()) { StreamAppDefinition.Builder appDefinitionBuilder = StreamAppDefinition.Builder.from(appDefinition); SpringCloudDeployerApplicationManifest applicationManifest = appManifestMap.get(appDefinition.getName()); // overrides app definition properties with those from the release manifest appDefinitionBuilder.setProperties(applicationManifest.getSpec().getApplicationProperties()); updatedStreamAppDefinitions.addLast(appDefinitionBuilder.build(streamDefinition.getName())); } String dslText = new StreamDefinitionToDslConverter().toDsl(updatedStreamAppDefinitions); StreamDefinition updatedStreamDefinition = new StreamDefinition(streamName, dslText); logger.debug("Updated StreamDefinition: " + updatedStreamDefinition); // TODO consider adding an explicit UPDATE method to the streamDefRepository // Note: Not transactional and can lead to loosing the stream definition this.streamDefinitionRepository.delete(updatedStreamDefinition); this.streamDefinitionRepository.save(updatedStreamDefinition); this.auditRecordService.populateAndSaveAuditRecord( AuditOperationType.STREAM, AuditActionType.UPDATE, streamName, this.auditServiceUtils.convertStreamDefinitionToAuditData(streamDefinition)); }
.read(release.getManifest().getData()); AppDeployer appDeployer = this.deployerRepository.findByNameRequired(release.getPlatformName()) .getAppDeployer();
.read(release.getManifest().getData()); AppDeployer appDeployer = this.deployerRepository.findByNameRequired(release.getPlatformName()) .getAppDeployer();