Skip to content

Commit

Permalink
fix(MPTv1): Fix template expansion (#2918)
Browse files Browse the repository at this point in the history
With kork-bom, we have picked up a new version of jinjava (despite the force=true
directive to gradle which doesn't work in bom scenarios where first one wins)
Anyway, old jinjava would handle missing variables by evaluating the expression to false;
new jinjava throws.
When a stage has a `{when}` condition that uses a variable that was part of the stage config
that variable doesn't get added to the context until we process the stage the second time!
Add those variables to the context on the first time round to make template expansion happy
  • Loading branch information
marchello2000 committed May 16, 2019
1 parent 31e09d2 commit 99a42c4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
5 changes: 1 addition & 4 deletions orca-pipelinetemplate/orca-pipelinetemplate.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ dependencies {
implementation(project(":orca-front50"))
implementation(project(":orca-clouddriver"))

implementation("com.hubspot.jinjava:jinjava:2.2.3") {
force = true
}

implementation("com.hubspot.jinjava:jinjava")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("com.jayway.jsonpath:json-path:2.2.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ private void renderStage(StageDefinition stage, RenderContext context, String lo
.withCause("Received type " + rendered.getClass().toString())
.withLocation(context.getLocation()));
}
context.getVariables().putAll((Map<String, Object>) rendered);
stage.setConfig((Map<String, Object>) rendered);

stage.setName(
Expand Down

0 comments on commit 99a42c4

Please sign in to comment.