feat: PlaceholderResolver for dynamic placeholder resolution#1188
Draft
matheusandre1 wants to merge 1 commit into
Draft
feat: PlaceholderResolver for dynamic placeholder resolution#1188matheusandre1 wants to merge 1 commit into
matheusandre1 wants to merge 1 commit into
Conversation
Reviewer's GuideIntroduces a reusable PlaceholderResolver utility and wires version placeholder resolution for service catalog dependency files across CLI packaging/deploy flows, backend deployment, and service templates, including support for an optional catalog.versions file in ServiceCatalogIndex and associated tests and templates. Sequence diagram for resolving catalog dependency placeholders during backend deploysequenceDiagram
participant Client
participant ServiceCatalogBean
participant ServiceCatalogIndex
Client->>ServiceCatalogBean: deploy(DataStore)
ServiceCatalogBean->>ServiceCatalogIndex: fromBase64(dataStore.data)
ServiceCatalogIndex-->>ServiceCatalogBean: index
ServiceCatalogBean->>ServiceCatalogIndex: hasVersionsFile()
alt versions file present
ServiceCatalogBean->>ServiceCatalogBean: Base64.getDecoder().decode(dataStore.data)
ServiceCatalogBean->>ServiceCatalogIndex: resolvePlaceholders(zipBytes)
ServiceCatalogIndex-->>ServiceCatalogBean: resolvedZip
ServiceCatalogBean->>ServiceCatalogBean: Base64.getEncoder().encodeToString(resolvedZip)
ServiceCatalogBean->>ServiceCatalogBean: dataStore.setData(encodedZip)
else no versions file
ServiceCatalogBean-->>Client: deploy continues without placeholder resolution
end
Sequence diagram for ServiceCatalogIndex ZIP placeholder resolutionsequenceDiagram
participant ServiceCatalogIndex
participant ZipInputStream
participant PlaceholderResolver
participant ZipOutputStream
ServiceCatalogIndex->>ZipInputStream: new ZipInputStream(ByteArrayInputStream(zipBytes))
loop for each ZipEntry
ZipInputStream-->>ServiceCatalogIndex: readAllBytes()
ServiceCatalogIndex->>ServiceCatalogIndex: entries.put(name, bytes)
end
ServiceCatalogIndex->>ServiceCatalogIndex: versionsBytes = entries.get(versionsPath)
alt versionsBytes present
ServiceCatalogIndex->>PlaceholderResolver: loadBindings(String(versionsBytes))
PlaceholderResolver-->>ServiceCatalogIndex: bindings
else no versionsBytes
ServiceCatalogIndex-->>ServiceCatalogIndex: bindings is null
end
alt bindings empty or null
ServiceCatalogIndex-->>ServiceCatalogIndex: return original zipBytes
else bindings available
loop for each system in serviceNames
ServiceCatalogIndex->>ServiceCatalogIndex: depsPath = getDependenciesFile(system)
alt depsPath entry exists
ServiceCatalogIndex->>PlaceholderResolver: resolve(content, bindings)
PlaceholderResolver-->>ServiceCatalogIndex: resolved
ServiceCatalogIndex->>ServiceCatalogIndex: entries.put(depsPath, resolvedBytes)
end
end
ServiceCatalogIndex->>ZipOutputStream: new ZipOutputStream(ByteArrayOutputStream())
loop for each entry
ZipOutputStream-->>ZipOutputStream: putNextEntry(name)
ZipOutputStream-->>ZipOutputStream: write(bytes)
end
ZipOutputStream-->>ServiceCatalogIndex: baos.toByteArray()
ServiceCatalogIndex-->>ServiceCatalogIndex: return resolvedZip
end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Signed-off-by: Matheus André <matheusandr2@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes: #1143
Summary by Sourcery
Introduce version placeholder resolution for service catalog dependency files via a shared versions properties file and integrate it across CLI commands, backend deployment, and templates.
New Features:
Enhancements:
Tests: