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

[DNM] ci/cirrus: run rootless tests on CentOS 7 #4068

Closed
wants to merge 2 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 0 additions & 7 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,4 @@ task:
ssh -tt localhost "make -C /home/runc localrootlessintegration RUNC_USE_SYSTEMD=yes"
esac
integration_fs_rootless_script: |
case $DISTRO in
centos-7)
echo "SKIP: FIXME: integration_fs_rootless_script is skipped because of EPERM on writing cgroup.procs"
;;
*)
ssh -tt localhost "make -C /home/runc localrootlessintegration"
;;
esac
29 changes: 29 additions & 0 deletions tests/rootless.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ features_powerset="$(powerset "${ALL_FEATURES[@]}")"
# rootless user won't be able to write to $TESTDATA.
"$ROOT"/tests/integration/get-images.sh >/dev/null

# If SELinux is enabled, fix runc's context.
if selinuxenabled 2>/dev/null; then
chcon -u system_u -r object_r -t container_runtime_exec_t runc
ls -lZ runc
fi

# Iterate over the powerset of all features.
IFS=:
idx=0
Expand All @@ -178,9 +184,17 @@ for enabled_features in $features_powerset; do
"$hook_func"
done

# Save the start date and time for ausearch.
if command -v ausearch &>/dev/null; then
AU_DD="$(date +%x)"
AU_TT="$(date +%H:%M:%S)"
fi

# Run the test suite!
echo "path: $PATH"
export ROOTLESS_FEATURES="$enabled_features"
# Allow the test to fail and use RET.
set +e
if [ -v RUNC_USE_SYSTEMD ]; then
# We use `ssh rootless@localhost` instead of `sudo -u rootless` for creating systemd user session.
# Alternatively we could use `machinectl shell`, but it is known not to work well on SELinux-enabled hosts as of April 2020:
Expand All @@ -189,5 +203,20 @@ for enabled_features in $features_powerset; do
else
sudo -HE -u rootless PATH="$PATH" "$(which bats)" -t "$ROOT/tests/integration$ROOTLESS_TESTPATH"
fi
RET=$?
set -e

# Show any avc denials.
if [[ -v AU_DD && -v AU_TT ]]; then
echo ===========================================
ausearch -ts "$AU_DD" "$AU_TT" -i -m avc || true
ls -lR /sys/fs/cgroup/*/runc-cgroups-integration-test
echo ===========================================
fi

cleanup
if [ $RET -ne 0 ]; then
echo "FAILED" >&2
exit $RET
fi
done