Skip to content

Commit

Permalink
feat(pipeline_template): Add marker support to disable rendered value…
Browse files Browse the repository at this point in the history
… expansion
  • Loading branch information
robzienert committed Oct 4, 2017
1 parent 788b3c4 commit aaaedf6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public Object convertRenderedValue(String renderedValue) {
if (containsEL(renderedValue) || isYamlKeyword(renderedValue)) {
return renderedValue;
}
if (containsNoExpandMarker(renderedValue)) {
return trimNoExpandMarker(renderedValue);
}

try {
Object converted = yaml.load(renderedValue);
Expand All @@ -67,4 +70,12 @@ private static boolean containsEL(String renderedValue) {
private static boolean isYamlKeyword(String renderedValue) {
return YAML_KEYWORDS.contains(renderedValue.toLowerCase());
}

private static boolean containsNoExpandMarker(String renderedValue) {
return renderedValue.startsWith("noexpand:");
}

private static String trimNoExpandMarker(String renderedValue) {
return renderedValue.substring("noexpand:".length(), renderedValue.length());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ class JinjaRendererSpec extends Specification {
'${ #stage("First Wait")["status"].toString() == "SUCCESS" }' || String | '${ #stage("First Wait")["status"].toString() == "SUCCESS" }'
'${ parameters.CONFIG_FOLDER ?: \'\' }' || String | '${ parameters.CONFIG_FOLDER ?: \'\' }'
'' || String | null
'noexpand:{"t": "deployment"}' || String | '{"t": "deployment"}'
}


Expand Down

0 comments on commit aaaedf6

Please sign in to comment.