Skip to content

Commit 37cd7d9

Browse files
raukadahopenshift-merge-bot[bot]
authored andcommitted
[tcib]Use inner ansible vars to expose dlrn md5 hash
Currently we use to slurp the content of dlrn.md5 file via run playbook running from zuul executor. Most of the time, It does not exposes the correct dlrn md5 file hash. In order to fix that, We are moving log collection from zuul post run to tcib playbook to create the ansible var file and use the same to read the dlrn md5 hash file. Signed-off-by: Chandan Kumar <[email protected]>
1 parent 36bf5c2 commit 37cd7d9

File tree

3 files changed

+33
-39
lines changed

3 files changed

+33
-39
lines changed

Diff for: ci/playbooks/tcib/run.yml

+21-37
Original file line numberDiff line numberDiff line change
@@ -34,43 +34,27 @@
3434
{%- endif %}
3535
-e "@{{ ansible_user_dir }}/ci-framework-data/artifacts/parameters/zuul-params.yml"
3636
37-
- name: Slurp dlrn md5 hash
38-
become: true
37+
- name: Include inner ansible vars file
38+
ansible.builtin.slurp:
39+
src: "{{ cifmw_artifacts_basedir }}/artifacts/ansible-vars.yml"
40+
register: _inner_ansible
41+
42+
- name: Return Zuul related data
3943
vars:
40-
_repo_path: >-
41-
{%- if cifmw_repo_setup_output is defined %}
42-
{{ cifmw_repo_setup_output }}
43-
{%- else %}
44-
{{ ansible_user_dir }}/ci-framework-data/artifacts/repositories
45-
{%- endif %}
44+
_inner_ansible_vars: "{{ _inner_ansible.content | b64decode | from_yaml }}"
45+
_dlrn_md5: "{{ _inner_ansible_vars.cifmw_repo_setup_full_hash }}"
4646
block:
47-
- name: Check DLRN md5 exists or not
48-
ansible.builtin.stat:
49-
path: "{{ _repo_path }}/delorean.repo.md5"
50-
register: _check_dlrn_md5
51-
52-
- name: Slurp dlrn md5 hash
53-
ansible.builtin.slurp:
54-
path: "{{ _repo_path }}/delorean.repo.md5"
55-
register: _md5_data
56-
when: _check_dlrn_md5.stat.exists
57-
58-
- name: Store md5 content
59-
ansible.builtin.set_fact:
60-
_dlrn_md5: "{{ _md5_data['content'] | b64decode }}"
61-
when: _check_dlrn_md5.stat.exists
62-
63-
- name: Return Zuul Data
64-
ansible.builtin.debug:
65-
msg: >-
66-
Running Content provider registry on
67-
{{ node_ip | default('nowhere') }} with dlrn md5 hash
68-
{{ _dlrn_md5 | default('') }}
47+
- name: Return Zuul Data
48+
ansible.builtin.debug:
49+
msg: >-
50+
Running Content provider registry on
51+
{{ node_ip | default('nowhere') }} with dlrn md5 hash
52+
{{ _dlrn_md5 | default('') }}
6953
70-
- name: Set up content registry IP address
71-
zuul_return:
72-
data:
73-
zuul:
74-
pause: true
75-
content_provider_registry_ip: "{{ node_ip | default('nowhere') }}"
76-
content_provider_dlrn_md5_hash: "{{ _dlrn_md5 | default('') }}"
54+
- name: Set up content registry IP address
55+
zuul_return:
56+
data:
57+
zuul:
58+
pause: true
59+
content_provider_registry_ip: "{{ node_ip | default('nowhere') }}"
60+
content_provider_dlrn_md5_hash: "{{ _dlrn_md5 | default('') }}"

Diff for: ci/playbooks/tcib/tcib.yml

+11
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,14 @@
7575
content: "{{ cp_imgs.content }}"
7676
dest: "{{ ansible_user_dir }}/local_registry.log"
7777
mode: "0644"
78+
79+
- name: Run log related tasks
80+
ansible.builtin.import_playbook: >-
81+
{{
82+
[
83+
ansible_user_dir,
84+
zuul.projects['github.com/openstack-k8s-operators/ci-framework'].src_dir,
85+
'playbooks',
86+
'99-logs.yml'
87+
] | ansible.builtin.path_join
88+
}}

Diff for: zuul.d/tcib.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
run:
1818
- ci/playbooks/tcib/run.yml
1919
post-run:
20-
- ci/playbooks/e2e-collect-logs.yml
2120
- ci/playbooks/collect-logs.yml
2221
vars:
23-
zuul_log_collection: true
22+
cifmw_artifacts_basedir: "{{ cifmw_basedir | default(ansible_user_dir ~ '/ci-framework-data') }}"
2423

2524
- job:
2625
name: cifmw-tcib

0 commit comments

Comments
 (0)