Skip to content

Commit

Permalink
Simplify processing of deployment files
Browse files Browse the repository at this point in the history
  • Loading branch information
trisberg committed Jan 24, 2025
1 parent 2c42b65 commit 6cce5c6
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions node-express/accelerator.axl
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,25 @@ engine {
TextPreprocessor()
}

if (#deploymentType == 'none') {
select(!"deploy/**")
} else {
if (#deploymentType == 'tpfork8s') {
let uuid = T(java.util.UUID).randomUUID() in {
applyTo("deploy/tpfork8s/tanzu.yml") {
ReplaceSnippet(text: "node-express", with: #artifactId.toLowerCase())
OpenRewriteRecipe('org.openrewrite.yaml.ChangeValue', { oldKeyPath: "$.configuration.id", value: 'config-' + #uuid.toString() })
RewritePath(rewriteTo: #filename)
}
// Add deployment artifacts
if (#deploymentType == 'tpfork8s') {
let uuid = T(java.util.UUID).randomUUID() in {
applyTo("deploy/tpfork8s/tanzu.yml") {
ReplaceSnippet(text: "node-express", with: #artifactId.toLowerCase())
OpenRewriteRecipe('org.openrewrite.yaml.ChangeValue', { oldKeyPath: "$.configuration.id", value: 'config-' + #uuid.toString() })
RewritePath(rewriteTo: #filename)
}
applyTo("deploy/tpfork8s/.tanzu/config/node-express.yml") {
ReplaceText({{text: "node-express", with: #artifactId.toLowerCase()}})
RewritePath(rewriteTo: '.tanzu/config/' + #artifactId.toLowerCase() + '.yml')
}
applyTo("deploy/tpfork8s/.tanzu/config/httproute-node-express.yml") {
ReplaceText({{text: "node-express", with: #artifactId.toLowerCase()}})
RewritePath(rewriteTo: '.tanzu/config/httproute-' + #artifactId.toLowerCase() + '.yml')
}
select(!"deploy/**")
}
applyTo("deploy/tpfork8s/.tanzu/config/node-express.yml") {
ReplaceText({{text: "node-express", with: #artifactId.toLowerCase()}})
RewritePath(rewriteTo: '.tanzu/config/' + #artifactId.toLowerCase() + '.yml')
}
applyTo("deploy/tpfork8s/.tanzu/config/httproute-node-express.yml") {
ReplaceText({{text: "node-express", with: #artifactId.toLowerCase()}})
RewritePath(rewriteTo: '.tanzu/config/httproute-' + #artifactId.toLowerCase() + '.yml')
}
}
select(!"deploy/**")

// Update the artifact name as needed
applyTo("README.md" || "package.json") {
Expand Down

0 comments on commit 6cce5c6

Please sign in to comment.