From a28c6d5ad59f66154996ee60a0f9d90acda06884 Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Fri, 24 Jan 2025 11:40:11 +0100 Subject: [PATCH 1/2] misc: Separate Ansible tasks into a different file This way the tasks can be reused with import/include_tasks from a different playbook. --- misc/blivet-tasks.yml | 188 +++++++++++++++++++++++++++++ misc/install-test-dependencies.yml | 188 +---------------------------- 2 files changed, 191 insertions(+), 185 deletions(-) create mode 100644 misc/blivet-tasks.yml diff --git a/misc/blivet-tasks.yml b/misc/blivet-tasks.yml new file mode 100644 index 000000000..5e35a701c --- /dev/null +++ b/misc/blivet-tasks.yml @@ -0,0 +1,188 @@ +# ansible tasks for installing blivet dependencies, +# see install-test-dependencies.yml for usage + +--- +####### Fedora +- name: Install basic build tools (Fedora) + package: + state: present + name: + - make + - python3-ipython + when: ansible_distribution == 'Fedora' + +- name: Install dnf-plugins-core for dnf builddep (Fedora) + package: name=dnf-plugins-core state=present + when: ansible_distribution == 'Fedora' + +- name: Install build dependencies (Fedora) + command: "dnf -y builddep python3-blivet --nogpgcheck" + when: ansible_distribution == 'Fedora' + +- name: Install blivet to get all dependencies (Fedora) + package: name=python3-blivet state=present + when: ansible_distribution == 'Fedora' + +- name: Install test dependencies (Fedora) + package: + state: present + name: + - dosfstools + - e2fsprogs + - xfsprogs + - hfsplus-tools + - ntfsprogs + - python3-coverage + - python3-pocketlint + - python3-pycodestyle + - python3-pyudev + - python3-pyparted + - libselinux-python3 + - python3-blockdev + - python3-bytesize + - python3-libmount + - python3-libvirt + - python3-paramiko + - targetcli + - iscsi-initiator-utils + - gfs2-utils + - stratisd + - stratis-cli + - libblockdev-tools + when: ansible_distribution == 'Fedora' and test_dependencies|bool + +####### CentOS 9/10 +- name: Install basic build tools (CentOS) + package: name=make state=present + when: ansible_distribution == 'CentOS' + +- name: Enable EPEL repository (CentOS) + package: name=epel-release state=present + when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '9' + +- name: Install dnf-plugins-core for dnf config-manager and builddep (CentOS) + package: name=dnf-plugins-core state=present + when: ansible_distribution == 'CentOS' + +- name: Enable CRB repository (CentOS) + command: dnf config-manager --set-enabled crb + when: ansible_distribution == 'CentOS' + +- name: Install build dependencies (CentOS) + command: "dnf -y builddep python3-blivet --nogpgcheck" + when: ansible_distribution == 'CentOS' + +- name: Install blivet to get all dependencies (CentOS) + package: name=python3-blivet state=present + when: ansible_distribution == 'CentOS' + +- name: Install test dependencies (CentOS) + package: + state: present + name: + - dosfstools + - e2fsprogs + - xfsprogs + - python3-pyudev + - python3-pyparted + - libselinux-python3 + - python3-blockdev + - python3-bytesize + - python3-libmount + - python3-libvirt + - python3-pip + - targetcli + - iscsi-initiator-utils + - stratisd + - stratis-cli + - libblockdev-tools + when: ansible_distribution == 'CentOS' and test_dependencies|bool + +- name: Install additional test dependencies (CentOS 9) + package: + state: present + name: + - python3-coverage + - python3-pycodestyle + when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '9' and test_dependencies|bool + +- name: Install coverage and pycodestyle using pip (CentOS 10) + pip: + name: ['coverage', 'pycodestyle'] + when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '10' and test_dependencies|bool + +- name: Install paramiko using pip + pip: name=paramiko executable=pip3 + when: ansible_distribution == 'CentOS' and test_dependencies|bool + +- name: Install pocketlint using pip (CentOS) + pip: name=pocketlint executable=pip3 + when: ansible_distribution == 'CentOS' and test_dependencies|bool + +####### Debian/Ubuntu +- name: Update apt cache (Debian/Ubuntu) + apt: + update_cache: yes + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + +- name: Install basic build tools (Debian/Ubuntu) + package: name=make state=present + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + +- name: Install dependencies (Debian/Ubuntu) + package: + state: present + name: + - python3-blockdev + - libblockdev3 + - libblockdev-plugins-all + - gir1.2-blockdev-3.0 + - python3-bytesize + - python3-selinux + - python3-pyudev + - python3-parted + - lvm2-dbusd + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + +- name: Install test dependencies (Debian/Ubuntu) + package: + state: present + name: + - automake + - autopoint + - bison + - libtool + - pkg-config + - dosfstools + - e2fsprogs + - xfsprogs + - ntfs-3g + - python3-coverage + - python3-pycodestyle + - pycodestyle + - gettext + - python3-polib + - python3-paramiko + - python3-libvirt + - python3-pip + - targetcli-fb + - open-iscsi + - gfs2-utils + - libblockdev-tools + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' and test_dependencies|bool + +- name: Install libmount (Debian/Ubuntu) + block: + - name: Copy the libmount_deb script (Debian and CentOS non-x86_64) + copy: + src: files/libmount_deb.py + dest: "/tmp/libmount_deb.py" + mode: 0755 + + - name: Make and install libmount + shell: "python3 /tmp/libmount_deb.py" + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' + +- name: Install pocketlint using pip (Debian/Ubuntu) + pip: name=pocketlint executable=pip3 extra_args=--break-system-packages + when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' and test_dependencies|bool diff --git a/misc/install-test-dependencies.yml b/misc/install-test-dependencies.yml index 3a09f9da5..90ec001d0 100644 --- a/misc/install-test-dependencies.yml +++ b/misc/install-test-dependencies.yml @@ -2,7 +2,7 @@ # libblockdev test suite. # You can do this by using 'make install-requires' or manually using # 'ansible-playbook -K -i "localhost," -c local install-test-dependencies.yml' -# Currently only Fedora, CentOS 8 and Debian/Ubuntu are supported by this playbook. +# Currently only Fedora, CentOS and Debian/Ubuntu are supported by this playbook. --- - hosts: all @@ -11,187 +11,5 @@ test_dependencies: true # whether to install test dependencies or not tasks: -####### Fedora - - name: Install basic build tools (Fedora) - package: - state: present - name: - - make - - python3-ipython - when: ansible_distribution == 'Fedora' - - - name: Install dnf-plugins-core for dnf builddep (Fedora) - package: name=dnf-plugins-core state=present - when: ansible_distribution == 'Fedora' - - - name: Install build dependencies (Fedora) - command: "dnf -y builddep python3-blivet --nogpgcheck" - when: ansible_distribution == 'Fedora' - - - name: Install blivet to get all dependencies (Fedora) - package: name=python3-blivet state=present - when: ansible_distribution == 'Fedora' - - - name: Install test dependencies (Fedora) - package: - state: present - name: - - dosfstools - - e2fsprogs - - xfsprogs - - hfsplus-tools - - ntfsprogs - - python3-coverage - - python3-pocketlint - - python3-pycodestyle - - python3-pyudev - - python3-pyparted - - libselinux-python3 - - python3-blockdev - - python3-bytesize - - python3-libmount - - python3-libvirt - - python3-paramiko - - targetcli - - iscsi-initiator-utils - - gfs2-utils - - stratisd - - stratis-cli - - libblockdev-tools - when: ansible_distribution == 'Fedora' and test_dependencies|bool - -####### CentOS 9/10 - - name: Install basic build tools (CentOS) - package: name=make state=present - when: ansible_distribution == 'CentOS' - - - name: Enable EPEL repository (CentOS) - package: name=epel-release state=present - when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '9' - - - name: Install dnf-plugins-core for dnf config-manager and builddep (CentOS) - package: name=dnf-plugins-core state=present - when: ansible_distribution == 'CentOS' - - - name: Enable CRB repository (CentOS) - command: dnf config-manager --set-enabled crb - when: ansible_distribution == 'CentOS' - - - name: Install build dependencies (CentOS) - command: "dnf -y builddep python3-blivet --nogpgcheck" - when: ansible_distribution == 'CentOS' - - - name: Install blivet to get all dependencies (CentOS) - package: name=python3-blivet state=present - when: ansible_distribution == 'CentOS' - - - name: Install test dependencies (CentOS) - package: - state: present - name: - - dosfstools - - e2fsprogs - - xfsprogs - - python3-pyudev - - python3-pyparted - - libselinux-python3 - - python3-blockdev - - python3-bytesize - - python3-libmount - - python3-libvirt - - python3-pip - - targetcli - - iscsi-initiator-utils - - stratisd - - stratis-cli - - libblockdev-tools - when: ansible_distribution == 'CentOS' and test_dependencies|bool - - - name: Install additional test dependencies (CentOS 9) - package: - state: present - name: - - python3-coverage - - python3-pycodestyle - when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '9' and test_dependencies|bool - - - name: Install coverage and pycodestyle using pip (CentOS 10) - pip: - name: ['coverage', 'pycodestyle'] - when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '10' and test_dependencies|bool - - - name: Install paramiko using pip - pip: name=paramiko executable=pip3 - when: ansible_distribution == 'CentOS' and test_dependencies|bool - - - name: Install pocketlint using pip (CentOS) - pip: name=pocketlint executable=pip3 - when: ansible_distribution == 'CentOS' and test_dependencies|bool - -####### Debian/Ubuntu - - name: Update apt cache (Debian/Ubuntu) - apt: - update_cache: yes - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - - - name: Install basic build tools (Debian/Ubuntu) - package: name=make state=present - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - - - name: Install dependencies (Debian/Ubuntu) - package: - state: present - name: - - python3-blockdev - - libblockdev3 - - libblockdev-plugins-all - - gir1.2-blockdev-3.0 - - python3-bytesize - - python3-selinux - - python3-pyudev - - python3-parted - - lvm2-dbusd - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - - - name: Install test dependencies (Debian/Ubuntu) - package: - state: present - name: - - automake - - autopoint - - bison - - libtool - - pkg-config - - dosfstools - - e2fsprogs - - xfsprogs - - ntfs-3g - - python3-coverage - - python3-pycodestyle - - pycodestyle - - gettext - - python3-polib - - python3-paramiko - - python3-libvirt - - python3-pip - - targetcli-fb - - open-iscsi - - gfs2-utils - - libblockdev-tools - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' and test_dependencies|bool - - - name: Install libmount (Debian/Ubuntu) - block: - - name: Copy the libmount_deb script (Debian and CentOS non-x86_64) - copy: - src: files/libmount_deb.py - dest: "/tmp/libmount_deb.py" - mode: 0755 - - - name: Make and install libmount - shell: "python3 /tmp/libmount_deb.py" - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' - - - name: Install pocketlint using pip (Debian/Ubuntu) - pip: name=pocketlint executable=pip3 extra_args=--break-system-packages - when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu' and test_dependencies|bool + - name: Include tasks from blivet-tasks.yml + ansible.builtin.include_tasks: blivet-tasks.yml From 51f291fca4e6bee3ebd67b28f5956bc39b134880 Mon Sep 17 00:00:00 2001 From: Vojtech Trefny Date: Fri, 24 Jan 2025 12:23:05 +0100 Subject: [PATCH 2/2] ci: Manually download blivet-gui playbooks for revdeps tests The playbook is now split into a playbook and separate file with tasks. We need both and prepare cannot download two files. --- plans/blivet-gui.fmf | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plans/blivet-gui.fmf b/plans/blivet-gui.fmf index f073256a0..44a31339e 100644 --- a/plans/blivet-gui.fmf +++ b/plans/blivet-gui.fmf @@ -18,9 +18,12 @@ prepare: - if rpm -q amazon-ec2-utils; then rpm -e --verbose amazon-ec2-utils && udevadm trigger /dev/nvme* ;fi - name: ansible - how: ansible - playbook: - - https://raw.githubusercontent.com/storaged-project/blivet-gui/main/misc/install-test-dependencies.yml + how: shell + script: + - sudo dnf install -y curl ansible + - curl -Ok https://raw.githubusercontent.com/storaged-project/blivet-gui/main/misc/install-test-dependencies.yml + - curl -Ok https://raw.githubusercontent.com/storaged-project/blivet-gui/main/misc/blivet-gui-tasks.yml + - ansible-playbook -K -i "localhost," -c local install-test-dependencies.yml discover: how: shell