Improve CI (#539)

* Update CI scripts to be more close to the ones in ansible-core.

* Extend CI matrix.

* Mark more VMs.

* Revert "Mark more VMs."

This reverts commit 8bc79af636.

* Disable alpine VMs for get_certificate due to httptester problems.

* Improve retrieval of cryptsetup version.

* ACME 'emulator' won't work on Alpine either.

* Improve luks test setup.

* Make sure wipefs is installed on Alpine.

* dmsetup (from device-mapper) is used by the tests.

* Fix bcrypt install failure handling.

* String, not float.

* openssl_privatekey_convert is not an action module.

* Update Python info.

* Try out which VMs can be used by now.

* Enable ACME tests on all VMs but Alpine; update comment.

* Adjust acme-tiny shebang.

* Remove new entries from CI matrix.
pull/541/head
Felix Fontein 2022-12-11 19:55:47 +01:00 committed by GitHub
parent 664f34f2ac
commit ca23b2ed9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 115 additions and 61 deletions

View File

@ -173,7 +173,7 @@ stages:
test: debian-bullseye/3.9 test: debian-bullseye/3.9
- name: ArchLinux - name: ArchLinux
test: archlinux/3.10 test: archlinux/3.10
- name: CentOS Stream 8 - name: CentOS Stream 8 w/ Python 3.9
test: centos-stream8/3.9 test: centos-stream8/3.9
### Remote ### Remote

View File

@ -6,9 +6,5 @@ azp/generic/1
azp/posix/1 azp/posix/1
cloud/acme cloud/acme
# Skip all VMs, since we cannot talk to the ACME simulator from these: # For some reason connecting to helper containers does not work on the Alpine VMs
skip/aix skip/alpine
skip/freebsd
skip/macos
skip/osx
skip/rhel

View File

@ -6,9 +6,5 @@ azp/generic/1
azp/posix/1 azp/posix/1
cloud/acme cloud/acme
# Skip all VMs, since we cannot talk to the ACME simulator from these: # For some reason connecting to helper containers does not work on the Alpine VMs
skip/aix skip/alpine
skip/freebsd
skip/macos
skip/osx
skip/rhel

View File

@ -6,9 +6,5 @@ azp/generic/1
azp/posix/1 azp/posix/1
cloud/acme cloud/acme
# Skip all VMs, since we cannot talk to the ACME simulator from these: # For some reason connecting to helper containers does not work on the Alpine VMs
skip/aix skip/alpine
skip/freebsd
skip/macos
skip/osx
skip/rhel

View File

@ -6,9 +6,5 @@ azp/generic/1
azp/posix/1 azp/posix/1
cloud/acme cloud/acme
# Skip all VMs, since we cannot talk to the ACME simulator from these: # For some reason connecting to helper containers does not work on the Alpine VMs
skip/aix skip/alpine
skip/freebsd
skip/macos
skip/osx
skip/rhel

View File

@ -6,9 +6,5 @@ azp/generic/1
azp/posix/1 azp/posix/1
cloud/acme cloud/acme
# Skip all VMs, since we cannot talk to the ACME simulator from these: # For some reason connecting to helper containers does not work on the Alpine VMs
skip/aix skip/alpine
skip/freebsd
skip/macos
skip/osx
skip/rhel

View File

@ -6,9 +6,5 @@ azp/generic/1
azp/posix/1 azp/posix/1
cloud/acme cloud/acme
# Skip all VMs, since we cannot talk to the ACME simulator from these: # For some reason connecting to helper containers does not work on the Alpine VMs
skip/aix skip/alpine
skip/freebsd
skip/macos
skip/osx
skip/rhel

View File

@ -6,3 +6,6 @@ azp/generic/1
azp/posix/1 azp/posix/1
destructive destructive
needs/httptester needs/httptester
# For some reason connecting to helper containers does not work on the Alpine VMs
skip/alpine

View File

@ -15,29 +15,66 @@
loop: loop:
- keyfile1 - keyfile1
- keyfile2 - keyfile2
- name: Include OS-specific variables
include_vars: '{{ lookup("first_found", search) }}'
vars:
search:
files:
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
- '{{ ansible_distribution }}-{{ ansible_distribution_version }}.yml'
- '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml'
- default.yml
paths:
- vars
- name: Make sure cryptsetup is installed - name: Make sure cryptsetup is installed
package: package:
name: cryptsetup name: cryptsetup
state: present state: present
become: yes become: true
- name: Install additionally required packages
package:
name: '{{ luks_extra_packages }}'
state: present
become: true
when: luks_extra_packages | length > 0
- name: Determine cryptsetup version
command: cryptsetup --version
register: cryptsetup_version
- name: Extract cryptsetup version
set_fact:
cryptsetup_version: >-
{{ cryptsetup_version.stdout_lines[0] | regex_search('cryptsetup ([0-9]+\.[0-9]+\.[0-9]+)') | split | last }}
- name: Create cryptfile - name: Create cryptfile
command: dd if=/dev/zero of={{ remote_tmp_dir.replace('~', ansible_env.HOME) }}/cryptfile bs=1M count=32 command: dd if=/dev/zero of={{ remote_tmp_dir.replace('~', ansible_env.HOME) }}/cryptfile bs=1M count=32
- name: Figure out next loopback device
command: losetup -f
become: true
register: cryptfile_device_output
- name: Create lookback device - name: Create lookback device
command: losetup -f {{ remote_tmp_dir.replace('~', ansible_env.HOME) }}/cryptfile command: losetup -f {{ remote_tmp_dir.replace('~', ansible_env.HOME) }}/cryptfile
become: yes become: true
- name: Determine loop device name
command: losetup -j {{ remote_tmp_dir.replace('~', ansible_env.HOME) }}/cryptfile --output name - name: Store some common data for tests
become: yes set_fact:
register: cryptfile_device_output cryptfile_device: "{{ cryptfile_device_output.stdout_lines[0] }}"
- set_fact:
cryptfile_device: "{{ cryptfile_device_output.stdout_lines[1] }}"
cryptfile_passphrase1: "uNiJ9vKG2mUOEWDiQVuBHJlfMHE" cryptfile_passphrase1: "uNiJ9vKG2mUOEWDiQVuBHJlfMHE"
cryptfile_passphrase2: "HW4Ak2HtE2vvne0qjJMPTtmbV4M" cryptfile_passphrase2: "HW4Ak2HtE2vvne0qjJMPTtmbV4M"
cryptfile_passphrase3: "qQJqsjabO9pItV792k90VvX84MM" cryptfile_passphrase3: "qQJqsjabO9pItV792k90VvX84MM"
- block: - block:
- include_tasks: run-test.yml - include_tasks: run-test.yml
with_fileglob: with_fileglob:
- "tests/*.yml" - "tests/*.yml"
always: always:
- name: Make sure LUKS device is gone - name: Make sure LUKS device is gone
luks_device: luks_device:
@ -45,8 +82,10 @@
state: absent state: absent
become: yes become: yes
ignore_errors: yes ignore_errors: yes
- command: losetup -d "{{ cryptfile_device }}" - command: losetup -d "{{ cryptfile_device }}"
become: yes become: yes
- file: - file:
dest: "{{ remote_tmp_dir }}/cryptfile" dest: "{{ remote_tmp_dir.replace('~', ansible_env.HOME) }}/cryptfile"
state: absent state: absent

View File

@ -3,10 +3,6 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
- name: Gather package facts
package_facts:
manager: auto
- name: On kernel >= 5.9 use performance flags - name: On kernel >= 5.9 use performance flags
block: block:
- name: Create and open (check) - name: Create and open (check)
@ -104,4 +100,4 @@
when: when:
- ansible_facts.kernel is version('5.9.0', '>=') - ansible_facts.kernel is version('5.9.0', '>=')
- ansible_facts.packages['cryptsetup'][0].version is version('2.3.4', '>=') - cryptsetup_version is version('2.3.4', '>=')

View File

@ -0,0 +1,10 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
cryptsetup_package: cryptsetup
luks_extra_packages:
- device-mapper
- wipefs

View File

@ -0,0 +1,8 @@
---
# Copyright (c) Ansible Project
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later
cryptsetup_package: cryptsetup
luks_extra_packages: []

View File

@ -2,7 +2,6 @@
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
context/controller
azp/generic/1 azp/generic/1
azp/posix/1 azp/posix/1
destructive destructive

View File

@ -24,5 +24,5 @@
- name: Ensure bcrypt_version is defined - name: Ensure bcrypt_version is defined
set_fact: set_fact:
bcrypt_version: bcrypt_version:
stdout: 0.0 stdout: "0.0"
when: bcrypt_version is not defined when: bcrypt_version is failed

View File

@ -22,6 +22,10 @@ system_python_version_data:
- '3.9' - '3.9'
'34': '34':
- '3.9' - '3.9'
'35':
- '3.10'
'36':
- '3.10'
Ubuntu: Ubuntu:
'16': '16':
- '2.7' - '2.7'
@ -29,6 +33,8 @@ system_python_version_data:
- '3.6' - '3.6'
'20': '20':
- '3.8' - '3.8'
'22':
- '3.10'
Darwin: Darwin:
'10.11': '10.11':
- '2.7' - '2.7'
@ -67,6 +73,8 @@ system_python_version_data:
'11': '11':
- '3.9' - '3.9'
Alpine: Alpine:
'3.16':
- '3.10'
'3.15': '3.15':
- '3.9' - '3.9'
'3.12': '3.12':

View File

@ -7,9 +7,5 @@ azp/posix/1
cloud/acme cloud/acme
context/target context/target
# Skip all VMs, since we cannot talk to the ACME simulator from these: # For some reason connecting to helper containers does not work on the Alpine VMs
skip/aix skip/alpine
skip/freebsd
skip/macos
skip/osx
skip/rhel

View File

@ -95,6 +95,12 @@
except ImportError: except ImportError:
from urllib2 import Request # Python 2 from urllib2 import Request # Python 2
- name: "Monkey-patch acme-tiny: adjust shebang"
replace:
path: "{{ remote_tmp_dir }}/acme-tiny"
regexp: '^\#\!/usr/bin/env .*$'
replace: '#!{{ ansible_python_interpreter }}'
- name: "Monkey-patch acme-tiny: Disable check that challenge file is reachable via HTTP" - name: "Monkey-patch acme-tiny: Disable check that challenge file is reachable via HTTP"
replace: replace:
path: "{{ remote_tmp_dir }}/acme-tiny" path: "{{ remote_tmp_dir }}/acme-tiny"

View File

@ -0,0 +1 @@
remote.sh

View File

@ -0,0 +1 @@
remote.sh

View File

@ -10,6 +10,16 @@ IFS='/:' read -ra args <<< "$1"
platform="${args[0]}" platform="${args[0]}"
version="${args[1]}" version="${args[1]}"
pyver=default
# check for explicit python version like 8.3@3.8
declare -a splitversion
IFS='@' read -ra splitversion <<< "$version"
if [ "${#splitversion[@]}" -gt 1 ]; then
version="${splitversion[0]}"
pyver="${splitversion[1]}"
fi
if [ "${#args[@]}" -gt 2 ]; then if [ "${#args[@]}" -gt 2 ]; then
target="azp/posix/${args[2]}/" target="azp/posix/${args[2]}/"
@ -22,4 +32,4 @@ provider="${P:-default}"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \ ansible-test integration --color -v --retry-on-error "${target}" ${COVERAGE:+"$COVERAGE"} ${CHANGED:+"$CHANGED"} ${UNSTABLE:+"$UNSTABLE"} \
--remote "${platform}/${version}" --remote-terminate always --remote-stage "${stage}" --remote-provider "${provider}" --python "${pyver}" --remote "${platform}/${version}" --remote-terminate always --remote-stage "${stage}" --remote-provider "${provider}"

View File

@ -0,0 +1 @@
remote.sh