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

ci: Run cockpit tests in PRs #2

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions .copr/make-srpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@
set -eux

outdir="$1"; shift
mkdir -p "$outdir"

# when this is specified, build a source directory and skip the rpmbuild step
if [ "${1:-}" = "srcdir" ]; then
srcdir=1
fi

rootdir="$(realpath -m "$0/../..")"

Expand Down Expand Up @@ -45,6 +51,11 @@ cp "$expander_dir/macro-expander.sh" "$distgit_dir/macro-expander"
sed -i "s/%global commit [^ ]*$/%global commit $base_head_id/;
s/%{?dist}/.$base_date.$base_short_head_id%{?dist}/" "$distgit_dir/selinux-policy.spec"
rm -f "$distgit_dir/sources"
rpmbuild --define "_topdir $rpmbuild_dir" -bs "$distgit_dir/selinux-policy.spec"

cp "$rpmbuild_dir/SRPMS/"*.src.rpm "$outdir"
if [ -n "${srcdir:-}" ]; then
cp -r "$distgit_dir"/* "$outdir"
else
# full rpmbuild for copr
rpmbuild --define "_topdir $rpmbuild_dir" -bs "$distgit_dir/selinux-policy.spec"
cp "$rpmbuild_dir/SRPMS/"*.src.rpm "$outdir"
fi
1 change: 1 addition & 0 deletions .fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
29 changes: 0 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,3 @@ jobs:
- run: make -j $(nproc) policy
- run: make -j $(nproc) validate
- run: make -j $(nproc) container.pp
build-rpm:
runs-on: ubuntu-latest
container:
image: fedora:rawhide
options: --security-opt seccomp=unconfined
steps:
- run: dnf install --nogpgcheck -y make git-core rpm-build 'dnf-command(builddep)'
- uses: actions/checkout@v3
# https://github.blog/2022-04-12-git-security-vulnerability-announced/
- run: git config --global --add safe.directory "$PWD"
- run: make -C .copr srpm outdir="$PWD"
- name: Store the SRPM as an artifact
uses: actions/upload-artifact@v2
with:
name: srpm
path: "*.src.rpm"
- run: |
if grep -q rawhide /etc/os-release; then
tag=rawhide
else
tag='f$releasever-build'
fi
dnf builddep --nogpgcheck --repofrompath "koji,https://kojipkgs.fedoraproject.org/repos/$tag/latest/\$arch/" -y *.src.rpm
- run: rpmbuild --define "_topdir $PWD/rpmbuild" -rb *.src.rpm
- name: Store binary RPMs as artifacts
uses: actions/upload-artifact@v2
with:
name: rpms
path: rpmbuild/RPMS
31 changes: 31 additions & 0 deletions packit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# See https://packit.dev/docs/configuration/

specfile_path: tmp/rpm/selinux-policy.spec

actions:
post-upstream-clone:
- .copr/make-srpm.sh tmp/rpm srcdir
create-archive: sh -c 'ls tmp/rpm/selinux-policy*.tar.gz'

jobs:
- job: copr_build
trigger: pull_request
targets:
- fedora-development
- fedora-latest-stable

# run tests for packages which test SELinux policy well, see plans/ with `revdeps == yes`
- job: tests
identifier: revdeps
trigger: pull_request
targets:
- fedora-development
- fedora-latest-stable
tf_extra_params:
environments:
- artifacts:
- type: repository-file
id: https://copr.fedorainfracloud.org/coprs/g/cockpit/main-builds/repo/fedora-$releasever/group_cockpit-main-builds-fedora-$releasever.repo
tmt:
context:
revdeps: "yes"
30 changes: 30 additions & 0 deletions plans/cockpit.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# reverse dependency test for https://github.com/cockpit-project/cockpit
# if this fails in a non-obvious way, please contact the cockpit team in your PR for investigation:
# @martinpitt, @marusak, @jelly

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

discover:
how: fmf
url: https://github.com/cockpit-project/cockpit
ref: main
execute:
how: tmt

/basic:
summary: Run tests for basic packages
discover+:
test: /test/browser/basic

/network:
summary: Run tests for cockpit-networkmanager
discover+:
test: /test/browser/network

/optional:
summary: Run tests for optional packages
discover+:
test: /test/browser/optional
48 changes: 24 additions & 24 deletions policy/modules/system/getty.te
Original file line number Diff line number Diff line change
Expand Up @@ -44,27 +44,27 @@ ifdef(`enable_mls',`
#

# Use capabilities.
allow getty_t self:capability { dac_read_search dac_override chown setgid sys_resource sys_tty_config fowner fsetid };
dontaudit getty_t self:capability sys_tty_config;
allow getty_t self:process { getpgid setpgid getsession signal_perms };
allow getty_t self:fifo_file rw_fifo_file_perms;

read_files_pattern(getty_t, getty_etc_t, getty_etc_t)
read_lnk_files_pattern(getty_t, getty_etc_t, getty_etc_t)
files_etc_filetrans(getty_t, getty_etc_t,{ file dir })

allow getty_t getty_lock_t:file manage_file_perms;
files_lock_filetrans(getty_t, getty_lock_t, file)

allow getty_t getty_log_t:file manage_file_perms;
logging_log_filetrans(getty_t, getty_log_t, file)

allow getty_t getty_tmp_t:file manage_file_perms;
allow getty_t getty_tmp_t:dir manage_dir_perms;
files_tmp_filetrans(getty_t, getty_tmp_t, { file dir })

manage_files_pattern(getty_t, getty_var_run_t, getty_var_run_t)
files_pid_filetrans(getty_t, getty_var_run_t, file)
#allow getty_t self:capability { dac_read_search dac_override chown setgid sys_resource sys_tty_config fowner fsetid };
#dontaudit getty_t self:capability sys_tty_config;
#allow getty_t self:process { getpgid setpgid getsession signal_perms };
#allow getty_t self:fifo_file rw_fifo_file_perms;
#
#read_files_pattern(getty_t, getty_etc_t, getty_etc_t)
#read_lnk_files_pattern(getty_t, getty_etc_t, getty_etc_t)
#files_etc_filetrans(getty_t, getty_etc_t,{ file dir })
#
#allow getty_t getty_lock_t:file manage_file_perms;
#files_lock_filetrans(getty_t, getty_lock_t, file)
#
#allow getty_t getty_log_t:file manage_file_perms;
#logging_log_filetrans(getty_t, getty_log_t, file)
#
#allow getty_t getty_tmp_t:file manage_file_perms;
#allow getty_t getty_tmp_t:dir manage_dir_perms;
#files_tmp_filetrans(getty_t, getty_tmp_t, { file dir })
#
#manage_files_pattern(getty_t, getty_var_run_t, getty_var_run_t)
#files_pid_filetrans(getty_t, getty_var_run_t, file)

kernel_read_system_state(getty_t)
kernel_read_network_state(getty_t)
Expand Down Expand Up @@ -137,9 +137,9 @@ tunable_policy(`login_console_enabled',`
term_dontaudit_use_console(getty_t)
')

optional_policy(`
cockpit_read_pid_files(getty_t)
')
#optional_policy(`
# cockpit_read_pid_files(getty_t)
#')

optional_policy(`
hostname_exec(getty_t)
Expand Down
22 changes: 11 additions & 11 deletions policy/modules/system/hostname.te
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ role system_r types hostname_t;

# for setting the hostname
allow hostname_t self:process { sigchld sigkill sigstop signull signal };
allow hostname_t self:capability sys_admin;
allow hostname_t self:unix_stream_socket create_stream_socket_perms;
dontaudit hostname_t self:capability sys_tty_config;
#allow hostname_t self:capability sys_admin;
#allow hostname_t self:unix_stream_socket create_stream_socket_perms;
#dontaudit hostname_t self:capability sys_tty_config;

kernel_list_proc(hostname_t)
kernel_read_net_sysctls(hostname_t)
kernel_read_proc_symlinks(hostname_t)
kernel_read_network_state(hostname_t)
#kernel_list_proc(hostname_t)
#kernel_read_net_sysctls(hostname_t)
#kernel_read_proc_symlinks(hostname_t)
#kernel_read_network_state(hostname_t)

dev_read_sysfs(hostname_t)
# Early devtmpfs, before udev relabel
Expand All @@ -48,10 +48,10 @@ term_dontaudit_use_console(hostname_t)
term_use_all_inherited_terms(hostname_t)
term_use_usb_ttys(hostname_t)

init_use_fds(hostname_t)
init_use_script_fds(hostname_t)
init_use_script_ptys(hostname_t)
init_rw_inherited_script_tmp_files(hostname_t)
#init_use_fds(hostname_t)
#init_use_script_fds(hostname_t)
#init_use_script_ptys(hostname_t)
#init_rw_inherited_script_tmp_files(hostname_t)

logging_send_syslog_msg(hostname_t)

Expand Down
2 changes: 1 addition & 1 deletion policy/modules/system/init.te
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ gen_tunable(init_create_dirs, true)
## Allow init audit_control capability
## </p>
## </desc>
gen_tunable(init_audit_control, true)
gen_tunable(init_audit_control, false)

# used for direct running of init scripts
# by admin domains
Expand Down