Skip to content

Commit ac382fa

Browse files
[polarion] Allow users pass custom-fields
Jump has --custom-fields argument that is set here in the polarion role. This commit allows users pass additional custom fields by introducing cifmw_polarion_jump_custom_fields variable.
1 parent 924f1e8 commit ac382fa

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

roles/polarion/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Role to setup jump tool and upload XML test results to Polarion.
1010
* `cifmw_polarion_testrun_id`: (String) A test run identification provided by Polarion test case or `create-new-test-run` if polarion should generate a random test run ID. A value other than `create-new-test-run` will force this role to upload all test results found in all directories under `cifmw_polarion_jump_repo_url` to one test run identified by the given ID. The default behavior of this role is to treat the directories in `cifmw_polarion_jump_repo_url` as separate test runs.
1111
* `cifmw_polarion_update_testcases`: (Boolean) A value of True/False to create missing testcases (which should normally _not_ be enabled).
1212
* `cifmw_polarion_jump_extra_vars`: (String) A list of extra_vars that are being passed to the jump script. Defaults to empty.
13+
* `cifmw_polarion_jump_custom_fields`: (Dict) Structure listing the fields for --custom-fields argument of jump tool.
1314
* `cifmw_polarion_use_stage`: (Bool) Flag for using the staging instance of Polarion. Default is False meaning the production instance gets updated. Don't forget to change for testing on stage instance.
1415

1516

roles/polarion/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
# All variables within this role should have a prefix of "cifmw_polarion"
2020

2121
cifmw_polarion_basedir: "{{ cifmw_basedir | default(ansible_user_dir ~ '/ci-framework-data') }}"
22+
cifmw_polarion_jump_custom_fields: {}
2223
cifmw_polarion_jump_repo_dir: "{{ cifmw_polarion_basedir }}/polarion-jump"
2324
cifmw_polarion_jump_result_dir: "{{ cifmw_polarion_basedir }}/tests/{{ cifmw_run_test_role | default('tempest') }}/"
2425
cifmw_polarion_jump_repo_branch: "master"

roles/polarion/tasks/main.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,18 @@
110110
register: merged_xml_files
111111

112112
- name: Update Test Runs
113+
vars:
114+
_opts:
115+
cijoburl: "{{ cifmw_zuul_url }}/{{ zuul.build }}"
116+
jobteststage: "{{ merged_xml_files.files[ loop_idx ].path | dirname | basename }}"
117+
_custom_fields: "{{ _opts | combine(cifmw_polarion_jump_custom_fields) }}"
118+
_custom_fields_string: >-
119+
{{
120+
_custom_fields.keys() |
121+
zip(_custom_fields.values()) |
122+
map('join', '=') |
123+
join(',')
124+
}}
113125
ansible.builtin.shell:
114126
chdir: "{{ cifmw_polarion_jump_repo_dir }}"
115127
cmd: >-
@@ -119,7 +131,7 @@
119131
--testrun-title={{ cifmw_polarion_testrun_title }}-{{ loop_idx }}
120132
--xml-file={{ item.path }}
121133
--update_testcases={{ cifmw_polarion_update_testcases | default(false) }}
122-
--custom-fields cijoburl={{ cifmw_zuul_url }}/{{ zuul.build }},jobteststage={{ merged_xml_files.files[ loop_idx ].path | dirname | basename }}
134+
--custom-fields {{ _custom_fields_string }}
123135
{{ cifmw_polarion_jump_extra_vars | default ('') }}
124136
loop: "{{ merged_xml_files.files }}"
125137
loop_control:

0 commit comments

Comments
 (0)