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: mount tmpfs for container storage #22831

Merged
merged 2 commits into from
Jul 4, 2024
Merged
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
3 changes: 3 additions & 0 deletions contrib/cirrus/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ setup_rootless() {
showrun groupadd -g $rootless_gid $ROOTLESS_USER
showrun useradd -g $rootless_gid -u $rootless_uid --no-user-group --create-home $ROOTLESS_USER

# use tmpfs to speed up IO
mount -t tmpfs -o size=75%,mode=0700,uid=$rootless_uid,gid=$rootless_gid none /home/$ROOTLESS_USER

echo "$ROOTLESS_USER ALL=(root) NOPASSWD: ALL" > /etc/sudoers.d/ci-rootless

mkdir -p "$HOME/.ssh" "/home/$ROOTLESS_USER/.ssh"
Expand Down
8 changes: 4 additions & 4 deletions contrib/cirrus/setup_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ runroot = "/run/containers/storage"
graphroot = "/var/lib/containers/storage"
EOF

# Since we've potentially changed important config settings, reset.
# This prevents `database graph driver "" does not match "overlay"`
# on Debian.
rm -rf /var/lib/containers/storage

# mount a tmpfs for the container storage to speed up the IO
# side effect is we clear all potentially pre existing data so we know we always start "clean"
mount -t tmpfs -o size=75%,mode=0700 none /var/lib/containers

# shellcheck disable=SC2154
showrun echo "Setting CI_DESIRED_STORAGE [=$CI_DESIRED_STORAGE] for *e2e* tests"
Expand Down
11 changes: 9 additions & 2 deletions test/system/160-volumes.bats
Original file line number Diff line number Diff line change
Expand Up @@ -534,8 +534,15 @@ EOF
CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --rm volume_image stat -f -c %T /data
is "$output" "tmpfs" "Should be tmpfs"

CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume anonymous --rm volume_image stat -f -c %T /data
assert "$output" != "tmpfs" "Should match hosts $fs"
# get the hostfs first so we can match it below
run_podman info --format {{.Store.GraphRoot}}
hostfs=$(stat -f -c %T $output)

# stat -f -c %T seems to just return unknown for our normal bind mount for some reason.
# Therfore manually parse /proc/mounts to get the real fs for the bind mount.
CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume anonymous --rm volume_image \
sh -c "grep ' /data ' /proc/mounts | cut -f3 -d' '"
assert "$output" == "$hostfs" "Should match hosts graphroot fs"

CONTAINERS_CONF_OVERRIDE="$containersconf" run_podman run --image-volume tmpfs --rm volume_image stat -f -c %T /data
is "$output" "tmpfs" "Should be tmpfs"
Expand Down