Skip to content

Commit

Permalink
fix(pipeline_template): Do not treat markdown lists as YAML alias (#1645
Browse files Browse the repository at this point in the history
)
  • Loading branch information
robzienert authored Oct 13, 2017
1 parent 2f20277 commit 0085587
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public YamlRenderedValueConverter(Yaml yaml) {

@Override
public Object convertRenderedValue(String renderedValue) {
if (containsEL(renderedValue) || isYamlKeyword(renderedValue)) {
if (containsEL(renderedValue) || isYamlKeyword(renderedValue) || containsYamlParsingExceptions(renderedValue)) {
return renderedValue;
}
if (containsNoExpandMarker(renderedValue)) {
Expand Down Expand Up @@ -71,6 +71,11 @@ private static boolean isYamlKeyword(String renderedValue) {
return YAML_KEYWORDS.contains(renderedValue.toLowerCase());
}

private static boolean containsYamlParsingExceptions(String renderedValue) {
return renderedValue != null &&
renderedValue.startsWith("* "); // A markdown list: YAML will parse this as an alias and fail.
}

private static boolean containsNoExpandMarker(String renderedValue) {
return renderedValue.startsWith("noexpand:");
}
Expand Down
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
'* markdown list' || String | '* markdown list'
'noexpand:{"t": "deployment"}' || String | '{"t": "deployment"}'
}

Expand Down

0 comments on commit 0085587

Please sign in to comment.