From 212d044793b8999c6614384811b7e79e720e9561 Mon Sep 17 00:00:00 2001 From: Ahmed Abdelhalim Date: Sat, 13 Dec 2025 15:04:29 +0100 Subject: Fix testing archlinux (gnome/hyprland conflict) Since the setup is intended to use either gnome or hyprland on archlinux but not both on the same machine to avoid complicated and unexpected behavior. This splits the testing of archlinux into 2 different branches for each of the desktop environments --- .github/workflows/ci.yml | 2 + molecule/archlinux-gnome/Dockerfile.j2 | 23 ++++++++++ molecule/archlinux-gnome/converge.yml | 76 ++++++++++++++++++++++++++++++++++ molecule/archlinux-gnome/molecule.yml | 51 +++++++++++++++++++++++ molecule/archlinux/converge.yml | 2 - 5 files changed, 152 insertions(+), 2 deletions(-) create mode 100644 molecule/archlinux-gnome/Dockerfile.j2 create mode 100644 molecule/archlinux-gnome/converge.yml create mode 100644 molecule/archlinux-gnome/molecule.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef5fd27b..2ee6fcde 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,6 +32,8 @@ jobs: molecule_distro: - name: archlinux runs_on: "ubuntu-latest" + - name: archlinux-gnome + runs_on: "ubuntu-latest" - name: ubuntu runs_on: "ubuntu-latest" - name: debian diff --git a/molecule/archlinux-gnome/Dockerfile.j2 b/molecule/archlinux-gnome/Dockerfile.j2 new file mode 100644 index 00000000..3dc35f2d --- /dev/null +++ b/molecule/archlinux-gnome/Dockerfile.j2 @@ -0,0 +1,23 @@ +FROM docker.io/library/archlinux + +ENV container docker + +RUN pacman -Syu --noconfirm --needed python3 systemd udev \ + && pacman -Scc --noconfirm + +RUN (cd /lib/systemd/system/sysinit.target.wants/; \ + for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \ + rm -f /lib/systemd/system/multi-user.target.wants/*;\ + rm -f /etc/systemd/system/*.wants/*;\ + rm -f /lib/systemd/system/local-fs.target.wants/*; \ + rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \ + rm -f /lib/systemd/system/basic.target.wants/*;\ + rm -f /lib/systemd/system/anaconda.target.wants/*; + +# Workaround archlinux not including any non-indo-european locales +# https://gitlab.archlinux.org/archlinux/archlinux-docker/-/issues/59 +RUN cp -r /usr/share/i18n/locales/en_US /usr/share/i18n/locales/de_DE; + +VOLUME ["/sys/fs/cgroup"] + +CMD ["/lib/systemd/systemd"] diff --git a/molecule/archlinux-gnome/converge.yml b/molecule/archlinux-gnome/converge.yml new file mode 100644 index 00000000..c8a6c9ed --- /dev/null +++ b/molecule/archlinux-gnome/converge.yml @@ -0,0 +1,76 @@ +--- +- name: "Bootstrap" + hosts: "archlinux-gnome" + gather_facts: true + environment: + PATH: "{{ ansible_env.HOME }}/.local/bin:{{ ansible_env.PATH }}" + vars: + ansible_become_method: su + user_public_keys: + - "ssh-ed25519 AAAA...fMo" + - "ssh-rsa AAAA...4I3" + user_groups: ["wheel", "test_group"] + roles: + - role: "hostname" + - role: "network" + - role: "user" + - role: "ssh" + - role: "password_policy" + tasks: + - name: "Configure passwordless sudo for testing" + ansible.builtin.copy: + content: "%test_group ALL=(ALL) NOPASSWD: ALL\n" + dest: "/etc/sudoers.d/test_group" + mode: "0440" + validate: 'visudo -cf %s' + +- name: "Configure" + hosts: "archlinux-gnome" + gather_facts: true + remote_user: "{{ username }}" + environment: + PATH: "{{ ansible_env.HOME }}/.local/bin:{{ ansible_env.PATH }}" + vars: + ansible_become_method: sudo + ansible_is_chroot: false + locales: + - "en_US.UTF-8 UTF-8" + timezone: "GMT" + wireguard_autostart_connection: "" + gateway_enabled: true + gateway_local_ipv4_subnet: "10.0.0.0/24" + python_global_version: "3.13" + python_versions: + - "3.13" + vimrc_repo_url: "https://git.sr.ht/~a14m/.vim" + password_store_repo_url: "https://github.com/octocat/Spoon-Knife" + firefox_install_browserpass: true + firefox_install_passff: true + roles: + - role: "locales" + - role: "timezone" + - role: "jq" + - role: "yay" + - role: "wireguard" + - role: "gateway" + - role: "python" + - role: "go" + - role: "rust" + - role: "docker" + - role: "podman" + - role: "ansible" + - role: "nginx" + - role: "prometheus" + - role: "grafana" + - role: "gnome" + - role: "rsync" + - role: "gpg" + - role: "dotfiles" + - role: "vim" + - role: "neomutt" + - role: "password_store" + - role: "which" + - role: "firefox" + - role: "fonts" + - role: "alacritty" + - role: "ghostty" diff --git a/molecule/archlinux-gnome/molecule.yml b/molecule/archlinux-gnome/molecule.yml new file mode 100644 index 00000000..67532576 --- /dev/null +++ b/molecule/archlinux-gnome/molecule.yml @@ -0,0 +1,51 @@ +--- +role_name_check: 1 +dependency: + name: galaxy + options: + requirements-file: ../../requirements.yml + ignore-errors: true +driver: + name: podman +platforms: + - name: archlinux-gnome + image: archlinux + dockerfile: Dockerfile.j2 + platform: "linux/amd64" + pre_build_image: false + privileged: true + command: ${MOLECULE_COMMAND:-"/lib/systemd/systemd"} + tmpfs: + "/tmp": "rw" + "/run": "rw,exec" + volumes: + - "/sys/fs/cgroup:/sys/fs/cgroup:rw" + cgroupns_mode: host + +provisioner: + name: ansible + inventory: + links: + host_vars: "../../host_vars/" + group_vars: "../../group_vars/" + env: + ANSIBLE_ROLES_PATH: "../../roles" + config_options: + defaults: + callback_result_format: yaml + interpreter_python: /usr/bin/python3 + ssh_connection: + pipelining: true + playbooks: + converge: converge.yml +verifier: + name: ansible + +scenario: + test_sequence: + - destroy + - syntax + - create + - converge + - idempotence + - destroy diff --git a/molecule/archlinux/converge.yml b/molecule/archlinux/converge.yml index 25cd96ca..56d52922 100644 --- a/molecule/archlinux/converge.yml +++ b/molecule/archlinux/converge.yml @@ -62,7 +62,6 @@ - role: "nginx" - role: "prometheus" - role: "grafana" - - role: "gnome" - role: "rsync" - role: "gpg" - role: "dotfiles" @@ -74,5 +73,4 @@ - role: "fonts" - role: "alacritty" - role: "ghostty" - - role: "cage" - role: "hyprland" -- cgit v1.2.3