Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RHEL 10 branch CI #1283

Merged
1 change: 1 addition & 0 deletions .fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
5 changes: 4 additions & 1 deletion .github/workflows/anaconda_tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Run validation tests from Anaconda
on: pull_request
on:
pull_request:
branches:
- main

permissions:
contents: read
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/check-rhel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Static Analysis (RHEL)

on:
pull_request:
branches:
- rhel10-branch

jobs:
build:
name: static-analysis-rhel
runs-on: ubuntu-24.04
env:
CI_IMAGE: quay.io/centos/centos:stream10-development
CI_CONTAINER: blivet-tests
steps:
- name: Checkout libblockdev repository
uses: actions/checkout@v4

- name: Install podman
run: |
sudo apt -qq update
sudo apt -y -qq install podman

- name: Start the container
run: |
podman run -d -t --name ${{ env.CI_CONTAINER }} --privileged --volume "$(pwd):/app" --workdir "/app" ${{ env.CI_IMAGE }}

- name: Install ansible in the container
run: |
podman exec -it ${{ env.CI_CONTAINER }} bash -c "dnf -y install ansible-core make which"

- name: Install test dependencies in the container
run: |
podman exec -it ${{ env.CI_CONTAINER }} bash -c "ansible-playbook -i 'localhost,' -c local misc/install-test-dependencies.yml"

- name: Run static analysis tests in the container
run: |
podman exec -it ${{ env.CI_CONTAINER }} bash -c "make check"
70 changes: 62 additions & 8 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
actions:
post-upstream-clone:
# we need to set email and username for the merge commit
- 'git config user.email "[email protected]"'
- 'git config user.name "Blivet CI"'
# merge the release branch to get correct version in spec
- 'git merge --ff origin/3.10-release'
# bump release to 99 to always be ahead of Fedora builds
- 'bash -c "sed -i -r \"s/Release:(\s*)\S+/Release: 99%{?dist}/\" python-blivet.spec"'
get-current-version:
Expand All @@ -20,19 +15,78 @@ actions:
- bash -c "sed -i python-blivet.spec -e \"s/Release:.*/Release:\ ${PACKIT_RPMSPEC_RELEASE}%{?dist}/\""

jobs:
# Fedora builds for the 'main' branch
- job: copr_build
metadata:
targets:
targets:
- fedora-all
trigger: pull_request
branch: main

# CentOS 10 Stream builds for the 'rhel10-branch'
- job: copr_build
targets:
- centos-stream-10-x86_64
trigger: pull_request
branch: rhel10-branch

# Daily builds for Fedora from the 'main' branch
- job: copr_build
trigger: commit
owner: "@storage"
project: blivet-daily
branch: 3.10-devel
branch: main
preserve_project: true

# Fedora tests for the 'main' branch
- job: tests
trigger: pull_request
targets:
- fedora-latest-stable
branch: main

# CentOS 10 Stream tests for the 'rhel10-branch'
- job: tests
trigger: pull_request
targets:
- centos-stream-10-x86_64
branch: rhel10-branch

# Downstream builds
- job: propose_downstream
trigger: release
dist_git_branches:
- fedora-all

- job: koji_build
trigger: commit
dist_git_branches:
- fedora-all

- job: bodhi_update
trigger: commit
dist_git_branches:
- fedora-branched

# Reverse dependency tests
## run tests for udisks consumers, see plans/ with `revdeps == yes`
- job: tests
identifier: revdeps
trigger: pull_request
branch: main
notifications:
failure_comment:
message: "Blivet-GUI tests failed for commit {commit_sha}. @vojtechtrefny please check."
targets:
- fedora-latest-stable
tf_extra_params:
environments:
- artifacts:
- type: repository-file
id: https://copr.fedorainfracloud.org/coprs/g/storage/blivet-daily/repo/fedora-$releasever/group_storage-blivet-daily-fedora-$releasever.repo
tmt:
context:
revdeps: "yes"

srpm_build_deps:
- git
- make
Expand Down
2 changes: 2 additions & 0 deletions blivet/devicelibs/stratis.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ def set_key(key_desc, passphrase, key_file):
fd = read
elif key_file:
fd = os.open(key_file, os.O_RDONLY)
else:
raise RuntimeError("Passphrase or key file must be provided")

