Skip to content

Commit

Permalink
cirrus CI tests: enforce TMPDIR on tmpfs
Browse files Browse the repository at this point in the history
First, setup a custom TMPDIR to ensure we have no special assumptions
about hard coded paths. Second, make sure it is actually on a tmpfs so
we can catch regressions in the VM setup immediately.

Signed-off-by: Paul Holzinger <[email protected]>
  • Loading branch information
Luap99 committed May 7, 2024
1 parent 03178a6 commit 64548eb
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion contrib/cirrus/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ EPOCH_TEST_COMMIT="$CIRRUS_BASE_SHA"
# contexts, such as host->container or root->rootless user
#
# List of envariables which must be EXACT matches
PASSTHROUGH_ENV_EXACT='CGROUP_MANAGER|DEST_BRANCH|DISTRO_NV|GOCACHE|GOPATH|GOSRC|NETWORK_BACKEND|OCI_RUNTIME|PODMAN_IGNORE_CGROUPSV1_WARNING|ROOTLESS_USER|SCRIPT_BASE|SKIP_USERNS|EC2_INST_TYPE|PODMAN_DB|STORAGE_FS'
PASSTHROUGH_ENV_EXACT='CGROUP_MANAGER|DEST_BRANCH|DISTRO_NV|GOCACHE|GOPATH|GOSRC|NETWORK_BACKEND|OCI_RUNTIME|PODMAN_IGNORE_CGROUPSV1_WARNING|TMPDIR|ROOTLESS_USER|SCRIPT_BASE|SKIP_USERNS|EC2_INST_TYPE|PODMAN_DB|STORAGE_FS'

# List of envariable patterns which must match AT THE BEGINNING of the name.
PASSTHROUGH_ENV_ATSTART='CI|LANG|LC_|TEST'
Expand Down
2 changes: 1 addition & 1 deletion contrib/cirrus/lib.sh.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ declare -a keep_env_list=(IFS HOME PATH SECRET_ENV_RE
PASSTHROUGH_ENV_ATSTART
PASSTHROUGH_ENV_ANYWHERE
PASSTHROUGH_ENV_RE
TMPDIR tmpdir keep_env rc_file testnum_file)
keep_env rc_file testnum_file)
declare -A keep_env
for i in "${keep_env_list[@]}"; do
keep_env[$i]=1
Expand Down
11 changes: 11 additions & 0 deletions contrib/cirrus/setup_environment.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,17 @@ EOF
# on Debian.
rm -rf /var/lib/containers/storage

# Catch invalid "TMPDIR == /tmp" assumptions; PR #19281
TMPDIR=$(mktemp --tmpdir -d CI_XXXX)
# tmp dir is commonly 1777 to allow all user to read/write
chmod 1777 $TMPDIR
export TMPDIR
# Ensure we are actually on tmpfs to speed things up.
fstype=$(findmnt -n -o FSTYPE --target $TMPDIR)
if [[ "$fstype" != "tmpfs" ]]; then
die "The CI test TMPDIR is not on a tmpfs mount, we need tmpfs to make the tests faster"
fi

# shellcheck disable=SC2154
showrun echo "Setting CI_DESIRED_STORAGE [=$CI_DESIRED_STORAGE] for *e2e* tests"
echo "STORAGE_FS=$CI_DESIRED_STORAGE" >>/etc/ci_environment
Expand Down

0 comments on commit 64548eb

Please sign in to comment.