-
Notifications
You must be signed in to change notification settings - Fork 139
Add a new hook for storing Tempest timing data #3330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kstrenkova
wants to merge
1
commit into
openstack-k8s-operators:main
Choose a base branch
from
kstrenkova:add-new-timing-data-url
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+88
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| --- | ||
| - name: Store stestr timing data in repository | ||
| hosts: localhost | ||
| gather_facts: false | ||
| vars: | ||
| repo_path: "/tmp/timing-data" | ||
| tests_log_dir: "{{ ansible_user_dir }}/ci-framework-data/tests/test_operator" | ||
| timing_data_repo: "https://repo.example.org/project/timing-data" | ||
| tasks: | ||
| - name: All tasks required for storing timing data | ||
| # Note(kstrenko): This playbook introduces an additional feature | ||
| # and should not interfere with existing jobs. | ||
| ignore_errors: true # noqa: ignore-errors | ||
| block: | ||
| - name: Clone timing data repository | ||
| ansible.builtin.git: | ||
| repo: "{{ timing_data_repo }}" | ||
| dest: "{{ repo_path }}" | ||
| version: "main" | ||
|
|
||
| - name: Configure git settings | ||
| community.general.git_config: | ||
| repo: "{{ repo_path }}" | ||
| scope: local | ||
| name: "{{ item.name }}" | ||
| value: "{{ item.value }}" | ||
| loop: | ||
| - {name: 'user.name', value: 'Zuul'} | ||
| - {name: 'user.email', value: '[email protected]'} | ||
| - {name: 'remote.origin.url', value: '{{ timing_data_repo }}'} | ||
|
|
||
| - name: Find all 'tempest' directories | ||
| ansible.builtin.find: | ||
| paths: "{{ tests_log_dir }}" | ||
| file_type: directory | ||
| patterns: "*-tempest*" | ||
| register: tempest_dirs | ||
|
|
||
| - name: Store timing data for every tempest-test directory | ||
| ansible.builtin.include_tasks: ../tasks/tempest_store_timing_data_each.yaml | ||
| vars: | ||
| stestr_tar_path: "{{ tests_log_dir }}/{{ tempest_tests_name.path | basename }}/stestr.tar.gz" | ||
| timing_data_repo_dir: "{{ repo_path }}/{{ job_name }}/{{ tempest_tests_name.path | basename }}" | ||
| loop: "{{ tempest_dirs.files }}" | ||
| loop_control: | ||
| loop_var: tempest_tests_name | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| --- | ||
| # | ||
| # Included by tempest_store_timing_data.yaml playbook | ||
| # | ||
| # There are two variables passed by the loop | ||
| # - stestr_tar_path - a path to the data which will be copied | ||
| # - timing_data_repo_dir - a path to a directory to be created | ||
| # | ||
| - name: Ensure the defined directory exists | ||
| ansible.builtin.file: | ||
| path: "{{ timing_data_repo_dir }}" | ||
| state: directory | ||
| mode: '0755' | ||
|
|
||
| - name: Copy timing data to commit | ||
| ansible.builtin.copy: | ||
| src: "{{ stestr_tar_path }}" | ||
| dest: "{{ timing_data_repo_dir }}" | ||
| mode: '0644' | ||
|
|
||
| - name: Add all changes | ||
| ansible.builtin.command: | ||
| cmd: git add . | ||
| chdir: "{{ repo_path }}" | ||
| changed_when: false | ||
| # noqa command-instead-of-module | ||
|
|
||
| - name: Commit changes | ||
| ansible.builtin.command: | ||
| cmd: git commit -m "Automatic update" | ||
| chdir: "{{ repo_path }}" | ||
| register: commit_result | ||
| changed_when: commit_result.rc == 0 | ||
| # noqa command-instead-of-module | ||
|
|
||
| - name: Push changes to the repository | ||
| ansible.builtin.command: | ||
| cmd: git push origin main | ||
| chdir: "{{ repo_path }}" | ||
| when: commit_result.rc == 0 | ||
| changed_when: false | ||
| # noqa command-instead-of-module |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
normally I like it, nice work, but...
I don't see "tasks" in hooks. Maybe would be better to... create role and add it there then call the role? WDYT
NIT: you need to rebase to get
rolessymlink available inhooks/playbooks.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @danpawlik, the only reason I added it under task folder is that playbook folder expects playbooks :D.
About your suggestion, I did the rebase and have the symlink, but I find it hard to imagine creating a role for one task 🤔