Skip to content

Commit

Permalink
fix: issue with variable brackets inside any string in extra_vars (#868)
Browse files Browse the repository at this point in the history
* fix: issue with variable brackets inside any string in extra_vars

* misc: implement suggested change

* Update current_job_templates.j2

Add `multiline=True` to treat multiple lines

* Update current_workflow_job_templates.j2

Add `multiline=True` to treat multiple lines

---------

Co-authored-by: Przemyslaw Kalitowski <[email protected]>
Co-authored-by: Ivan Aragonés Muniesa <[email protected]>
  • Loading branch information
3 people authored Jul 23, 2024
1 parent 6178d4b commit 9f659e6
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
bugfixes:
- filetree_create export extra_vars with escaping any variable brackets
...
2 changes: 1 addition & 1 deletion roles/filetree_create/templates/current_job_templates.j2
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,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 }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,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:
Expand Down

0 comments on commit 9f659e6

Please sign in to comment.