2020-10-14 20:31:37 +00:00
|
|
|
---
|
|
|
|
- hosts: localhost
|
2020-10-29 06:56:08 +00:00
|
|
|
vars:
|
|
|
|
- artifacts: ./artifacts
|
|
|
|
# FIXME! It would be cleaner to include 'buildah' in this list; but the
|
|
|
|
# dnf module is broken in ansible <= 2.8, it doesn't report failures
|
|
|
|
# to install as long as _one_ package installs! So if buildah installs
|
|
|
|
# but buildah-tests doesn't, the `dnf` stanza succeeds, then the test
|
|
|
|
# one fails with a less-than-helpful error.
|
|
|
|
#
|
|
|
|
# See https://github.com/ansible/ansible/pull/49760
|
|
|
|
- required_packages:
|
|
|
|
- buildah-tests
|
|
|
|
tags:
|
|
|
|
- classic
|
|
|
|
|
|
|
|
- name: install packages
|
|
|
|
dnf: name="{{ required_packages }}" state=installed
|
|
|
|
|
|
|
|
# Sigh; RHEL8 doesn't have BATS
|
|
|
|
- name: bats | fetch and unpack tarball
|
|
|
|
unarchive:
|
|
|
|
src: https://github.com/bats-core/bats-core/archive/v1.1.0.tar.gz
|
|
|
|
dest: /root
|
|
|
|
remote_src: true
|
|
|
|
|
|
|
|
- name: bats | install
|
|
|
|
command: ./install.sh /usr/local
|
|
|
|
args:
|
|
|
|
chdir: /root/bats-core-1.1.0
|
|
|
|
|
|
|
|
## - name: local registry | setup
|
|
|
|
|
|
|
|
- name: create nonroot user
|
|
|
|
user:
|
|
|
|
name: testuser
|
|
|
|
shell: /bin/bash
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: root | run test
|
|
|
|
script: ./test_buildah.sh
|
|
|
|
always:
|
|
|
|
- name: root | pull out logs
|
|
|
|
fetch:
|
|
|
|
src: "/tmp/{{ item }}"
|
|
|
|
dest: "{{ artifacts }}/{{ item }}"
|
|
|
|
flat: yes
|
|
|
|
with_items:
|
|
|
|
- test.root.log
|
|
|
|
- test.root.debug.log
|
|
|
|
|
|
|
|
- block:
|
|
|
|
- name: nonroot | run test
|
|
|
|
script: ./test_buildah.sh
|
|
|
|
args:
|
|
|
|
chdir: /home/testuser
|
|
|
|
become: yes
|
|
|
|
become_user: testuser
|
|
|
|
always:
|
|
|
|
- name: nonroot | pull out logs
|
|
|
|
fetch:
|
|
|
|
src: "/tmp/{{ item }}"
|
|
|
|
dest: "{{ artifacts }}/{{ item }}"
|
|
|
|
flat: yes
|
|
|
|
with_items:
|
|
|
|
- test.testuser.log
|
|
|
|
- test.testuser.debug.log
|
|
|
|
when: false
|