-
Notifications
You must be signed in to change notification settings - Fork 0
/
.cirrus.yml.j2
115 lines (102 loc) · 3.81 KB
/
.cirrus.yml.j2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# SECONDARY ENTRYPOINT FOR CONTINUOUS INTEGRATION JOBS
#
# Tests that require full virtualization are delegated to Cirrus CI.
# Jobs described in this file are triggered by executing `cirrus-run`
task:
name: test-ansible-role-kvm
container:
image: potyarkin/molecule:host-kvm # Debian 10
kvm: true
{% if CIRRUS_RAM is defined %}
memory: "{{ CIRRUS_RAM }}"
{% endif %}
timeout_in: 80m
env:
PIP_CACHE_DIR: $HOME/cache/pip
VENVDIR: $HOME/venv
# VENVDIR must be absolute path for 'cd && make' approach to work
# VENVDIR should not be cached! Cirrus CI drops some binaries randomly
CGROUP_WORKAROUND: /sys/fs/cgroup/machine/qemu-cgroup_workaround.libvirt-qemu
# Pass values from cirrus-run environment
CLONE_URL: "{{ CI_REPOSITORY_URL }}"
CLONE_SHA: "{{ CI_COMMIT_SHA }}"
ANSIBLE_ROLE: "{{ ANSIBLE_ROLE }}"
CACHE_KEY: "{{ REQUIREMENTS_CHECKSUM }}"
{% if MOLECULE_SCENARIO is defined %}
MOLECULE_SCENARIO: "{{ MOLECULE_SCENARIO }}"
{% endif %}
{% if REQUIREMENTS_TXT is defined %}
REQUIREMENTS_TXT: "{{ REQUIREMENTS_TXT.split('/') | list | last }}"
{% endif %}
# Variables that might be helpful for debugging
{% if DEBUG is defined %}
DEBUG: "{{ DEBUG }}"
{% endif %}
# CI cache
# TODO: explore possibility of caching libvirtd image pool
pip_cache: # ~20 sec speedup
folder: $HOME/cache
fingerprint_script:
- echo "Python packages cache: molecule-venv-v4"
- echo "$CACHE_KEY"
# Clone correct repo instead of dummy GitHub placeholder
clone_script:
- git clone "$CLONE_URL" .
- git reset --hard "$CLONE_SHA"
# CI environment does not provide systemd,
# we have to start the daemons manually
dbus_background_script:
- mkdir -p /var/run/dbus
- /usr/bin/dbus-daemon --system --nofork --nopidfile
virtlogd_background_script:
- /usr/sbin/virtlogd
libvirtd_background_script:
- sleep 2 && /usr/sbin/libvirtd
# Workaround for cgroups v2
# I have no idea why or how this works (see commit message for a longer rant)
cgroups_workaround_background_script:
- mkdir -p "$CGROUP_WORKAROUND"
- ls -lF "$CGROUP_WORKAROUND"
- bash -c 'echo $$ > /tmp/cgroups_workaround.pid; sleep infinity' &
- sleep 1
- cat /tmp/cgroups_workaround.pid >> $CGROUP_WORKAROUND/cgroup.procs
- cat $CGROUP_WORKAROUND/cgroup.procs
# Execute automated tests
test_script:
- cd ansible/tests
- make test
# Debugging information
always:
cache_debug_script:
- find "$HOME/cache" -type f || echo "Exit code: $?"
cgroups_debug_script:
- fgrep cgroup /proc/mounts || echo "Exit code: $?"
- find /sys/fs/cgroup -exec ls -ldF {} \; || echo "Exit code: $?"
kvm_debug_script:
- free -h
- pstree -alT
- ps -eo ppid,pid,user,cpu,rss,stat,start,command
- lsmod
- kvm-ok || echo "Exit code: $?"
- ls -l /dev/kvm || echo "Exit code: $?"
- ls -l /var/run/libvirt || echo "Exit code: $?"
- whoami
- groups $(whoami)
- systemctl status || echo "Exit code: $?"
- cat /proc/cpuinfo
- lscpu
- virsh capabilities
- virt-host-validate || echo "Exit code: $?"
- cat /sys/module/kvm_*/parameters/nested || echo "Exit code: $?"
network_debug_script:
- virsh net-list --all || echo "Exit code: $?"
- virsh net-dumpxml vagrant-libvirt || echo "Exit code: $?"
- ifconfig || echo "Exit code: $?"
- cat /etc/network/interfaces || echo "Exit code: $?"
- brctl show || echo "Exit code: $?"
- uname -a || echo "Exit code: $?"
- iptables -S || echo "Exit code: $?"
- iptables-legacy -S || echo "Exit code: $?"
- iptables-nft -S || echo "Exit code: $?"
molecule_debug_script:
- find /root/.cache/molecule/ -type f -exec tail -v -n+0 {} \; || echo "Exit code: $?"