Skip to content

Commit 344b0dd

Browse files
Fix/handling empty build steps (#224)
* Handle empty build_steps * linting * adding Changelog * linting --------- Co-authored-by: Imed <imaouide@redhat.com>
1 parent 4308034 commit 344b0dd

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
bugfixes:
3+
- Handle empty build steps in execution-environment.yaml generation
4+
...

roles/ee_builder/templates/execution-environment.yaml.j2

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,24 @@ additional_build_files:
2929
{% endif -%}
3030
{% endif -%}
3131

32-
{% if (__execution_environment_definition.build_steps is defined and __execution_environment_definition.build_steps|length ) or
32+
{% if (__execution_environment_definition.build_steps is defined and __execution_environment_definition.build_steps|length and __execution_environment_definition.build_steps.values() | select('truthy') | list | length > 0 ) or
3333
(ee_pull_collections_from_hub) %}
3434
additional_build_steps:
35-
{% if ee_pull_collections_from_hub and (__execution_environment_definition.build_steps is not defined or (__execution_environment_definition.build_steps is defined and 'prepend_galaxy' not in __execution_environment_definition.build_steps)) %}
35+
{% if ee_pull_collections_from_hub and
36+
(__execution_environment_definition.build_steps is not defined
37+
or ('prepend_galaxy' not in __execution_environment_definition.build_steps)
38+
or (__execution_environment_definition.build_steps.prepend_galaxy is not defined)
39+
or not __execution_environment_definition.build_steps.prepend_galaxy) %}
3640
prepend_galaxy:
3741
- ADD _build/configs/ansible.cfg /etc/ansible/ansible.cfg
3842
{% endif %}
3943
{% if __execution_environment_definition.build_steps is defined %}
4044
{% for key,value in __execution_environment_definition.build_steps.items() %}
45+
{% if value | list | length > 0 %}
4146
{{ key | indent(2, true) }}:
4247
{{ value | to_nice_yaml | indent(4, true) }}
43-
{%- if key == "prepend_galaxy" and ee_pull_collections_from_hub and 'prepend_galaxy' in __execution_environment_definition.build_steps %}
48+
{%- endif -%}
49+
{%- if key == "prepend_galaxy" and ee_pull_collections_from_hub and 'prepend_galaxy' in __execution_environment_definition.build_steps and value | length > 0 %}
4450
- ADD _build/configs/ansible.cfg /etc/ansible/ansible.cfg
4551
{% endif %}
4652
{% endfor %}

0 commit comments

Comments
 (0)