Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pipeline_template): Add marker support to disable rendered value expansion #1665

Merged
merged 3 commits into from
Oct 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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