diff --git a/changelogs/fragments/filetree_create_brackets_extra_vars_issue.yml b/changelogs/fragments/filetree_create_brackets_extra_vars_issue.yml new file mode 100644 index 000000000..5219e915c --- /dev/null +++ b/changelogs/fragments/filetree_create_brackets_extra_vars_issue.yml @@ -0,0 +1,4 @@ +--- +bugfixes: + - filetree_create export extra_vars with escaping any variable brackets +... diff --git a/roles/filetree_create/templates/current_job_templates.j2 b/roles/filetree_create/templates/current_job_templates.j2 index 91e381849..319fdf573 100644 --- a/roles/filetree_create/templates/current_job_templates.j2 +++ b/roles/filetree_create/templates/current_job_templates.j2 @@ -50,7 +50,7 @@ controller_templates: {% endif %} {% if current_job_templates_asset_value.extra_vars and current_job_templates_asset_value.extra_vars | length > 3 %} extra_vars: - {{ current_job_templates_asset_value.extra_vars | from_yaml | to_nice_yaml(indent=2) | indent(width=6, first=False) | replace("'{{", "!unsafe \'{{") }} + {{ current_job_templates_asset_value.extra_vars | from_yaml | to_nice_yaml(indent=2) | indent(width=6, first=False) | regex_replace('(^[^:]*): (.*){{', '\1: !unsafe \2{{', multiline=True)}} {%- endif %} job_tags: "{{ current_job_templates_asset_value.job_tags }}" force_handlers: {{ current_job_templates_asset_value.force_handlers | bool | lower }} diff --git a/roles/filetree_create/templates/current_workflow_job_templates.j2 b/roles/filetree_create/templates/current_workflow_job_templates.j2 index 959e62d7d..552979b65 100644 --- a/roles/filetree_create/templates/current_workflow_job_templates.j2 +++ b/roles/filetree_create/templates/current_workflow_job_templates.j2 @@ -43,7 +43,7 @@ controller_workflows: webhook_service: "{{ current_workflow_job_templates_asset_value.webhook_service }}" {% if current_workflow_job_templates_asset_value.extra_vars and current_workflow_job_templates_asset_value.extra_vars | length > 3 %} extra_vars: - {{ current_workflow_job_templates_asset_value.extra_vars | from_yaml | to_nice_yaml(indent=2) | indent(width=6, first=False) | replace("'{{", "!unsafe \'{{") }} + {{ current_workflow_job_templates_asset_value.extra_vars | from_yaml | to_nice_yaml(indent=2) | indent(width=6, first=False) | regex_replace('(^[^:]*): (.*){{', '\1: !unsafe \2{{', multiline=True) }} {%- endif %} {% if query_labels | length > 0 %} labels: