cockpit/tests/roles/standard-test-scripts/tasks/main.yml

34 lines
886 B
YAML
Raw Normal View History

---
- name: Copy test scripts to target
synchronize:
src: "{{ item }}"
dest: /usr/local/bin/
ssh_args: "-o UserKnownHostsFile=/dev/null"
with_items:
- "{{ tests }}"
- "{{ files }}"
- block:
- name: Execute test scripts
shell: |
mkdir -p /tmp/artifacts
logfile=/tmp/artifacts/test.$(echo {{ item }} | sed -e 's/\//-/g').log
exec 2>>$logfile 1>>$logfile
cd /usr/local/bin
if [ -x {{ item }} ]; then
./$(basename {{ item }}) && result="PASS" || result="FAIL"
else
/bin/sh -e ./$(basename {{ item }}) && result="PASS" || result="FAIL"
fi
echo "$result {{ item }}" >> /tmp/artifacts/test.log
with_items:
- "{{ tests }}"
always:
- name: Pull out the logs
synchronize:
dest: "{{ artifacts }}"
src: "/tmp/artifacts/./"
mode: pull
when: artifacts|default("") != ""