summaryrefslogtreecommitdiff
path: root/contrib/cirrus
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-07-16 22:16:24 +0200
committerGitHub <noreply@github.com>2019-07-16 22:16:24 +0200
commitfe833086313335f88a9aada54890a83077ff41bf (patch)
treea65afd4f4da1f126523f278e2462967d9adcaf07 /contrib/cirrus
parent400851ac31a57f43916c4a1b653a33737f1e7e3b (diff)
parentf58b754c8d3a45b8d9123c624bf299b87285c3bf (diff)
downloadpodman-fe833086313335f88a9aada54890a83077ff41bf.tar.gz
podman-fe833086313335f88a9aada54890a83077ff41bf.tar.bz2
podman-fe833086313335f88a9aada54890a83077ff41bf.zip
Merge pull request #3548 from cevich/disable_periodic_activity
Cirrus: Disable most periodic services/timers
Diffstat (limited to 'contrib/cirrus')
-rwxr-xr-xcontrib/cirrus/check_image.sh6
-rw-r--r--contrib/cirrus/lib.sh17
-rw-r--r--contrib/cirrus/packer/fedora_base-setup.sh3
-rw-r--r--contrib/cirrus/packer/fedora_setup.sh3
-rw-r--r--contrib/cirrus/packer/ubuntu_setup.sh3
5 files changed, 32 insertions, 0 deletions
diff --git a/contrib/cirrus/check_image.sh b/contrib/cirrus/check_image.sh
index 67e807d61..690a38119 100755
--- a/contrib/cirrus/check_image.sh
+++ b/contrib/cirrus/check_image.sh
@@ -36,4 +36,10 @@ do
"$(systemctl list-unit-files --no-legend $REQ_UNIT)" = "$REQ_UNIT enabled" || let "RET+=1"
done
+# Exits zero if any unit matching pattern is running
+UNIT_STATUS=$(systemctl is-active $EVIL_UNITS; echo $?)
+item_test "No interfering background units are active:" \
+ "$UNIT_STATUS" -ne "0" || let "RET+=1"
+
+echo "Total failed tests: $RET"
exit $RET
diff --git a/contrib/cirrus/lib.sh b/contrib/cirrus/lib.sh
index 4acdb460a..a9da3f4ce 100644
--- a/contrib/cirrus/lib.sh
+++ b/contrib/cirrus/lib.sh
@@ -78,6 +78,9 @@ ROOTLESS_ENV_RE='(CIRRUS_.+)|(ROOTLESS_.+)|(.+_IMAGE.*)|(.+_BASE)|(.*DIRPATH)|(.
# Unsafe env. vars for display
SECRET_ENV_RE='(IRCID)|(ACCOUNT)|(^GC[EP]..+)|(SSH)'
+# Names of systemd units which should never be running
+EVIL_UNITS="cron crond atd apt-daily-upgrade apt-daily fstrim motd-news systemd-tmpfiles-clean"
+
SPECIALMODE="${SPECIALMODE:-none}"
TEST_REMOTE_CLIENT="${TEST_REMOTE_CLIENT:-false}"
export CONTAINER_RUNTIME=${CONTAINER_RUNTIME:-podman}
@@ -350,6 +353,20 @@ remove_packaged_podman_files(){
done
}
+systemd_banish(){
+ echo "Disabling periodic services that could destabilize testing:"
+ set +e # Not all of these exist on every platform
+ for unit in $EVIL_UNITS
+ do
+ ooe.sh sudo systemctl stop $unit
+ ooe.sh sudo systemctl disable $unit
+ ooe.sh sudo systemctl disable $unit.timer
+ ooe.sh sudo systemctl mask $unit
+ ooe.sh sudo systemctl mask $unit.timer
+ done
+ set -e
+}
+
_finalize(){
set +e # Don't fail at the very end
set +e # make errors non-fatal
diff --git a/contrib/cirrus/packer/fedora_base-setup.sh b/contrib/cirrus/packer/fedora_base-setup.sh
index a425b2b57..788a54c34 100644
--- a/contrib/cirrus/packer/fedora_base-setup.sh
+++ b/contrib/cirrus/packer/fedora_base-setup.sh
@@ -27,6 +27,9 @@ ooe.sh systemctl enable rngd
echo "Setting cloud-init service to start after google-network-daemon.service"
cp -v $GOSRC/$PACKER_BASE/cloud-init/fedora/cloud-init.service /etc/systemd/system/
+# Ensure there are no disruptive periodic services enabled by default in image
+systemd_banish
+
rh_finalize
echo "SUCCESS!"
diff --git a/contrib/cirrus/packer/fedora_setup.sh b/contrib/cirrus/packer/fedora_setup.sh
index eb95db907..1e25a1a3c 100644
--- a/contrib/cirrus/packer/fedora_setup.sh
+++ b/contrib/cirrus/packer/fedora_setup.sh
@@ -76,6 +76,9 @@ ooe.sh sudo dnf install -y \
xz \
zip
+# Ensure there are no disruptive periodic services enabled by default in image
+systemd_banish
+
sudo /tmp/libpod/hack/install_catatonit.sh
rh_finalize
diff --git a/contrib/cirrus/packer/ubuntu_setup.sh b/contrib/cirrus/packer/ubuntu_setup.sh
index 6209f2f89..dba191ad2 100644
--- a/contrib/cirrus/packer/ubuntu_setup.sh
+++ b/contrib/cirrus/packer/ubuntu_setup.sh
@@ -100,6 +100,9 @@ ooe.sh sudo update-grub
sudo /tmp/libpod/hack/install_catatonit.sh
ooe.sh sudo make -C /tmp/libpod install.libseccomp.sudo
+# Ensure there are no disruptive periodic services enabled by default in image
+systemd_banish
+
ubuntu_finalize
echo "SUCCESS!"