From f90058573923618dfca655e5c62a7733f2288c69 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Fri, 15 Nov 2024 21:49:23 +0100 Subject: [PATCH 1/3] test/system: Enable 102-list.bats on Arch Linux This is a step towards running the CI on Arch Linux. https://github.com/containers/toolbox/issues/1438 --- test/system/102-list.bats | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/system/102-list.bats b/test/system/102-list.bats index 9876c3dd8..b37093d33 100644 --- a/test/system/102-list.bats +++ b/test/system/102-list.bats @@ -400,7 +400,7 @@ teardown() { if [ "$system_id" = "fedora" ]; then assert_line --index 1 --partial "registry.fedoraproject.org/fedora-toolbox:34" assert_line --index 2 --partial "$default_image" - elif [ "$system_id" = "ubuntu" ]; then + elif [ "$system_id" = "arch" ] || [ "$system_id" = "ubuntu" ]; then assert_line --index 1 --partial "$default_image" assert_line --index 2 --partial "registry.fedoraproject.org/fedora-toolbox:34" else @@ -415,7 +415,7 @@ teardown() { assert_success - if [ "$system_id" = "fedora" ]; then + if [ "$system_id" = "arch" ] || [ "$system_id" = "fedora" ]; then assert_line --index 1 --partial "$default_container" assert_line --index 2 --partial "non-default-one" assert_line --index 3 --partial "non-default-two" @@ -438,14 +438,14 @@ teardown() { if [ "$system_id" = "fedora" ]; then assert_line --index 1 --partial "registry.fedoraproject.org/fedora-toolbox:34" assert_line --index 2 --partial "$default_image" - elif [ "$system_id" = "ubuntu" ]; then + elif [ "$system_id" = "arch" ] || [ "$system_id" = "ubuntu" ]; then assert_line --index 1 --partial "$default_image" assert_line --index 2 --partial "registry.fedoraproject.org/fedora-toolbox:34" else fail "Define output for $system_id" fi - if [ "$system_id" = "fedora" ]; then + if [ "$system_id" = "arch" ] || [ "$system_id" = "fedora" ]; then assert_line --index 5 --partial "$default_container" assert_line --index 6 --partial "non-default-one" assert_line --index 7 --partial "non-default-two" @@ -484,7 +484,7 @@ teardown() { if [ "$system_id" = "fedora" ]; then assert_line --index 2 --partial "registry.fedoraproject.org/fedora-toolbox:34" assert_line --index 3 --partial "$default_image" - elif [ "$system_id" = "ubuntu" ]; then + elif [ "$system_id" = "arch" ] || [ "$system_id" = "ubuntu" ]; then assert_line --index 2 --partial "$default_image" assert_line --index 3 --partial "registry.fedoraproject.org/fedora-toolbox:34" else @@ -514,7 +514,7 @@ teardown() { if [ "$system_id" = "fedora" ]; then assert_line --index 2 --partial "registry.fedoraproject.org/fedora-toolbox:34" assert_line --index 3 --partial "$default_image" - elif [ "$system_id" = "ubuntu" ]; then + elif [ "$system_id" = "arch" ] || [ "$system_id" = "ubuntu" ]; then assert_line --index 2 --partial "$default_image" assert_line --index 3 --partial "registry.fedoraproject.org/fedora-toolbox:34" else From b378596b1424caf6b2d3c268d0a6f675065e05d2 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Mon, 18 Nov 2024 19:04:10 +0100 Subject: [PATCH 2/3] test/system: Try to handle /etc/resolv.conf on host as absolute symlink Some Arch Linux hosts have /etc/resolv.conf as an absolute symbolic link to /run/systemd/resolve/stub-resolv.conf, instead of being a relative symbolic link to ../run/systemd/resolve/stub-resolv.conf or a regular file. eg., the images built by arch-boxes [1]. This changes the target that the Toolbx container's /etc/resolv.conf points at and confuses the tests [2]. Ideally, these host operating systems should be fixed to use relative symbolic links. This is highlighted by skipping the tests, because there's no point in failing them until that happens. This is a step towards running the CI on Arch Linux. [1] https://gitlab.archlinux.org/archlinux/arch-boxes https://geo.mirror.pkgbuild.com/images/latest/ [2] Commit 88a95b07af335be2 https://github.com/containers/toolbox/commit/88a95b07af335be2 https://github.com/containers/toolbox/issues/187 https://github.com/containers/toolbox/issues/1438 --- test/system/203-network.bats | 56 +++++++++++++++++++++++++++++++----- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/test/system/203-network.bats b/test/system/203-network.bats index 4f484f52d..e29cdeab4 100644 --- a/test/system/203-network.bats +++ b/test/system/203-network.bats @@ -69,7 +69,13 @@ teardown() { run --keep-empty-lines --separate-stderr "$TOOLBX" run readlink /etc/resolv.conf assert_success - assert_line --index 0 "/run/host/etc/resolv.conf" + + if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then + skip "host has absolute symlink" + else + assert_line --index 0 "/run/host/etc/resolv.conf" + fi + assert [ ${#lines[@]} -eq 1 ] # shellcheck disable=SC2154 @@ -83,7 +89,13 @@ teardown() { run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro arch readlink /etc/resolv.conf assert_success - assert_line --index 0 "/run/host/etc/resolv.conf" + + if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then + skip "host has absolute symlink" + else + assert_line --index 0 "/run/host/etc/resolv.conf" + fi + assert [ ${#lines[@]} -eq 1 ] # shellcheck disable=SC2154 @@ -97,7 +109,13 @@ teardown() { run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro fedora --release 34 readlink /etc/resolv.conf assert_success - assert_line --index 0 "/run/host/etc/resolv.conf" + + if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then + skip "host has absolute symlink" + else + assert_line --index 0 "/run/host/etc/resolv.conf" + fi + assert [ ${#lines[@]} -eq 1 ] # shellcheck disable=SC2154 @@ -111,7 +129,13 @@ teardown() { run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro rhel --release 8.10 readlink /etc/resolv.conf assert_success - assert_line --index 0 "/run/host/etc/resolv.conf" + + if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then + skip "host has absolute symlink" + else + assert_line --index 0 "/run/host/etc/resolv.conf" + fi + assert [ ${#lines[@]} -eq 1 ] # shellcheck disable=SC2154 @@ -125,7 +149,13 @@ teardown() { run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro ubuntu --release 16.04 readlink /etc/resolv.conf assert_success - assert_line --index 0 "/run/host/etc/resolv.conf" + + if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then + skip "host has absolute symlink" + else + assert_line --index 0 "/run/host/etc/resolv.conf" + fi + assert [ ${#lines[@]} -eq 1 ] # shellcheck disable=SC2154 @@ -139,7 +169,13 @@ teardown() { run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro ubuntu --release 18.04 readlink /etc/resolv.conf assert_success - assert_line --index 0 "/run/host/etc/resolv.conf" + + if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then + skip "host has absolute symlink" + else + assert_line --index 0 "/run/host/etc/resolv.conf" + fi + assert [ ${#lines[@]} -eq 1 ] # shellcheck disable=SC2154 @@ -153,7 +189,13 @@ teardown() { run --keep-empty-lines --separate-stderr "$TOOLBX" run --distro ubuntu --release 20.04 readlink /etc/resolv.conf assert_success - assert_line --index 0 "/run/host/etc/resolv.conf" + + if [ "${lines[0]}" = "/run/host/run/systemd/resolve/stub-resolv.conf" ]; then + skip "host has absolute symlink" + else + assert_line --index 0 "/run/host/etc/resolv.conf" + fi + assert [ ${#lines[@]} -eq 1 ] # shellcheck disable=SC2154 From 4d7244363272e2163faf26c3aa324b1dcfa39425 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Tue, 5 Nov 2024 18:35:51 +0100 Subject: [PATCH 3/3] .zuul, playbooks: Run the CI on Arch Linux https://github.com/containers/toolbox/issues/1438 --- .github/CODEOWNERS | 1 + .zuul.yaml | 42 +++++++++++++++++++++ playbooks/arch/dependencies.yaml | 65 ++++++++++++++++++++++++++++++++ playbooks/arch/setup.yaml | 25 ++++++++++++ 4 files changed, 133 insertions(+) create mode 100644 playbooks/arch/dependencies.yaml create mode 100644 playbooks/arch/setup.yaml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 481c0e531..9bbdaac42 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -7,3 +7,4 @@ /images/arch @Foxboron /images/rhel @debarshiray @olivergs /images/ubuntu @Jmennius +/playbooks/arch @Foxboron diff --git a/.zuul.yaml b/.zuul.yaml index f52971248..f0dce0fc1 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -48,6 +48,39 @@ pre-run: playbooks/setup-env-restricted.yaml run: playbooks/unit-test.yaml +- job: + name: system-test-arch-commands-options + description: Run Toolbx's commands-options system tests on Arch Linux + timeout: 6300 + nodeset: + nodes: + - name: arch + label: arch-linux + pre-run: playbooks/arch/setup.yaml + run: playbooks/system-test-commands-options.yaml + +- job: + name: system-test-arch-runtime-environment-arch-fedora + description: Run Toolbx's (arch-fedora,runtime-environment) system tests on Arch Linux + timeout: 6300 + nodeset: + nodes: + - name: arch + label: arch-linux + pre-run: playbooks/arch/setup.yaml + run: playbooks/system-test-runtime-environment-arch-fedora.yaml + +- job: + name: system-test-arch-runtime-environment-ubuntu + description: Run Toolbx's (runtime-environment,ubuntu) system tests on Arch Linux + timeout: 6300 + nodeset: + nodes: + - name: arch + label: arch-linux + pre-run: playbooks/arch/setup.yaml + run: playbooks/system-test-runtime-environment-ubuntu.yaml + - job: name: system-test-fedora-rawhide-commands-options description: Run Toolbx's commands-options system tests in Fedora Rawhide @@ -183,6 +216,9 @@ - project: periodic: jobs: + - system-test-arch-commands-options + - system-test-arch-runtime-environment-arch-fedora + - system-test-arch-runtime-environment-ubuntu - system-test-fedora-rawhide-commands-options - system-test-fedora-rawhide-runtime-environment-arch-fedora - system-test-fedora-rawhide-runtime-environment-ubuntu @@ -200,6 +236,9 @@ - unit-test - unit-test-migration-path-for-coreos-toolbox - unit-test-restricted + - system-test-arch-commands-options + - system-test-arch-runtime-environment-arch-fedora + - system-test-arch-runtime-environment-ubuntu - system-test-fedora-rawhide-commands-options - system-test-fedora-rawhide-runtime-environment-arch-fedora - system-test-fedora-rawhide-runtime-environment-ubuntu @@ -217,6 +256,9 @@ - unit-test - unit-test-migration-path-for-coreos-toolbox - unit-test-restricted + - system-test-arch-commands-options + - system-test-arch-runtime-environment-arch-fedora + - system-test-arch-runtime-environment-ubuntu - system-test-fedora-rawhide-commands-options - system-test-fedora-rawhide-runtime-environment-arch-fedora - system-test-fedora-rawhide-runtime-environment-ubuntu diff --git a/playbooks/arch/dependencies.yaml b/playbooks/arch/dependencies.yaml new file mode 100644 index 000000000..ddd316c44 --- /dev/null +++ b/playbooks/arch/dependencies.yaml @@ -0,0 +1,65 @@ +# +# Copyright © 2024 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +- name: Install Arch Linux packages + become: yes + package: + name: + - apache + - bash-completion + - bats + - codespell + - crun + - fish + - flatpak + - gcc + - go + - go-md2man + - meson + - ninja + - openssl + - pkgconf + - podman + - shadow + - shellcheck + - skopeo + - systemd + - udisks2 + update_cache: "{{ true if zuul.attempts > 1 else false }}" + +- name: Download Go modules + command: go mod download -x + args: + chdir: '{{ zuul.project.src_dir }}/src' + +- name: Initialize Git submodules + command: git submodule init + args: + chdir: '{{ zuul.project.src_dir }}' + +- name: Update Git submodules + command: git submodule update + args: + chdir: '{{ zuul.project.src_dir }}' + +- name: Check versions of crucial packages + command: pacman --query bash bats codespell conmon containers-common crun flatpak gcc glibc go go-md2man linux podman shadow shellcheck skopeo + +- name: Show Podman version + command: podman version + +- name: Show Podman related system information + command: podman info --debug diff --git a/playbooks/arch/setup.yaml b/playbooks/arch/setup.yaml new file mode 100644 index 000000000..cf466dadf --- /dev/null +++ b/playbooks/arch/setup.yaml @@ -0,0 +1,25 @@ +# +# Copyright © 2021 – 2024 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +--- +- hosts: all + tasks: + - include_tasks: dependencies.yaml + + - name: Set up build directory + command: meson setup --fatal-meson-warnings builddir + args: + chdir: '{{ zuul.project.src_dir }}'