Skip to content

Commit 7ae2c56

Browse files
committed
[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 6924629 commit 7ae2c56

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

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

+14-25
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
ansible.builtin.command:
2222
chdir: "{{ ansible_user_dir }}/src/github.com/openstack-k8s-operators/ci-framework"
2323
cmd: >-
24-
ansible-playbook ci/playbooks/tcib/tcib.yml
24+
ansible-playbook ci/playbooks/tcib/tcib.yml -c local
2525
-i "{{ ansible_user_dir }}/ci-framework-data/artifacts/zuul_inventory.yml"
2626
-e @scenarios/centos-9/base.yml
2727
-e @scenarios/centos-9/tcib.yml
@@ -34,40 +34,29 @@
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
39-
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 %}
46-
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
37+
- name: Include inner ansible vars file
38+
ansible.builtin.slurp:
39+
src: "{{ cifmw_artifacts_basedir }}/artifacts/ansible-vars.yml"
40+
register: inner_ansible
5741

58-
- name: Store md5 content
59-
ansible.builtin.set_fact:
60-
_dlrn_md5: "{{ _md5_data['content'] | b64decode }}"
61-
when: _check_dlrn_md5.stat.exists
42+
- name: Get inner ansible vars
43+
ansible.builtin.set_fact:
44+
inner_ansible_vars: "{{ inner_ansible.content | b64decode | from_yaml }}"
6245

6346
- name: Return Zuul Data
47+
vars:
48+
_inner_ansible_vars: "{{ inner_ansible.content | b64decode | from_yaml }}"
49+
_dlrn_md5: "{{ _inner_ansible_vars.cifmw_repo_setup_full_hash }}"
6450
ansible.builtin.debug:
6551
msg: >-
6652
Running Content provider registry on
6753
{{ node_ip | default('nowhere') }} with dlrn md5 hash
6854
{{ _dlrn_md5 | default('') }}
6955
7056
- name: Set up content registry IP address
57+
vars:
58+
_inner_ansible_vars: "{{ inner_ansible.content | b64decode | from_yaml }}"
59+
_dlrn_md5: "{{ _inner_ansible_vars.cifmw_repo_setup_full_hash }}"
7160
zuul_return:
7261
data:
7362
zuul:

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-1
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
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:
2322
zuul_log_collection: true
23+
cifmw_artifacts_basedir: "{{ cifmw_basedir | default(ansible_user_dir ~ '/ci-framework-data') }}"
2424

2525
- job:
2626
name: cifmw-tcib

0 commit comments

Comments
 (0)