Add mandatory container_mode to reproducer script
Reproducer playbook requires container_mode, set it for 'podman' by default. Change-Id: If764a36d76278d303e07177b41d11db7370c5c87
This commit is contained in:
parent
d7de304715
commit
9a3f78fc94
@ -18,6 +18,7 @@
|
|||||||
: ${UPSTREAM_GERRIT_SSH_KEY:="id_rsa"}
|
: ${UPSTREAM_GERRIT_SSH_KEY:="id_rsa"}
|
||||||
: ${RDO_GERRIT_SSH_KEY:="id_rsa"}
|
: ${RDO_GERRIT_SSH_KEY:="id_rsa"}
|
||||||
: ${EXTRA_PARAMS:=""}
|
: ${EXTRA_PARAMS:=""}
|
||||||
|
: ${CONTAINER_MODE:="podman"}
|
||||||
|
|
||||||
usage () {
|
usage () {
|
||||||
echo "Usage: $0 [options]"
|
echo "Usage: $0 [options]"
|
||||||
@ -146,6 +147,11 @@ while [ "x$1" != "x" ]; do
|
|||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
--container-cli|-cont)
|
||||||
|
CONTAINER_MODE=$2
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
|
||||||
--help|-h)
|
--help|-h)
|
||||||
usage
|
usage
|
||||||
exit
|
exit
|
||||||
@ -195,45 +201,47 @@ install_package_deps_via_bindep
|
|||||||
# Ensure pip is updated
|
# Ensure pip is updated
|
||||||
sudo pip install --upgrade pip
|
sudo pip install --upgrade pip
|
||||||
|
|
||||||
if [ -x "/usr/bin/docker" ] ; then
|
if [[ "$CONTAINER_CLI" == "docker"]]; then
|
||||||
# Fail as early as possible if the docker
|
if [ -x "/usr/bin/docker" ] ; then
|
||||||
# group is not setup appropriately.
|
# Fail as early as possible if the docker
|
||||||
# This has to be done AFTER package intalls.
|
# group is not setup appropriately.
|
||||||
# Set up docker groups
|
# This has to be done AFTER package intalls.
|
||||||
if ! groups | grep -Eq "docker|dockerroot"; then
|
# Set up docker groups
|
||||||
echo "$USER is not in the docker|dockerroot group."
|
if ! groups | grep -Eq "docker|dockerroot"; then
|
||||||
if grep -q docker: /etc/group; then
|
echo "$USER is not in the docker|dockerroot group."
|
||||||
DG=docker
|
if grep -q docker: /etc/group; then
|
||||||
elif grep -q dockerroot: /etc/group; then
|
DG=docker
|
||||||
DG=dockerroot
|
elif grep -q dockerroot: /etc/group; then
|
||||||
elif ! grep -q docker /etc/group; then
|
DG=dockerroot
|
||||||
sudo groupadd docker
|
elif ! grep -q docker /etc/group; then
|
||||||
DG=docker
|
sudo groupadd docker
|
||||||
|
DG=docker
|
||||||
|
fi
|
||||||
|
sudo usermod -aG $DG $USER
|
||||||
|
echo -e "\e[31m WARNING: The script has exited the current shell in order to setup \
|
||||||
|
the user groups via usermod correctly. Please re-execute the script. \e[0m"
|
||||||
|
exec sg $DG newgrp `id -gn`
|
||||||
fi
|
fi
|
||||||
sudo usermod -aG $DG $USER
|
|
||||||
echo -e "\e[31m WARNING: The script has exited the current shell in order to setup \
|
|
||||||
the user groups via usermod correctly. Please re-execute the script. \e[0m"
|
|
||||||
exec sg $DG newgrp `id -gn`
|
|
||||||
fi
|
|
||||||
|
|
||||||
# This can only be checked after rpms are installed.
|
# This can only be checked after rpms are installed.
|
||||||
# Check the Docker config
|
# Check the Docker config
|
||||||
if [[ -f /etc/docker/daemon.json ]]; then
|
if [[ -f /etc/docker/daemon.json ]]; then
|
||||||
if cat /etc/docker/daemon.json | grep '"group": "docker"'; then
|
if cat /etc/docker/daemon.json | grep '"group": "docker"'; then
|
||||||
echo "docker group is already added to /etc/docker/daemon.json"
|
echo "docker group is already added to /etc/docker/daemon.json"
|
||||||
elif cat /etc/docker/daemon.json | grep '"group": "dockerroot"'; then
|
elif cat /etc/docker/daemon.json | grep '"group": "dockerroot"'; then
|
||||||
echo "dockerroot group is already added to /etc/docker/daemon.json"
|
echo "dockerroot group is already added to /etc/docker/daemon.json"
|
||||||
elif (( $(cat /etc/docker/daemon.json | wc -m) > 3 )); then
|
elif (( $(cat /etc/docker/daemon.json | wc -m) > 3 )); then
|
||||||
echo -e "\e[31m /etc/docker/daemon.json is populated. \
|
echo -e "\e[31m /etc/docker/daemon.json is populated. \
|
||||||
Exit this script and either clear the file or add the docker group. \e[0m" | xargs
|
Exit this script and either clear the file or add the docker group. \e[0m" | xargs
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "The docker|dockerroot group will be added to /etc/docker/daemon.json."
|
echo "The docker|dockerroot group will be added to /etc/docker/daemon.json."
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
# Ensure the docker process has been restarted
|
# Ensure the docker process has been restarted
|
||||||
sudo systemctl restart docker
|
sudo systemctl restart docker
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start from a clean workspace
|
# Start from a clean workspace
|
||||||
@ -298,10 +306,10 @@ if [[ "$RDO_GERRIT_SSH_KEY" != "$USER_SSH_KEY" ]]; then
|
|||||||
EXTRA_PARAMS="$EXTRA_PARAMS -e rdo_gerrit_key=$RDO_GERRIT_SSH_KEY "
|
EXTRA_PARAMS="$EXTRA_PARAMS -e rdo_gerrit_key=$RDO_GERRIT_SSH_KEY "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Run the launcher playbook
|
# Run the launcher playbook
|
||||||
PATH=${HOME}/.local/bin:$PATH ansible-playbook \
|
PATH=${HOME}/.local/bin:$PATH ansible-playbook \
|
||||||
$WORKSPACE/launcher-playbook.yaml \
|
$WORKSPACE/launcher-playbook.yaml \
|
||||||
|
-e container_mode="$CONTAINER_MODE" \
|
||||||
-vv \
|
-vv \
|
||||||
--tags all \
|
--tags all \
|
||||||
${EXTRA_PARAMS[@]}
|
${EXTRA_PARAMS[@]}
|
||||||
|
Loading…
Reference in New Issue
Block a user