Eduardo Olivares 4ad11e3710 Download ubuntu images prior to pytest execution
Tobiko downloads images from their URL when their test need to upload
them to glance
In some cases this is problematic because some of those images are big
and there may be timeouts affecting the tests

With this patch, tobiko downloads the ubuntu-minimal image before the
tobiko tests are executed (during the execution of the ansible/infrared
tobiko roles), which should avoid timeouts during the test execution

The intention is to extend this patch to other images such as CentOS,
RHEL and Fedora

NOTE: this patch does not modify the tests, it just adds the role so
that the Ubuntu images are downloaded - a later patch will modify the
tests so that they stop downloading the images and find them in the
configured path instead

Change-Id: Ifff8214b7d4a3c2a78d97b171714090fd64d60dd
2023-02-03 08:20:04 +00:00

101 lines
3.1 KiB
YAML

---
- block:
- include_role:
name: tobiko-fixup-stuff
# this role was added only since Tobiko version 0.5.0
#ignore nonexistent roles
rescue:
- name: Print when errors
ansible.builtin.debug:
msg: 'I caught an import error, skipping this role'
- block:
- include_role: name=tobiko-ir-jenkins
when: "(lookup('env','JENKINS_URL') | length) > 0"
- name: "consolidate deploy facts"
set_fact:
tobiko_dir: '{{ tobiko_dir | realpath }}'
tobiko_src_dir: '{{ tobiko_src_dir | realpath }}'
tobiko_git_repo: '{{ tobiko_git_repo }}'
tobiko_git_refspec: "{{ tobiko_git_refspec }}"
tobiko_git_remote: "{{ tobiko_git_remote }}"
test_dir: '{{ test_dir | realpath }}'
test_src_dir: '{{ test_src_dir | realpath }}'
test_git_repo: '{{ test_git_repo }}'
test_git_refspec: "{{ test_git_refspec }}"
test_git_remote: "{{ test_git_remote }}"
- name: "deploy Tobiko files"
include_role: name=tobiko-ir-deploy
vars:
deploy_dir: '{{ tobiko_dir }}'
deploy_src_dir: '{{ tobiko_src_dir }}'
deploy_git_repo: '{{ tobiko_git_repo }}'
deploy_git_refspec: "{{ tobiko_git_refspec }}"
deploy_git_remote: '{{ tobiko_git_remote }}'
- name: "deploy test files"
include_role: name=tobiko-ir-deploy
vars:
deploy_dir: '{{ test_dir }}'
deploy_src_dir: '{{ test_src_dir }}'
deploy_git_repo: '{{ test_git_repo }}'
deploy_git_refspec: "{{ test_git_refspec }}"
deploy_git_remote: '{{ test_git_remote }}'
when: test_dir != tobiko_dir
- name: deploy OpenShift InfraRed plugin files
include_role: name=tobiko-ir-deploy
vars:
deploy_dir: '{{ openshift_infrared_dir | realpath }}'
deploy_src_dir: '{{ openshift_infrared_src_dir | realpath }}'
deploy_git_repo: '{{ openshift_infrared_git_repo }}'
deploy_git_refspec: '{{ openshift_infrared_git_refspec }}'
deploy_git_remote: '{{ openshift_infrared_git_remote }}'
# validations-common here since it's packaged by rhel-osp
- name: install validations-common
ignore_errors: yes
become: true
package:
name: validations-common
state: present
- name: apply pre-requisites before tests run
include_role: name=tobiko-ir-before-run
- name: "download images"
include_role: name=tobiko-download-images
- name: "initialize test execution"
include_role: name=tobiko-configure
- name: "run tests"
include_role: name=tobiko-run
rescue:
- name: "clean up heat stacks generated during tobiko tests"
include_role: name=tobiko-cleanup
when: stacks_cleanup
- name: "finalize test execution"
include_role: name=tobiko-collect
ignore_errors: yes
- fail:
msg: 'TEST EXECUTION FAILED'
- name: "clean up heat stacks generated during tobiko tests"
include_role: name=tobiko-cleanup
when: stacks_cleanup
- name: "finalize test execution"
include_role: name=tobiko-collect
- debug:
msg: 'TEST EXECUTION SUCCEEDED'