From 5ef726cef96fa1ffdebc2897787ae2af47f3a349 Mon Sep 17 00:00:00 2001 From: przemkalit Date: Wed, 8 Jan 2025 11:14:24 +0100 Subject: [PATCH] Fix extra vars issue (#54) * fix_missing_extra_vars * fix: missing change --------- Co-authored-by: Przemyslaw Kalitowski --- changelogs/fragments/filetree_create_missing_extra_vars.yml | 4 ++++ roles/filetree_create/templates/controller_job_templates.j2 | 4 +++- .../templates/controller_workflow_job_templates.j2 | 4 +++- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/filetree_create_missing_extra_vars.yml diff --git a/changelogs/fragments/filetree_create_missing_extra_vars.yml b/changelogs/fragments/filetree_create_missing_extra_vars.yml new file mode 100644 index 00000000..d0f5a6ae --- /dev/null +++ b/changelogs/fragments/filetree_create_missing_extra_vars.yml @@ -0,0 +1,4 @@ +--- +bugfixes: + - filetree_create is able to export empty extra vars of JT and WF +... diff --git a/roles/filetree_create/templates/controller_job_templates.j2 b/roles/filetree_create/templates/controller_job_templates.j2 index 396d2c7f..94409305 100644 --- a/roles/filetree_create/templates/controller_job_templates.j2 +++ b/roles/filetree_create/templates/controller_job_templates.j2 @@ -140,7 +140,9 @@ controller_templates: {{ extra_vars_item.key }}: {{ (extra_vars_item.value | regex_replace("\n", "\\\\n") | regex_replace('"', '\\"')) | regex_replace('(^[^{]*){([{%])(.*)', '!unsafe "\\g<1>{\\g<2>\\g<3>"', multiline=True) }} {% endif %} {% endfor %} -{%- endif %} +{% else %} + extra_vars: "" +{% endif %} job_tags: "{{ template_overrides_resources.job_template[current_job_templates_asset_value.name].job_tags | default(template_overrides_global.job_template.job_tags) | default(current_job_templates_asset_value.job_tags) }}" diff --git a/roles/filetree_create/templates/controller_workflow_job_templates.j2 b/roles/filetree_create/templates/controller_workflow_job_templates.j2 index e3c4e89a..aefcd85e 100644 --- a/roles/filetree_create/templates/controller_workflow_job_templates.j2 +++ b/roles/filetree_create/templates/controller_workflow_job_templates.j2 @@ -113,7 +113,9 @@ controller_workflows: {{ extra_vars_item.key }}: {{ (extra_vars_item.value | regex_replace("\n", "\\\\n") | regex_replace('"', '\\"')) | regex_replace('(^[^{]*){([{%])(.*)', '!unsafe "\\g<1>{\\g<2>\\g<3>"', multiline=True) }} {% endif %} {% endfor %} -{%- endif %} +{% else %} + extra_vars: "" +{% endif %} {% if query_labels | length > 0 %} labels: {% for label in query_labels %}