Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5660af9

Browse files
committedJun 18, 2024·
[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 2ef6e09 commit 5660af9

File tree

3 files changed

+25
-26
lines changed

3 files changed

+25
-26
lines changed
 

‎ci/playbooks/tcib/run.yml

+13-24
Original file line numberDiff line numberDiff line change
@@ -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:

‎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+
}}

‎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)