Skip to content

Commit

Permalink
Enable packit CI and create CI plan
Browse files Browse the repository at this point in the history
  • Loading branch information
Koncpa committed Feb 4, 2025
1 parent e89b835 commit a5f86d2
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 9 deletions.
18 changes: 18 additions & 0 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
jobs:
- job: tests
trigger: pull_request
branch: master
targets:
- fedora-rawhide
- fedora-stable
- centos-stream-10-x86_64
skip_build: true
tf_extra_params:
test:
tmt:
name: "/Plans/ci"
environments:
- tmt:
context:
target_PR_branch: master
11 changes: 6 additions & 5 deletions Library/common/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -259,8 +259,10 @@ int main()
return 0;
}
EOF
rlRun "chmod 644 ~/rpmbuild/SOURCES/fapTestProgram.c"

cat > ~/rpmbuild/SPECS/fapTestPackage.spec << EOS

cat > ~/rpmbuild/SPECS/fapTestPackage.spec << 'EOS'
Name: fapTestPackage
Version: 1
Release: 1
Expand All @@ -274,7 +276,7 @@ This is RPM package, containing just a testing script.
# let's skip this for now
%build
gcc -o fapTestProgram ../SOURCES/fapTestProgram.c
gcc -o fapTestProgram %{_sourcedir}/fapTestProgram.c
%install
mkdir -p %{buildroot}/usr/local/bin/
Expand All @@ -283,10 +285,9 @@ install -m 755 fapTestProgram %{buildroot}/usr/local/bin/fapTestProgram
%files
/usr/local/bin/fapTestProgram
#scriptlet
%changelog
# let's skip this for now
* Fri Jan 31 2025 Fapolicyd User <fapolicyd.testing@example.com> - 1.0-1
- Initial package
EOS
}

Expand Down
17 changes: 17 additions & 0 deletions Plans/ci.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
summary: test plan for fapolicyd upstream testing


prepare:
- how: shell
script:
- systemctl disable --now dnf-makecache.service || true
- systemctl disable --now dnf-makecache.timer || true
- dnf makecache

discover:
- name: Upstream_tests_fapolicyd
how: fmf
filter: tag:CI-Tier-1

execute:
how: tmt
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ EOF
rlPhaseStartTest "system instalability" && {
YUM=`which yum` || YUM=`which dnf`
rlRun "mkdir installroot"
rlRun "$YUM -y --nogpgcheck --setopt=skip_if_unavailable=1 --installroot=$PWD/installroot install fapolicyd"
RELEASEVER=$(rpm -E %fedora || rpm -E %rhel)
# Run the yum command with the dynamically determined release version
if rlIsFedora '>=40' ; then
rlRun "$YUM -y --nogpgcheck --setopt=skip_if_unavailable=1 --use-host-config --releasever=$RELEASEVER --installroot=$PWD/installroot install fapolicyd"
else
rlRun "$YUM -y --nogpgcheck --setopt=skip_if_unavailable=1 --installroot=$PWD/installroot install fapolicyd"
fi
rlPhaseEnd; }

rlPhaseStartCleanup && {
Expand Down
6 changes: 3 additions & 3 deletions Sanity/cli-options/runtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ rlJournalStart && {
rlRun "cp '$(rpm -qal | grep '\.pyc$' | head -n 1)' files/application_x-bytecode.python_.pyc"
rlRun "cp '$(rpm -qal | grep '\.so$' | grep -v libc | grep -v pthread | head -n 1)' files/application_x-sharedlib_non-libc.so"
rlRun "cp /bin/bash files/application_x-executable_bash"
if rlIsRHELLike ">=" 9.6 ; then
libc=$(rpm -ql glibc | grep -E '^(/usr)?/lib(64)?/libc\b.*\.so(\.[0-9]+)?$' | head -n1)
else
if rlIsRHELLike "=<" 9.6 ; then
libc=$(rpm -ql glibc | grep -E '^/lib(64)?/libc\b.*\.so(\.[0-9]+)?$' | head -n1)
else
libc=$(rpm -ql glibc | grep -E '^(/usr)?/lib(64)?/libc\b.*\.so(\.[0-9]+)?$' | head -n1)
fi
tcfChk "checking $libc for application/x-sharedlib" && {
echo -n "file's output: "; file --mime $libc
Expand Down
1 change: 1 addition & 0 deletions Sanity/dnf-yum-rpm-plugin/main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ require+:
- fapolicyd
- rpm-plugin-fapolicyd
- /usr/bin/time
- rpm-devel
duration: 25m
enabled: true
tag:
Expand Down
1 change: 1 addition & 0 deletions main.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ component:
require:
- name: /Library/common
url: https://github.com/RedHat-SP-Security/fapolicyd-tests
ref: pk_enable_packit
type: library
- fapolicyd
recommend:
Expand Down

0 comments on commit a5f86d2

Please sign in to comment.