Skip to content

Commit 535a08d

Browse files
committed
Add a new hook for storing Tempest timing data
This new hook is enabling timing data to be stored into an internal repository. Later the timing data will be used to reduce test execution time.
1 parent a54ba1a commit 535a08d

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
- name: Store stestr timing data in internal repository
3+
hosts: localhost
4+
gather_facts: false
5+
vars:
6+
repo_path: "/tmp/timing-data"
7+
timing_data_repo: "https://user:{{ git_token }}@gitlab.cee.redhat.com/ci-framework/timing-data"
8+
tasks:
9+
- name: Clone timing data repository
10+
ansible.builtin.git:
11+
repo: "{{ timing_data_repo }}"
12+
dest: "{{ repo_path }}"
13+
version: "main"
14+
15+
- name: Configure git settings
16+
community.general.git_config:
17+
repo: "{{ repo_path }}"
18+
scope: local
19+
name: "{{ item.name }}"
20+
value: "{{ item.value }}"
21+
loop:
22+
- {name: 'user.name', value: 'Zuul'}
23+
- {name: 'user.email', value: '[email protected]'}
24+
- {name: 'remote.origin.url', value: '{{ timing_data_repo }}'}
25+
26+
- name: Find all 'tempest' directories
27+
ansible.builtin.find:
28+
paths: "{{ ansible_user_dir }}/ci-framework-data/tests/test_operator/"
29+
file_type: directory
30+
patterns: "*-tempest*"
31+
register: tempest_dirs
32+
33+
- name: Loop over 'tempest' directories
34+
ansible.builtin.debug:
35+
msg: "DIR: {{ item.path }}"
36+
loop: "{{ tempest_dirs.files }}"
37+
38+
- name: Store timing data for every tempest-test directory
39+
ansible.builtin.include_tasks: tempest_store_timing_data_each.yaml
40+
vars:
41+
timing_data_repo_dir: "{{ repo_path }}/{{ job_name }}/{{ tempest_tests_name.path | basename }}"
42+
stestr_tar_path: "ci-framework-data/tests/test_operator/{{ tempest_tests_name.path | basename }}/stestr.tar.gz"
43+
loop: "{{ tempest_dirs.files }}"
44+
loop_control:
45+
loop_var: tempest_tests_name
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
#
3+
# Included by tempest_store_timing_data.yaml playbook
4+
#
5+
# There are two variables passed by the loop
6+
# - stestr_tar_path - a path to the data which will be copied
7+
# - timing_data_repo_dir - a path to a directory to be created
8+
#
9+
- name: Ensure the defined directory exists
10+
ansible.builtin.file:
11+
path: "{{ timing_data_repo_dir }}"
12+
state: directory
13+
mode: '0755'
14+
15+
- name: Copy timing data to commit
16+
ansible.builtin.copy:
17+
src: "{{ ansible_user_dir }}/{{ stestr_tar_path }}"
18+
dest: "{{ timing_data_repo_dir }}"
19+
mode: '0644'
20+
21+
- name: Add all changes
22+
ansible.builtin.command:
23+
cmd: git add .
24+
chdir: "{{ repo_path }}"
25+
changed_when: false
26+
# noqa command-instead-of-module
27+
28+
- name: Commit changes
29+
ansible.builtin.command:
30+
cmd: git commit -m "Automatic update"
31+
chdir: "{{ repo_path }}"
32+
register: commit_result
33+
changed_when: commit_result.rc == 0
34+
# noqa command-instead-of-module
35+
36+
- name: Push changes to the repository
37+
ansible.builtin.command:
38+
cmd: git push origin main
39+
chdir: "{{ repo_path }}"
40+
when: commit_result.rc == 0
41+
changed_when: false
42+
# noqa command-instead-of-module

0 commit comments

Comments
 (0)