Skip to content

[1.2] ci fixes (ssh-keygen and criu version bumps for almalinux 8 and fedora) #4742

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

Merged
merged 8 commits into from
Apr 23, 2025

Conversation

kolyshkin
Copy link
Contributor

@kolyshkin kolyshkin commented Apr 23, 2025

This is a backport of

to release-1.2 branch. Original description follows.


(from #4670)

High level overview:

  • bump shfmt and shellcheck;
  • get rid of some "shellcheck disable" annotations;
    - bump bats to v0.11.0 so we use the same version everywhere. (not applied)

(from #4728)

We are seeing a ton on flakes on almalinux-8 CI job, all caused by criu inability to freeze a cgroup. This was worked around in criu (Freeze fixes and v1 kludges checkpoint-restore/criu#2545), but obviously we can't rely on a distro vendor to update the package.
Let's use a copr (thanks to @adrianreber!)

Fixes: #4273

ssh-keygen stopped working in AlmaLinux 8, fix this as well (see commit for details).

Fixes: #4731


(from #4736)

Package criu-4.1-1 has a known bug 1 which is fixed in criu-4.1-2 2,
which is currently only available in updates-testing. Add a kludge to
install newer criu if necessary to fix CI.

This will not be needed in ~2 weeks once the new package is promoted to
updates.

Signed-off-by: Kir Kolyshkin <[email protected]>
(cherry picked from commit 6e5ffb7)
Signed-off-by: Kir Kolyshkin <[email protected]>
Signed-off-by: Kir Kolyshkin <[email protected]>
(cherry picked from commit b48dd65)
Signed-off-by: Kir Kolyshkin <[email protected]>
Those are no longer needed with shellcheck v0.10.0 (possibly with an
earlier version, too, but I am too lazy to check that).

While at it, fix a typo in the comment.

Signed-off-by: Kir Kolyshkin <[email protected]>
(cherry picked from commit af386d1)
Signed-off-by: Kir Kolyshkin <[email protected]>
1. There is no need to have -p option in mkdir here, since
   /home/rootless was already created by useradd above.

2. When there is no -p, there is no need to suppress the shellcheck
   warning (which looked like this):

> In script/setup_host_fedora.sh line 21:
> mkdir -m 0700 -p /home/rootless/.ssh
>       ^-- SC2174 (warning): When used with -p, -m only applies to the deepest directory.

Signed-off-by: Kir Kolyshkin <[email protected]>
(cherry picked from commit a76a136)
Signed-off-by: Kir Kolyshkin <[email protected]>
This makes the code more robust and allows to remove the
"shellcheck disable=SC2086" annotation.

Signed-off-by: Kir Kolyshkin <[email protected]>
(cherry picked from commit 8e653e4)
Signed-off-by: Kir Kolyshkin <[email protected]>
We are seeing a ton on flakes on almalinux-8 CI job, all caused by criu
inability to freeze a cgroup. This was worked around in criu [1], but
obviously we can't rely on a distro vendor to update the package.

Let's use a copr (thanks to Adrian Reber!)

[1]: checkpoint-restore/criu#2545

Signed-off-by: Kir Kolyshkin <[email protected]>
(cherry picked from commit b520f75)
Signed-off-by: Kir Kolyshkin <[email protected]>
For some reason, ssh-keygen is unable to write to /root even as root on
AlmaLinux 8:

	# id
	uid=0(root) gid=0(root) groups=0(root) context=system_u:system_r:initrc_t:s0
	# id -Z
	ls -ld /root
	# ssh-keygen -t ecdsa -N "" -f /root/rootless.key || cat /var/log/audit/audit.log
	Saving key "/root/rootless.key" failed: Permission denied

The audit.log shows:

> type=AVC msg=audit(1744834995.352:546): avc:  denied  { dac_override } for  pid=13471 comm="ssh-keygen" capability=1  scontext=system_u:system_r:ssh_keygen_t:s0 tcontext=system_u:system_r:ssh_keygen_t:s0 tclass=capability permissive=0
> type=SYSCALL msg=audit(1744834995.352:546): arch=c000003e syscall=257 success=no exit=-13 a0=ffffff9c a1=5641c7587520 a2=241 a3=180 items=0 ppid=4978 pid=13471 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="ssh-keygen" exe="/usr/bin/ssh-keygen" subj=system_u:system_r:ssh_keygen_t:s0 key=(null)␝ARCH=x86_64 SYSCALL=openat AUID="unset" UID="root" GID="root" EUID="root" SUID="root" FSUID="root" EGID="root" SGID="root" FSGID="root"

A workaround is to use /root/.ssh directory instead of just /root.

While at it, let's unify rootless user and key setup into a single place.

Signed-off-by: Kir Kolyshkin <[email protected]>
(cherry picked from commit 87ae2f8)
Signed-off-by: Kir Kolyshkin <[email protected]>
@kolyshkin kolyshkin changed the base branch from main to release-1.2 April 23, 2025 02:29
@kolyshkin kolyshkin changed the title [1.2] [1.2] ci fixes (ssh-keygen and criu version bump for almalinux 8) Apr 23, 2025
@kolyshkin kolyshkin added the backport/1.2-pr A backport PR to release-1.2 label Apr 23, 2025
@kolyshkin kolyshkin added this to the 1.2.7 milestone Apr 23, 2025
@kolyshkin kolyshkin changed the title [1.2] ci fixes (ssh-keygen and criu version bump for almalinux 8) [1.2] ci fixes (ssh-keygen and criu version bumps for almalinux 8 and fedora) Apr 23, 2025
Package criu-4.1-1 has a known bug [1] which is fixed in criu-4.1-2 [2],
which is currently only available in updates-testing. Add a kludge to
install newer criu if necessary to fix CI.

This will not be needed in ~2 weeks once the new package is promoted to
updates.

[1]: checkpoint-restore/criu#2650
[2]: https://bodhi.fedoraproject.org/updates/FEDORA-2025-d374d8ce17

Signed-off-by: Kir Kolyshkin <[email protected]>
(cherry picked from commit 3e3e048)
Signed-off-by: Kir Kolyshkin <[email protected]>
@kolyshkin kolyshkin marked this pull request as ready for review April 23, 2025 03:00
@lifubang lifubang merged commit 948cefe into opencontainers:release-1.2 Apr 23, 2025
35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.2-pr A backport PR to release-1.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] Saving key "/root/rootless.key" failed: Permission denied flaky tests: TestUsernsCheckpoint, TestCheckpoint
3 participants