fd_list = Gio.UnixFDList()
fd_list.append(fd)
Expand Down
1 change: 1 addition & 0 deletions blivet/devicetree.py
Original file line number Diff line number Diff line change
Expand Up @@ -752,6 +752,7 @@ def resolve_device(self, devspec, blkid_tab=None, crypt_tab=None, options=None,
break
elif options:
attr = None
val = None
if "subvol=" in options:
attr = "name"
val = util.get_option_value("subvol", options)
Expand Down
2 changes: 2 additions & 0 deletions blivet/formats/luks.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ def add_passphrase(self, passphrase):
context = blockdev.CryptoKeyslotContext(passphrase=self.__passphrase)
elif self._key_file:
context = blockdev.CryptoKeyslotContext(keyfile=self._key_file)
else:
raise LUKSError("luks device not configured")

ncontext = blockdev.CryptoKeyslotContext(passphrase=passphrase)

Expand Down
2 changes: 2 additions & 0 deletions blivet/tasks/availability.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ def availability_errors(self, resource):
avail, _mode, utility = self.check_fn(self.fstype)
elif self.operation == FSOperation.MKFS:
avail, _options, utility = self.check_fn(self.fstype)
else:
raise RuntimeError("Unknown operation")
except blockdev.FSError as e:
return [str(e)]
if not avail:
Expand Down
2 changes: 2 additions & 0 deletions blivet/udev.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def get_device(sysfs_path=None, device_node=None):
device = pyudev.Devices.from_sys_path(global_udev, sysfs_path)
elif device_node is not None:
device = pyudev.Devices.from_device_file(global_udev, device_node)
else:
raise RuntimeError("At least one of 'sysfs_path' and 'device_node' must be specified")
except pyudev.DeviceNotFoundError as e:
log.error(e)
result = None
Expand Down
39 changes: 23 additions & 16 deletions misc/install-test-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,23 @@
- stratis-cli
when: ansible_distribution == 'Fedora' and test_dependencies|bool

####### CentOS 8/9
####### 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'

- name: Enable powertools repository (CentOS 8)
command: yum config-manager --set-enabled powertools
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '8'

- name: Enable CRB repository (CentOS 9)
command: yum config-manager --set-enabled crb
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '9'
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '9'

- name: Install dnf-plugins-core for dnf builddep (CentOS)
- 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'
Expand All @@ -95,8 +91,6 @@
- dosfstools
- e2fsprogs
- xfsprogs
- python3-coverage
- python3-pycodestyle
- python3-pyudev
- python3-pyparted
- libselinux-python3
Expand All @@ -109,12 +103,25 @@
- iscsi-initiator-utils
- stratisd
- stratis-cli
when: ansible_distribution == 'CentOS' and ansible_distribution_major_version == '8' and test_dependencies|bool
when: ansible_distribution == 'CentOS' and test_dependencies|bool

- name: Install paramiko using pip (not available in EPEL yet) (CentOS 9)
pip: name=paramiko executable=pip3
- 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
Expand Down
32 changes: 32 additions & 0 deletions plans/blivet-gui.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# reverse dependency test for blivet-gui
enabled: false

adjust+:
when: revdeps == yes
enabled: true

prepare:
- name: copr
how: shell
script:
- sudo dnf install -y 'dnf-command(copr)'
- sudo dnf copr enable -y @storage/blivet-daily
# TF prioritizes Fedora tag repo over all others, in particular our daily COPR
- for f in $(grep -l -r 'testing-farm-tag-repository' /etc/yum.repos.d); do sed -i '/priority/d' "$f" ;done
- sudo dnf -y update

- name: ansible
how: ansible
playbook:
- https://raw.githubusercontent.com/storaged-project/blivet-gui/main/misc/install-test-dependencies.yml

discover:
how: shell
url: https://github.com/storaged-project/blivet-gui
ref: main
tests:
- name: all
test: make test

execute:
how: tmt
16 changes: 16 additions & 0 deletions plans/tests-rhel.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
summary: Run tests

adjust+:
- when: revdeps == yes
enabled: false
- when: distro == fedora
enabled: false

prepare:
- name: ansible
how: ansible
playbook: misc/install-test-dependencies.yml

execute:
how: tmt
script: sudo make test
25 changes: 25 additions & 0 deletions plans/tests.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
summary: Run tests

adjust+:
- when: revdeps == yes
enabled: false
- when: distro == centos
enabled: false

prepare:
- name: copr
how: shell
script:
- sudo dnf install -y 'dnf-command(copr)'
- sudo dnf copr enable -y @storage/blivet-daily
# TF prioritizes Fedora tag repo over all others, in particular our daily COPR
- for f in $(grep -l -r 'testing-farm-tag-repository' /etc/yum.repos.d); do sed -i '/priority/d' "$f" ;done
- sudo dnf -y update

- name: ansible
how: ansible
playbook: misc/install-test-dependencies.yml

execute:
how: tmt
script: sudo make test
5 changes: 3 additions & 2 deletions tests/pylint/runpylint.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,11 @@ def __init__(self):
FalsePositive(r"Method 'do_task' is abstract in class 'UnimplementedTask' but is not overridden"),
FalsePositive(r"No value for argument 'member_count' in unbound method call$"),
FalsePositive(r"No value for argument 'smallest_member_size' in unbound method call$"),
FalsePositive(r"Bad option value '(subprocess-popen-preexec-fn|try-except-raise|environment-modify|arguments-renamed|redundant-u-string-prefix)'"),
FalsePositive(r"Bad option value '(subprocess-popen-preexec-fn|try-except-raise|environment-modify|arguments-renamed|redundant-u-string-prefix|possibly-used-before-assignment)'"),
FalsePositive(r"Instance of '(Action.*Device|Action.*Format|Action.*Member|Device|DeviceAction|DeviceFormat|Event|ObjectID|PartitionDevice|StorageDevice|BTRFS.*Device|LoopDevice)' has no 'id' member$"),
FalsePositive(r"Instance of 'GError' has no 'message' member"), # overriding currently broken local pylint disable
FalsePositive(r"No name '.*' in module 'libmount'")
FalsePositive(r"No name '.*' in module 'libmount'"),
FalsePositive(r"Unknown option value for 'disable', expected a valid pylint message and got 'possibly-used-before-assignment'")
]

def _files(self):
Expand Down
4 changes: 2 additions & 2 deletions tests/run_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,8 @@ def _should_skip(distro=None, version=None, arch=None, reason=None): # pylint:

# DISTRO, VERSION and ARCH variables are set in main, we don't need to
# call hostnamectl etc. for every test run
if ((distro is None or DISTRO in distro) and (version is None or VERSION in version) and # pylint: disable=used-before-assignment
(arch is None or ARCH in arch)): # pylint: disable=used-before-assignment
if ((distro is None or DISTRO in distro) and (version is None or VERSION in version) and # pylint: disable=used-before-assignment,possibly-used-before-assignment
(arch is None or ARCH in arch)): # pylint: disable=used-before-assignment,possibly-used-before-assignment
return True

return False
Expand Down