From e6cbce2238c14d2db5487a37809b9a89372a66be Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Mon, 20 Nov 2023 13:41:36 +0100 Subject: [PATCH] Update test scripts use robust path determination move noninteractive to dockerfile --- ci/ci-debian.Dockerfile | 15 ++++++++------- ci/installation/run_install_faststartup.sh | 13 +++++-------- ci/installation/run_install_test.sh | 13 +++++-------- ci/installation/run_install_user_not_pi.sh | 13 +++++-------- ci/installation/run_install_webapp.sh | 13 +++++-------- 5 files changed, 28 insertions(+), 39 deletions(-) diff --git a/ci/ci-debian.Dockerfile b/ci/ci-debian.Dockerfile index 7d9aeaf40..236dece53 100644 --- a/ci/ci-debian.Dockerfile +++ b/ci/ci-debian.Dockerfile @@ -4,14 +4,14 @@ ARG BASE_TEST_IMAGE=test-code FROM debian:${DEBIAN_CODENAME}-slim as base ARG DEBIAN_CODENAME -ENV CI_RUNNING=true TERM=xterm +ENV TERM=xterm DEBIAN_FRONTEND=noninteractive +ENV CI_RUNNING=true # create pi configs to test installation RUN touch /boot/config.txt RUN echo "logo.nologo" > /boot/cmdline.txt -RUN export DEBIAN_FRONTEND=noninteractive \ - && echo "--- install packages (1) ---" \ +RUN echo "--- install packages (1) ---" \ && apt-get update \ && apt-get -y install \ apt-utils \ @@ -34,6 +34,9 @@ RUN export DEBIAN_FRONTEND=noninteractive \ wget \ wpasupplicant \ && rm -rf /var/lib/apt/lists/* + +# Set NonInteractive for sudo usage in container. 'sudo' package needed +RUN echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections # ------ # Base Target for setting up the default user. user can be selected with the docker '--user YYY' option @@ -73,8 +76,7 @@ ENV GIT_BRANCH=$GIT_BRANCH GIT_USER=$GIT_USER COPY --chown=root:$TEST_USER_GROUP --chmod=770 packages-core.txt ./ -RUN export DEBIAN_FRONTEND=noninteractive \ - && echo "--- install internal packages ---" \ +RUN echo "--- install internal packages ---" \ && apt-get update \ && sed 's/#.*//g' packages-core.txt | xargs apt-get -y install \ && rm -rf /var/lib/apt/lists/* @@ -91,8 +93,7 @@ COPY --chown=root:$TEST_USER_GROUP --chmod=770 ci/installation/*.sh ./ # Target for applying latest updates (should not be cached!) FROM $BASE_TEST_IMAGE as test-update -RUN export DEBIAN_FRONTEND=noninteractive \ - && apt-get update \ +RUN apt-get update \ && apt-get -y upgrade \ && rm -rf /var/lib/apt/lists/* # ------ diff --git a/ci/installation/run_install_faststartup.sh b/ci/installation/run_install_faststartup.sh index 1cefbc8be..7737f0d6e 100644 --- a/ci/installation/run_install_faststartup.sh +++ b/ci/installation/run_install_faststartup.sh @@ -5,13 +5,10 @@ # Objective: Test installation with script using a simple configuration -local_install_script_path="${INSTALL_SCRIPT_PATH:-./../../installation/}" -local_install_script_path="${local_install_script_path%/}" - -# Preparations -# No interactive frontend -export DEBIAN_FRONTEND=noninteractive -echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections +SOURCE="${BASH_SOURCE[0]}" +SCRIPT_DIR="$(dirname "$SOURCE")" +LOCAL_INSTALL_SCRIPT_PATH="${INSTALL_SCRIPT_PATH:-${SCRIPT_DIR}/../../installation}" +LOCAL_INSTALL_SCRIPT_PATH="${LOCAL_INSTALL_SCRIPT_PATH%/}" # Run installation (in interactive mode) # y - start setup @@ -28,7 +25,7 @@ echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selecti # - - install node (only with WebApp = y) # n - reboot -"$local_install_script_path"/install-jukebox.sh <<< 'y +"${LOCAL_INSTALL_SCRIPT_PATH}/install-jukebox.sh" <<< 'y y y n diff --git a/ci/installation/run_install_test.sh b/ci/installation/run_install_test.sh index 6f2f07fdd..d480434f2 100644 --- a/ci/installation/run_install_test.sh +++ b/ci/installation/run_install_test.sh @@ -5,13 +5,10 @@ # Objective: Test installation with script using a simple configuration -local_install_script_path="${INSTALL_SCRIPT_PATH:-./../../installation/}" -local_install_script_path="${local_install_script_path%/}" - -# Preparations -# No interactive frontend -export DEBIAN_FRONTEND=noninteractive -echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections +SOURCE="${BASH_SOURCE[0]}" +SCRIPT_DIR="$(dirname "$SOURCE")" +LOCAL_INSTALL_SCRIPT_PATH="${INSTALL_SCRIPT_PATH:-${SCRIPT_DIR}/../../installation}" +LOCAL_INSTALL_SCRIPT_PATH="${LOCAL_INSTALL_SCRIPT_PATH%/}" # Run installation (in interactive mode) # y - start setup @@ -29,7 +26,7 @@ echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selecti # y - install node # n - reboot -"$local_install_script_path"/install-jukebox.sh <<< 'y +"${LOCAL_INSTALL_SCRIPT_PATH}/install-jukebox.sh" <<< 'y n n y diff --git a/ci/installation/run_install_user_not_pi.sh b/ci/installation/run_install_user_not_pi.sh index 02cf2734c..76a8cd576 100644 --- a/ci/installation/run_install_user_not_pi.sh +++ b/ci/installation/run_install_user_not_pi.sh @@ -5,18 +5,15 @@ # Objective: Test installation with script using a simple configuration -local_install_script_path="${INSTALL_SCRIPT_PATH:-./../../installation/}" -local_install_script_path="${local_install_script_path%/}" - -# Preparations -# No interactive frontend -export DEBIAN_FRONTEND=noninteractive -echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections +SOURCE="${BASH_SOURCE[0]}" +SCRIPT_DIR="$(dirname "$SOURCE")" +LOCAL_INSTALL_SCRIPT_PATH="${INSTALL_SCRIPT_PATH:-${SCRIPT_DIR}/../../installation}" +LOCAL_INSTALL_SCRIPT_PATH="${LOCAL_INSTALL_SCRIPT_PATH%/}" # Run installation (in interactive mode) # - - Installation must abort early -"$local_install_script_path"/install-jukebox.sh +"${LOCAL_INSTALL_SCRIPT_PATH}/install-jukebox.sh" INSTALLATION_EXITCODE=$? # only count abortion due to "not user pi" as success diff --git a/ci/installation/run_install_webapp.sh b/ci/installation/run_install_webapp.sh index cc36fdeaf..263e5234e 100644 --- a/ci/installation/run_install_webapp.sh +++ b/ci/installation/run_install_webapp.sh @@ -5,13 +5,10 @@ # Objective: Test installation with script using a simple configuration -local_install_script_path="${INSTALL_SCRIPT_PATH:-./../../installation/}" -local_install_script_path="${local_install_script_path%/}" - -# Preparations -# No interactive frontend -export DEBIAN_FRONTEND=noninteractive -echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections +SOURCE="${BASH_SOURCE[0]}" +SCRIPT_DIR="$(dirname "$SOURCE")" +LOCAL_INSTALL_SCRIPT_PATH="${INSTALL_SCRIPT_PATH:-${SCRIPT_DIR}/../../installation}" +LOCAL_INSTALL_SCRIPT_PATH="${LOCAL_INSTALL_SCRIPT_PATH%/}" # Run installation (in interactive mode) # y - start setup @@ -28,7 +25,7 @@ echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selecti # y - install node # n - reboot -"$local_install_script_path"/install-jukebox.sh <<< 'y +"${LOCAL_INSTALL_SCRIPT_PATH}/install-jukebox.sh" <<< 'y n n n