| |
@@ -1,140 +1,36 @@
|
| |
---
|
| |
- - name: Add executor host
|
| |
- add_host:
|
| |
- name: executor
|
| |
- ansible_connection: local
|
| |
- ansible_ssh_host: 127.0.0.1
|
| |
- ansible_ssh_connection: local
|
| |
|
| |
- - name: Packages to be present on the system.
|
| |
- set_fact:
|
| |
- # Separate debuginfo and ordinary packages. There is an issue on GitHub:
|
| |
- # https://github.com/ansible/ansible/issues/31579. The easiest way to
|
| |
- # install debuginfo for package is to use 'debuginfo-install'. This
|
| |
- # program is present on RHEL/CentOS/Fedora and it automatically enables
|
| |
- # debuginfo repos.
|
| |
- pkgs_ordinary_req: >
|
| |
- {{
|
| |
- required_packages |
|
| |
- reject('match', '.*-debuginfo$') |
|
| |
- list
|
| |
- }}
|
| |
- pkgs_debuginfo_req: >
|
| |
- {{
|
| |
- required_packages |
|
| |
- select('match', '.*-debuginfo$') |
|
| |
- list |
|
| |
- regex_replace('-debuginfo')
|
| |
- }}
|
| |
-
|
| |
- - name: Target OS identification
|
| |
+ - delegate_to: "{{ test_runner_inventory_name }}"
|
| |
block:
|
| |
- - name: Test if system is Atomic Host
|
| |
- lineinfile:
|
| |
- name: /etc/os-release
|
| |
- regexp: .*Atomic Host.*
|
| |
- state: absent
|
| |
- check_mode: yes
|
| |
- changed_when: False
|
| |
- register: os_release_atomic
|
| |
- - name: Set Ansible fact 'is_atomic_host'
|
| |
- set_fact:
|
| |
- is_atomic_host: "{{ os_release_atomic.found > 0 }}"
|
| |
-
|
| |
- - block:
|
| |
- - name: Gather facts
|
| |
- setup:
|
| |
- delegate_facts: True
|
| |
-
|
| |
- name: Add restraint repo for restraint-rhts on Fedora hosts
|
| |
shell: dnf copr enable -y bpeck/restraint
|
| |
- when: ansible_distribution == 'Fedora'
|
| |
+ when: hostvars[test_runner_inventory_name]['ansible_distribution'] == 'Fedora'
|
| |
|
| |
- name: Add restraint repo for restraint-rhts on RHEL/CentOS hosts
|
| |
block:
|
| |
- package: name=yum-plugin-copr
|
| |
- shell: yum copr -y enable bpeck/restraint
|
| |
- when: "[ansible_distribution] | intersect(['RedHat', 'CentOS'])"
|
| |
+ when: "[hostvars[test_runner_inventory_name]['ansible_distribution'] ] | intersect(['RedHat', 'CentOS'])"
|
| |
|
| |
- name: Install the beakerlib requirements
|
| |
- package: name={{item}} state=latest
|
| |
+ package: name={{item}} state=present
|
| |
with_items:
|
| |
- beakerlib
|
| |
- restraint-rhts
|
| |
- rsync
|
| |
|
| |
- - name: Fetch tests from remote repositories
|
| |
- git:
|
| |
- repo: "{{ item.repo }}"
|
| |
- dest: "{{ item.dest }}"
|
| |
- version: "{{ item.version | default('master') }}"
|
| |
- with_items:
|
| |
- "{{ repositories }}"
|
| |
- when: repositories is defined
|
| |
-
|
| |
- delegate_to: executor
|
| |
-
|
| |
- - block:
|
| |
- - name: Install the beakerlib requirements on target
|
| |
- package: name={{item}} state=latest
|
| |
- with_items:
|
| |
+ - name: Install the beakerlib requirements to test environment
|
| |
+ package: name={{item}} state=latest
|
| |
+ with_items:
|
| |
- rsync
|
| |
- findutils
|
| |
+ - make
|
| |
+ when: not is_atomic
|
| |
|
| |
- - name: Install any test-specific package requirements
|
| |
- # Note, this method cannot install -debuginfo packages.
|
| |
- package: name={{item}} state=present
|
| |
- with_items:
|
| |
- - "{{ pkgs_ordinary_req }}"
|
| |
-
|
| |
- - block:
|
| |
- - name: Install yum-utils
|
| |
- package: name=yum-utils state=latest
|
| |
- when: ansible_pkg_mgr == 'yum'
|
| |
-
|
| |
- - name: Install dnf-utils
|
| |
- # System can have installed yum-utils. Which conflicts wih dnf-utils.
|
| |
- # Therefore, remove yum-utils and install dnf-utils.
|
| |
- shell: dnf --assumeyes --allowerasing install dnf-utils
|
| |
- when: ansible_pkg_mgr == 'dnf'
|
| |
-
|
| |
- - name: Care about debuginfo packages for DNF/YUM systems
|
| |
- shell: |
|
| |
- debuginfo-install --assumeyes {{item}}
|
| |
- with_items:
|
| |
- - "{{ pkgs_debuginfo_req }}"
|
| |
- when:
|
| |
- - "[ansible_pkg_mgr] | intersect(['dnf', 'yum'])"
|
| |
- - pkgs_debuginfo_req
|
| |
-
|
| |
- # Only manually install packages on non atomic hosts
|
| |
- when: ansible_pkg_mgr != 'unknown'
|
| |
-
|
| |
- - block:
|
| |
- - name: Check presence of required packages for Atomic Host
|
| |
- shell: rpm -q {{ pkgs_ordinary_req|join(" ") }}
|
| |
- register: package_check
|
| |
- changed_when: False
|
| |
- failed_when: False
|
| |
- args: { warn: no }
|
| |
- - name: Install required packages at Atomic Host
|
| |
- shell:
|
| |
- rpm-ostree install {{ pkgs_ordinary_req|join(" ") }}
|
| |
- && rpm-ostree ex livefs
|
| |
- when: package_check.rc != 0
|
| |
- when:
|
| |
- - is_atomic_host
|
| |
- - pkgs_ordinary_req
|
| |
-
|
| |
- - name: Define remote_artifacts if it is not already defined
|
| |
- set_fact:
|
| |
- remote_artifacts: /tmp/artifacts
|
| |
- when: remote_artifacts is not defined
|
| |
-
|
| |
- - name: Put beakerlib binaries on the target
|
| |
+ - name: Put beakerlib binaries to test environment
|
| |
copy:
|
| |
- src: "{{item}}"
|
| |
- dest: /usr/local/bin/
|
| |
+ src: "{{ item }}"
|
| |
+ dest: "{{ tenv_workdir }}"
|
| |
mode: 755
|
| |
with_fileglob:
|
| |
- "/usr/bin/beakerlib-*"
|
| |
@@ -146,36 +42,35 @@
|
| |
- "/usr/share/restraint/*"
|
| |
- "rpm.py"
|
| |
|
| |
- - name: Copy tests to target
|
| |
+ - name: Copy tests to test environment
|
| |
synchronize:
|
| |
src: "{{ playbook_dir }}/"
|
| |
- dest: /usr/local/bin/
|
| |
+ dest: "{{ tenv_workdir }}"
|
| |
ssh_args: "-o UserKnownHostsFile=/dev/null"
|
| |
|
| |
- - name: Fix up beakerlib
|
| |
+ - name: Fix up beakerlib at tests environment
|
| |
shell: >
|
| |
- find /usr/local/bin -type f
|
| |
+ find {{ tenv_workdir }} -type f
|
| |
|
|
| |
xargs sed -i
|
| |
- -e 's|/usr/share/beakerlib|/usr/local/bin|g'
|
| |
- -e 's|/usr/lib/beakerlib|/usr/local/bin|g'
|
| |
- -e 's|/usr/share/rhts/lib/rhts-|/usr/local/bin/rhts-|g'
|
| |
- -e 's|/usr/bin/rhts-|/usr/local/bin/rhts-|g'
|
| |
- -e 's|/usr/share/rhts/lib/rhts_|/usr/local/bin/rhts-|g'
|
| |
- -e 's|/usr/bin/rhts_|/usr/local/bin/rhts-|g'
|
| |
- -e 's|/usr/share/rhts-library/rhtslib.sh|/usr/local/bin/beakerlib.sh|g'
|
| |
- -e 's|/usr/bin/rstrnt-|/usr/local/bin/rstrnt-|g'
|
| |
+ -e 's|/usr/share/beakerlib|{{ tenv_workdir }}|g'
|
| |
+ -e 's|/usr/lib/beakerlib|{{ tenv_workdir }}|g'
|
| |
+ -e 's|/usr/share/rhts/lib/rhts-|{{ tenv_workdir }}/rhts-|g'
|
| |
+ -e 's|/usr/bin/rhts-|{{ tenv_workdir }}/rhts-|g'
|
| |
+ -e 's|/usr/share/rhts/lib/rhts_|{{ tenv_workdir }}/rhts-|g'
|
| |
+ -e 's|/usr/bin/rhts_|{{ tenv_workdir }}/rhts-|g'
|
| |
+ -e 's|/usr/share/rhts-library/rhtslib.sh|{{ tenv_workdir }}/beakerlib.sh|g'
|
| |
+ -e 's|/usr/bin/rstrnt-|{{ tenv_workdir }}/rstrnt-|g'
|
| |
|
| |
- - name: Make artifacts directory
|
| |
- file: path={{ remote_artifacts }} state=directory owner=root mode=755 recurse=yes
|
| |
|
| |
- block:
|
| |
- - name: Execute beakerlib tests
|
| |
+ - name: Run beakerlib tests
|
| |
shell: |
|
| |
export OUTPUTFILE=/dev/stdout TEST={{ item }}
|
| |
+ export PATH="$PATH:{{ tenv_workdir }}"
|
| |
logfile={{ remote_artifacts }}/test.$(echo {{ item }} | sed -e 's/\//-/g').log
|
| |
exec 2>>$logfile 1>>$logfile
|
| |
- cd /usr/local/bin
|
| |
+ cd {{ tenv_workdir }}
|
| |
if [ -f {{ item }} ]; then
|
| |
cd $(dirname {{ item }})
|
| |
/bin/sh -e ./$(basename {{ item }})
|
| |
@@ -195,7 +90,7 @@
|
| |
- "{{ tests }}"
|
| |
|
| |
always:
|
| |
- - name: Make the master test summary log artifact
|
| |
+ - name: Make the master tests summary log artifact
|
| |
shell: |
|
| |
logfile={{ remote_artifacts }}/test.$(echo {{ item }} | sed -e 's/\//-/g').log
|
| |
if grep -q '\[ *FAIL *\]' "$logfile"; then
|
| |
@@ -212,7 +107,7 @@
|
| |
with_items:
|
| |
- "{{ tests }}"
|
| |
|
| |
- - name: Pull out the logs
|
| |
+ - name: Pull out the logs from test environment
|
| |
synchronize:
|
| |
dest: "{{ artifacts }}/"
|
| |
src: "{{ remote_artifacts }}/"
|
| |