2017-08-15 18:41:54 +00:00
|
|
|
---
|
|
|
|
- hosts: localhost
|
2017-08-23 07:30:51 +00:00
|
|
|
gather_facts: yes
|
2017-08-22 19:20:00 +00:00
|
|
|
vars:
|
|
|
|
artifacts: "{{ lookup('env', 'TEST_ARTIFACTS')|default('./artifacts', true) }}"
|
|
|
|
subjects: "{{ lookup('env', 'TEST_SUBJECTS')}}"
|
2017-08-15 18:41:54 +00:00
|
|
|
tags:
|
|
|
|
- atomic
|
2017-08-23 07:30:51 +00:00
|
|
|
|
2017-08-15 18:41:54 +00:00
|
|
|
tasks:
|
2017-08-23 07:30:51 +00:00
|
|
|
- name: Prepare an SSH config
|
|
|
|
set_fact:
|
|
|
|
ssh_config: "Host vmcheck\n\tUser {{ ansible_ssh_user }}\n\tPort {{ ansible_ssh_port }}\n\tHostName {{ ansible_ssh_host }}\n\tIdentityFile {{ ansible_ssh_private_key_file }}\n\tUserKnownHostsFile /dev/null\n\tStrictHostKeyChecking no\n"
|
|
|
|
|
|
|
|
- name: Add executor host
|
|
|
|
add_host:
|
|
|
|
name: executor
|
|
|
|
ansible_connection: local
|
|
|
|
ansible_ssh_host: 127.0.0.1
|
|
|
|
ansible_ssh_connection: local
|
2017-08-15 18:41:54 +00:00
|
|
|
|
|
|
|
# XXX: move to standard-test-roles, e.g. standard-test-get-source
|
2017-08-23 07:30:51 +00:00
|
|
|
- name: Extract and run tests
|
|
|
|
delegate_to: executor
|
|
|
|
block:
|
|
|
|
- name: Gather facts
|
|
|
|
setup:
|
|
|
|
delegate_facts: True
|
2017-08-22 19:09:19 +00:00
|
|
|
|
2017-08-23 07:30:51 +00:00
|
|
|
- name: Install requirements
|
|
|
|
package: name={{item}} state=present # XXX: state=latest
|
|
|
|
with_items:
|
|
|
|
- fedpkg
|
2017-08-22 19:09:19 +00:00
|
|
|
|
2017-08-23 07:30:51 +00:00
|
|
|
# The dist doesn't actually matter here
|
|
|
|
- name: Download and extract sources
|
|
|
|
command: fedpkg --dist=master prep
|
|
|
|
args:
|
|
|
|
chdir: "{{playbook_dir}}/.."
|
2017-08-15 18:41:54 +00:00
|
|
|
|
2017-08-23 07:30:51 +00:00
|
|
|
- name: Get source directory from environment
|
|
|
|
shell: "rpm -q --specfile {{playbook_dir}}/../rpm-ostree.spec --qf '{{playbook_dir}}/../%{NAME}-%{VERSION}\n' | head -n1"
|
|
|
|
register: srcdir
|
2017-08-15 18:41:54 +00:00
|
|
|
|
2017-08-23 07:30:51 +00:00
|
|
|
- name: Write out SSH config
|
|
|
|
copy:
|
|
|
|
content: "{{ ssh_config }}"
|
|
|
|
dest: "{{srcdir.stdout}}/ssh-config"
|
2017-08-15 18:41:54 +00:00
|
|
|
|
2017-08-23 07:30:51 +00:00
|
|
|
- set_fact:
|
|
|
|
vmssh: ssh -F {{srcdir.stdout}}/ssh-config vmcheck
|
2017-08-15 18:41:54 +00:00
|
|
|
|
2017-08-23 07:30:51 +00:00
|
|
|
# XXX: need to upstream this
|
|
|
|
- name: create and rebase onto vmcheck
|
|
|
|
command: "{{vmssh}} rpm-ostree status --json"
|
|
|
|
register: status
|
|
|
|
- set_fact:
|
|
|
|
status_json: "{{ status.stdout | from_json }}"
|
|
|
|
- command: "{{vmssh}} ostree refs {{ status_json['deployments'][0]['origin'] }} --create vmcheck"
|
|
|
|
- command: "{{vmssh}} rpm-ostree rebase :vmcheck"
|
|
|
|
# XXX: use ans_reboot.yml from a-h-t
|
|
|
|
- shell: "{{vmssh}} shutdown -r now"
|
|
|
|
ignore_errors: true
|
2017-08-15 18:41:54 +00:00
|
|
|
|
2017-08-23 07:30:51 +00:00
|
|
|
- name: Run Tests
|
|
|
|
block:
|
|
|
|
- name: Run vmcheck
|
2017-08-15 18:41:54 +00:00
|
|
|
command: tests/vmcheck/multitest.py vmcheck
|
|
|
|
# XXX: consider making vmcheck become an installed test
|
|
|
|
environment:
|
|
|
|
VMTESTS: 1
|
|
|
|
SKIP_VMOVERLAY: 1
|
|
|
|
TESTS: basic layering-basic
|
2017-08-22 19:09:19 +00:00
|
|
|
topsrcdir: "{{srcdir.stdout}}"
|
|
|
|
commondir: "{{srcdir.stdout}}/tests/common"
|
2017-08-15 18:41:54 +00:00
|
|
|
args:
|
2017-08-22 19:09:19 +00:00
|
|
|
chdir: "{{srcdir.stdout}}"
|
2017-08-15 18:41:54 +00:00
|
|
|
|
2017-08-23 07:30:51 +00:00
|
|
|
always:
|
2017-08-15 18:41:54 +00:00
|
|
|
- name: fetch vmcheck results
|
|
|
|
synchronize:
|
2017-08-22 19:09:19 +00:00
|
|
|
src: "{{srcdir.stdout}}/vmcheck/"
|
2017-08-15 18:41:54 +00:00
|
|
|
dest: "{{artifacts}}/vmcheck"
|
|
|
|
mode: pull
|
|
|
|
delete: yes
|