Skip to content
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

Pull all test images to avoid timing issues during tests #1349

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ansible/roles/run-test-target/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
vars:
arch: "{{ arch_info }}"

- name: Pull test images
include_tasks: pull-images.yml
# only pull all images when we're running all tests.
# The performance penalty is several minutes
# which is quite significant for a specific test suite
# (i.e. when testing during development) but is only
# minor when running on CI
when: collector_test == 'ci-integration-tests'

#
# Separation of collection method is only possible with a separate
# task file, because we need to loop over a set of tasks to ensure
Expand Down
39 changes: 39 additions & 0 deletions ansible/roles/run-test-target/tasks/pull-images.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---

- name: Load image info
set_fact:
images: "{{ lookup('file', collector_root + '/integration-tests/images.yml') | from_yaml }}"
qa_tag: "{{ lookup('file', collector_root + '/integration-tests/container/QA_TAG') }}"
delegate_to: localhost

- name: Pull QA images
command: "{{ 'sudo' if runtime_as_root else '' }} {{ runtime_command }} pull {{ item.value }}-{{ qa_tag }}"
loop: "{{ images.qa | dict2items }}"
# parallel for speeeeed
async: 300
poll: 0
register: qa_result

- name: Pull non-QA images
command: "{{ 'sudo' if runtime_as_root else '' }} {{ runtime_command }} pull {{ item.value }}"
loop: "{{ images.non_qa | dict2items }}"
# parallel for speeeeed
async: 300
poll: 0
register: non_qa_result

- name: Await QA
async_status:
jid: "{{ item.ansible_job_id }}"
loop: "{{ qa_result.results }}"
register: await_qa
until: await_qa.finished
retries: 30

- name: Await non-QA
async_status:
jid: "{{ item.ansible_job_id }}"
loop: "{{ non_qa_result.results }}"
register: await_non_qa
until: await_non_qa.finished
retries: 30