Skip to content

Commit

Permalink
Add Ubuntu Noble to test matrix (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
teddyphreak authored May 2, 2024
1 parent e7560c2 commit 280c867
Show file tree
Hide file tree
Showing 6 changed files with 255 additions and 176 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
net: '192.168.255.0/24'
- distro: 'focal'
net: '192.168.254.0/24'
- distro: 'noble'
net: '192.168.253.0/24'
steps:
- name: Check out the codebase.
uses: actions/checkout@v4
Expand Down
14 changes: 2 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ GITHUB_REPOSITORY ?= $$(git config --get remote.origin.url | cut -d: -f 2 | cut
GITHUB_ORG = $$(echo ${GITHUB_REPOSITORY} | cut -d/ -f 1)
GITHUB_REPO = $$(echo ${GITHUB_REPOSITORY} | cut -d/ -f 2)
REQUIREMENTS = requirements.yml
UBUNTU_DISTRO ?= jammy
UBUNTU_DISTRO ?= noble
UBUNTU_SHASUMS = https://releases.ubuntu.com/${UBUNTU_DISTRO}/SHA256SUMS
UBUNTU_MIRROR = $$(dirname ${UBUNTU_SHASUMS})
UBUNTU_ISO = $$(curl -s ${UBUNTU_SHASUMS} | grep "live-server-amd64" | awk '{print $$2}' | sed -e 's/\*//g')
Expand All @@ -21,23 +21,13 @@ test: lint
install:
@type poetry >/dev/null || pip3 install poetry
@sudo apt-get install -y libvirt-dev
@poetry install
@poetry install --no-root

lint: install
poetry run yamllint .
poetry run ansible-lint .
poetry run molecule syntax

roles:
[ -f ${REQUIREMENTS} ] && yq '.$@[] | .name' -r < ${REQUIREMENTS} \
| xargs -L1 poetry run ansible-galaxy role install --force || exit 0

collections:
[ -f ${REQUIREMENTS} ] && yq '.$@[]' -r < ${REQUIREMENTS} \
| xargs -L1 echo poetry run ansible-galaxy -vvv collection install --force || exit 0

requirements: roles collections

dependency create prepare converge idempotence side-effect verify destroy login reset:
MOLECULE_DISTRO=${UBUNTU_DISTRO} \
MOLECULE_ISO=${UBUNTU_MIRROR}/${UBUNTU_ISO} \
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,12 @@ Images are tested by provisioning kvm guests on github actions large runners

Please make sure your environment has [docker](https://www.docker.com) installed in order to run role validation tests. Additional python dependencies are listed in the [requirements file](/requirements.txt)

Role is tested from an Ansible controller running Ubuntu Focal. Target iso flavors are:
Role is tested using Github Actions running Ubuntu Focal. Target iso flavors are:
* Ubuntu Focal
* Ubuntu Jammy
* Ubuntu Noble

It's designed to work on a controller running any recent Ubuntu release (Bionic/Focal)
It's designed to work on a controller running any recent Ubuntu release

You can test the role directly from sources using command ` molecule test `. Note that this will reconfigure networking for network 192.168.255.0/24 which will be directly connected to a local bridge interface

Expand Down
18 changes: 5 additions & 13 deletions molecule/default/verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,26 +173,18 @@
ansible.builtin.command: "qemu-nbd -f raw -c /dev/nbd{{ disk_index }} {{ debug_disk }}"

- name: Query NBD mount target
ansible.builtin.command: "fdisk -l /dev/nbd{{ disk_index }}"
ansible.builtin.command: "sfdisk --json /dev/nbd{{ disk_index }}"
register: fdisk_nbd

- name: Set NBD partition facts
ansible.builtin.set_fact:
nbd_partition: "{{ (fdisk_nbd.stdout_lines | last).split(' ') | first }}"

- name: Mount guest image file
ansible.posix.mount:
path: "{{ debug_hostdir }}"
src: "{{ (fdisk_nbd.stdout_lines | last).split(' ') | first }}"
fstype: ext4
state: ephemeral

- name: Mount guest image file
ansible.posix.mount:
path: "{{ debug_hostdir }}"
src: "{{ nbd_partition }}"
src: "{{ nbd_partition.node }}"
fstype: ext4
state: ephemeral
vars:
nbd_partition: "{{ nbd_data.partitiontable.partitions | last }}"
nbd_data: "{{ fdisk_nbd.stdout | from_json }}"

- name: Query guest installation files
ansible.builtin.find:
Expand Down
Loading

0 comments on commit 280c867

Please sign in to comment.