2018-07-09 16:30:20 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
2019-01-10 17:00:45 +00:00
|
|
|
|
2018-07-09 16:30:20 +00:00
|
|
|
source $(dirname $0)/lib.sh
|
|
|
|
|
2019-03-22 13:44:03 +00:00
|
|
|
req_env_var USER HOME GOSRC SCRIPT_BASE SETUP_MARKER_FILEPATH
|
2018-07-09 16:30:20 +00:00
|
|
|
|
2019-03-22 13:44:03 +00:00
|
|
|
# Ensure this script only executes successfully once and always logs ending timestamp
|
2020-02-27 16:45:46 +00:00
|
|
|
if [[ -e "$SETUP_MARKER_FILEPATH" ]]; then
|
|
|
|
show_env_vars
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-03-22 13:44:03 +00:00
|
|
|
exithandler() {
|
|
|
|
RET=$?
|
2018-12-03 20:20:15 +00:00
|
|
|
echo "."
|
2019-03-22 13:44:03 +00:00
|
|
|
echo "$(basename $0) exit status: $RET"
|
2018-12-03 20:20:15 +00:00
|
|
|
[[ "$RET" -eq "0" ]] && date +%s >> "$SETUP_MARKER_FILEPATH"
|
2020-02-27 16:45:46 +00:00
|
|
|
show_env_vars
|
2020-02-26 21:15:36 +00:00
|
|
|
[[ "$RET" -eq "0" ]] || warn "Non-zero exit caused by error ABOVE env. var. display."
|
2019-03-22 13:44:03 +00:00
|
|
|
}
|
|
|
|
trap exithandler EXIT
|
2018-07-09 16:30:20 +00:00
|
|
|
|
|
|
|
# Verify basic dependencies
|
Cirrus: Document and codify base-image production
A number of images required for future testing are not present in GCE.
Importing them is a long proscribed process prone to errors and
complications.
Improve this situation by documenting, and encoding the majority of the
steps required. Due to the required complexity, these are clearly
identified as 'semi-automated'. This means a discerning eye is
sometimes needed to address unforeseen problems (networking issues,
format or packaging changes, etc).
Nevertheless, having these steps in writing, will reduce current and
future maintenance burden while supporting future testing needs of
RHEL, Fedora and Fedora Atomic Host.
Also:
* Add necessary configuration, scripts, and Makefile updates needed to
prepare RHEL, Fedora, & FAH cloud images for use in GCE. This
is a complex, multi-step process where the cloud image is booted
un a local user-mod qemu-kvm instance, where it can be modified.
From there, it's converted into a specific format, and imported into
GCE. Lastly, the imported raw disk data is made available as a GCE
VM image.
Note: As of this commit, the RHEL base-image builds (CentOS has native
image), however neither RHEL or CentOS cache-images build correctly.
* Left testing on FAH disabled, the GCE/Cirrus integration needs needs more
work. Specifically, the python3-based google startup script service
throws a permission-denied (as root) when trying to create a temp.
directory. Did not investigate further, though manually running the
startup script does allow the libpod tests to start running.
* Enabled Fedora 29 image to execute tests and general use.
* Utilize the standardized F28-based container image for gating
of more the intensive unit and integration testing. Update
documentation to reflect this as the standard platform for
these checks. Rename tasks with shorter names and to better
reflect their purpose.
* Cirrus: Trim unnecessary env vars before testing since the vast
majority are only required for orchestration purposes. Since most
are defined within `.cirrus.yml`, it's a good place to store the
list of undesirables. Since each of the cirrus-scripts runs in
it's own shell, unsetting these near the end will have no
consequence. Also trim down the number of calls to show_env_vars()
Signed-off-by: Chris Evich <cevich@redhat.com>
2018-11-07 14:35:18 +00:00
|
|
|
for depbin in go rsync unzip sha256sum curl make python3 git
|
2018-07-09 16:30:20 +00:00
|
|
|
do
|
|
|
|
if ! type -P "$depbin" &> /dev/null
|
|
|
|
then
|
Cirrus: Document and codify base-image production
A number of images required for future testing are not present in GCE.
Importing them is a long proscribed process prone to errors and
complications.
Improve this situation by documenting, and encoding the majority of the
steps required. Due to the required complexity, these are clearly
identified as 'semi-automated'. This means a discerning eye is
sometimes needed to address unforeseen problems (networking issues,
format or packaging changes, etc).
Nevertheless, having these steps in writing, will reduce current and
future maintenance burden while supporting future testing needs of
RHEL, Fedora and Fedora Atomic Host.
Also:
* Add necessary configuration, scripts, and Makefile updates needed to
prepare RHEL, Fedora, & FAH cloud images for use in GCE. This
is a complex, multi-step process where the cloud image is booted
un a local user-mod qemu-kvm instance, where it can be modified.
From there, it's converted into a specific format, and imported into
GCE. Lastly, the imported raw disk data is made available as a GCE
VM image.
Note: As of this commit, the RHEL base-image builds (CentOS has native
image), however neither RHEL or CentOS cache-images build correctly.
* Left testing on FAH disabled, the GCE/Cirrus integration needs needs more
work. Specifically, the python3-based google startup script service
throws a permission-denied (as root) when trying to create a temp.
directory. Did not investigate further, though manually running the
startup script does allow the libpod tests to start running.
* Enabled Fedora 29 image to execute tests and general use.
* Utilize the standardized F28-based container image for gating
of more the intensive unit and integration testing. Update
documentation to reflect this as the standard platform for
these checks. Rename tasks with shorter names and to better
reflect their purpose.
* Cirrus: Trim unnecessary env vars before testing since the vast
majority are only required for orchestration purposes. Since most
are defined within `.cirrus.yml`, it's a good place to store the
list of undesirables. Since each of the cirrus-scripts runs in
it's own shell, unsetting these near the end will have no
consequence. Also trim down the number of calls to show_env_vars()
Signed-off-by: Chris Evich <cevich@redhat.com>
2018-11-07 14:35:18 +00:00
|
|
|
echo "***** WARNING: $depbin binary not found in $PATH *****"
|
2018-07-09 16:30:20 +00:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2019-03-22 13:44:03 +00:00
|
|
|
# Sometimes environment setup needs to vary between distros
|
|
|
|
# Note: This should only be used for environment variables, and temporary workarounds.
|
|
|
|
# Anything externally dependent, should be made fixed-in-time by adding to
|
|
|
|
# contrib/cirrus/packer/*_setup.sh to be incorporated into VM cache-images
|
|
|
|
# (see docs).
|
2018-12-03 20:20:15 +00:00
|
|
|
cd "${GOSRC}/"
|
2019-08-07 14:25:23 +00:00
|
|
|
case "${OS_RELEASE_ID}" in
|
|
|
|
ubuntu)
|
2019-07-25 15:56:59 +00:00
|
|
|
;;
|
2019-08-07 14:25:23 +00:00
|
|
|
fedora)
|
|
|
|
# All SELinux distros need this for systemd-in-a-container
|
|
|
|
setsebool container_manage_cgroup true
|
2019-08-28 16:39:36 +00:00
|
|
|
|
2020-04-15 16:01:23 +00:00
|
|
|
workaround_bfq_bug
|
2020-01-27 17:02:59 +00:00
|
|
|
|
2020-03-02 15:32:21 +00:00
|
|
|
if [[ "$ADD_SECOND_PARTITION" == "true" ]]; then
|
|
|
|
bash "$SCRIPT_BASE/add_second_partition.sh"
|
|
|
|
fi
|
|
|
|
|
2020-02-27 16:43:47 +00:00
|
|
|
warn "Forcing systemd cgroup manager"
|
|
|
|
X=$(echo "export CGROUP_MANAGER=systemd" | \
|
|
|
|
tee -a /etc/environment) && eval "$X" && echo "$X"
|
|
|
|
;;
|
|
|
|
centos) # Current VM is an image-builder-image no local podman/testing
|
|
|
|
echo "No further setup required for VM image building"
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
*) bad_os_id_ver ;;
|
|
|
|
esac
|
2020-01-27 17:02:59 +00:00
|
|
|
|
2020-02-27 16:43:47 +00:00
|
|
|
# Reload to incorporate any changes from above
|
|
|
|
source "$SCRIPT_BASE/lib.sh"
|
|
|
|
|
|
|
|
case "$CG_FS_TYPE" in
|
|
|
|
tmpfs)
|
|
|
|
warn "Forcing testing with runc instead of crun"
|
|
|
|
X=$(echo "export OCI_RUNTIME=/usr/bin/runc" | \
|
|
|
|
tee -a /etc/environment) && eval "$X" && echo "$X"
|
|
|
|
;;
|
|
|
|
cgroup2fs)
|
|
|
|
# This is necessary since we've built/installed from source, which uses runc as the default.
|
|
|
|
warn "Forcing testing with crun instead of runc"
|
|
|
|
X=$(echo "export OCI_RUNTIME=/usr/bin/crun" | \
|
|
|
|
tee -a /etc/environment) && eval "$X" && echo "$X"
|
2020-01-27 17:02:59 +00:00
|
|
|
|
2020-02-27 16:43:47 +00:00
|
|
|
if [[ "$OS_RELEASE_ID" == "fedora" ]]; then
|
2019-08-28 16:39:36 +00:00
|
|
|
warn "Upgrading to the latest crun"
|
|
|
|
# Normally not something to do for stable testing
|
|
|
|
# but crun is new, and late-breaking fixes may be required
|
|
|
|
# on short notice
|
2020-05-07 14:19:00 +00:00
|
|
|
dnf update -y crun containers-common
|
2019-08-28 16:39:36 +00:00
|
|
|
fi
|
2019-07-09 16:03:04 +00:00
|
|
|
;;
|
2020-02-27 16:43:47 +00:00
|
|
|
*)
|
|
|
|
die 110 "Unsure how to handle cgroup filesystem type '$CG_FS_TYPE'"
|
2019-04-30 17:09:32 +00:00
|
|
|
;;
|
2019-03-22 13:44:03 +00:00
|
|
|
esac
|
2018-07-09 16:30:20 +00:00
|
|
|
|
2019-08-27 16:12:28 +00:00
|
|
|
# Must execute before possible setup_rootless()
|
2019-04-30 17:09:32 +00:00
|
|
|
make install.tools
|
2019-01-17 19:04:24 +00:00
|
|
|
|
2019-03-22 13:44:03 +00:00
|
|
|
case "$SPECIALMODE" in
|
2019-07-19 14:46:36 +00:00
|
|
|
none)
|
2019-08-01 11:31:04 +00:00
|
|
|
[[ -n "$CROSS_PLATFORM" ]] || \
|
|
|
|
remove_packaged_podman_files
|
2019-07-19 14:46:36 +00:00
|
|
|
;;
|
2019-08-11 16:47:15 +00:00
|
|
|
endpoint)
|
|
|
|
remove_packaged_podman_files
|
|
|
|
;;
|
2020-02-20 17:01:14 +00:00
|
|
|
bindings)
|
|
|
|
remove_packaged_podman_files
|
|
|
|
;;
|
2019-03-22 13:44:03 +00:00
|
|
|
rootless)
|
2019-04-30 17:09:32 +00:00
|
|
|
# Only do this once, even if ROOTLESS_USER (somehow) changes
|
|
|
|
if ! grep -q 'ROOTLESS_USER' /etc/environment
|
|
|
|
then
|
|
|
|
X=$(echo "export ROOTLESS_USER='${ROOTLESS_USER:-some${RANDOM}dude}'" | \
|
|
|
|
tee -a /etc/environment) && eval "$X" && echo "$X"
|
|
|
|
X=$(echo "export SPECIALMODE='${SPECIALMODE}'" | \
|
|
|
|
tee -a /etc/environment) && eval "$X" && echo "$X"
|
|
|
|
X=$(echo "export TEST_REMOTE_CLIENT='${TEST_REMOTE_CLIENT}'" | \
|
|
|
|
tee -a /etc/environment) && eval "$X" && echo "$X"
|
|
|
|
setup_rootless
|
|
|
|
fi
|
2019-07-09 16:06:51 +00:00
|
|
|
remove_packaged_podman_files
|
2019-03-22 13:44:03 +00:00
|
|
|
;;
|
|
|
|
in_podman) # Assumed to be Fedora
|
|
|
|
$SCRIPT_BASE/setup_container_environment.sh
|
|
|
|
;;
|
2019-04-30 17:09:32 +00:00
|
|
|
*)
|
2019-07-19 14:46:36 +00:00
|
|
|
die 111 "Unsupported \$SPECIALMODE: $SPECIALMODE"
|
2019-03-22 13:44:03 +00:00
|
|
|
esac
|
2019-08-27 16:12:28 +00:00
|
|
|
|
|
|
|
install_test_configs
|