From 51c3dd2261d3645a297a88126fb9a1b6bded74e6 Mon Sep 17 00:00:00 2001 From: Bartosz Cichocki Date: Mon, 29 Nov 2021 13:09:12 +0100 Subject: [PATCH] [EGD-8019] Clean docker build scripts Cleanup of docker scripts and small fixups --- config/bootstrap_config | 9 +-------- config/build_runner_docker | 3 +-- config/{common_scripsts_lib => common_scripts_lib} | 4 ---- config/download_assets | 8 +------- config/license_header_check.sh | 2 +- config/requirements.txt | 1 - docker/Dockerfile.runner.in | 6 +++--- docker/jenkins-docker/Dockerfile | 5 +++-- test/requirements.txt | 3 ++- 9 files changed, 12 insertions(+), 29 deletions(-) rename config/{common_scripsts_lib => common_scripts_lib} (82%) diff --git a/config/bootstrap_config b/config/bootstrap_config index 16138b496df259ab0a3f13b2d01b8bfb08181b0e..aa3f5ab7a581bbbf77bc1d271637a2bd2db85bb5 100644 --- a/config/bootstrap_config +++ b/config/bootstrap_config @@ -8,20 +8,13 @@ ARM_GCC_PATH_VAR="${ARM_GCC//-/_}" ARM_GCC_MD5="8312c4c91799885f222f663fc81f9a31" CMAKE_VERSION="3.21.3" -CMAKE_NAME="cmake-${CMAKE_VERSION}-Linux-x86_64" +CMAKE_NAME="cmake-${CMAKE_VERSION}-linux-x86_64" CMAKE_SOURCE_LINK="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_NAME}.tar.gz" CMAKE_PKG="${CMAKE_SOURCE_LINK##*/}" CMAKE_PATH_VAR=${CMAKE_NAME//[-.]/_} CMAKE_SHA_LINK="https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-SHA-256.txt" CMAKE_SHA_FILE="${CMAKE_SHA_LINK##*/}" - -GH_RUNNER_VERSION="2.277.1" -GH_RUNNER_NAME="actions-runner-linux-x64-${GH_RUNNER_VERSION}" -GH_RUNNER_LINK="https://github.com/actions/runner/releases/download/v${GH_RUNNER_VERSION}/${GH_RUNNER_NAME}.tar.gz" -GH_RUNNER_PKG="${GH_RUNNER_LINK##*/}" -GH_RUNNER_PATH_VAR=${GH_RUNNER_NAME//[-.]/_} - INSTALL_PACKAGES=" apt-utils \ bash-completion \ diff --git a/config/build_runner_docker b/config/build_runner_docker index cfb7acd23d52802a2114fe1c32044547dfa172f0..4f1f746f0439a0e6fa86861b4f8e4acc54cfc5f2 100755 --- a/config/build_runner_docker +++ b/config/build_runner_docker @@ -3,7 +3,7 @@ SCRIPT=$(readlink -f $0) SCRIPT_DIR="$(dirname ${SCRIPT})" SRC_ROOT=$(readlink -f ${SCRIPT_DIR}/..) -source ${SRC_ROOT}/config/common_scripsts_lib +source ${SRC_ROOT}/config/common_scripts_lib source ${SRC_ROOT}/config/bootstrap_config DOCKER_DIR=${SRC_ROOT}/docker @@ -17,7 +17,6 @@ INSTALL_PACKAGES=$( echo "${INSTALL_PACKAGES}" | tr "\n" " "| tr -s " ") function prepareDockerFile() { sed -e "s#@ARM_GCC_PKG@#${ARM_GCC_PKG}#g" \ -e "s#@CMAKE_PKG@#${CMAKE_PKG}#g" \ - -e "s#@GH_RUNNER_PKG@#${GH_RUNNER_PKG}#g" \ -e "s#@CMAKE_NAME@#${CMAKE_NAME}#g" \ -e "s#@ARM_GCC@#${ARM_GCC}#g;" \ -e "s#@DOCKER_TIMEZONE@#${DOCKER_TIMEZONE}#g;" \ diff --git a/config/common_scripsts_lib b/config/common_scripts_lib similarity index 82% rename from config/common_scripsts_lib rename to config/common_scripts_lib index 61f23f560e5f591dc46c03fe55c8264cbf25fe5e..be0ed9b6d9dd3bcff6c1989de5faee1de2557e3c 100755 --- a/config/common_scripsts_lib +++ b/config/common_scripts_lib @@ -21,7 +21,3 @@ function getArmCC() { function getCMake() { wget --no-verbose --show-progress -O ${CMAKE_PKG} ${CMAKE_SOURCE_LINK} } - -function getGHRunner() { - wget --no-verbose --show-progress -O ${GH_RUNNER_PKG} ${GH_RUNNER_LINK} -} diff --git a/config/download_assets b/config/download_assets index f4523da3fa02eb414b5937057874c6ed5de4f0d1..070974c0a5fe8118967b8f2eb13db1316290b04b 100755 --- a/config/download_assets +++ b/config/download_assets @@ -9,7 +9,7 @@ DEST_DIR="${SRC_ROOT}/docker/assets" DEST_PYREQ_TMP="${DEST_DIR}/requirements.txt.tmp" DEST_PYREQ="${DEST_DIR}/requirements.txt" -. ${SRC_ROOT}/config/common_scripsts_lib +. ${SRC_ROOT}/config/common_scripts_lib . ${SRC_ROOT}/config/bootstrap_config printVar SCRIPT @@ -34,11 +34,6 @@ function get_cmake() { sha256sum -c ${CMAKE_SHA_FILE} } -function get_gh_runner() { - echo -e "\e[32m${FUNCNAME[0]}\e[0m" - wget --no-verbose --show-progress -c -O ${GH_RUNNER_PKG} ${GH_RUNNER_LINK} -} - function getPythonReq() { echo -e "\e[32m${FUNCNAME[0]}\e[0m" cat ${SRC_ROOT}/test/requirements.txt > ${DEST_PYREQ_TMP} @@ -48,7 +43,6 @@ function getPythonReq() { get_arm_toolchain get_cmake -get_gh_runner getPythonReq diff --git a/config/license_header_check.sh b/config/license_header_check.sh index 425142963bccd087e6aef092b1fd790d1ca06bf2..4ad27e09cfda8ee3ced282c0a4f74207874f16c9 100755 --- a/config/license_header_check.sh +++ b/config/license_header_check.sh @@ -9,7 +9,7 @@ SCRIPT_DIR="$(dirname ${SCRIPT})" REPO_ROOT="${SCRIPT_DIR%/*}" #. ${SCRIPT_DIR}/bootstrap_config -. ${SCRIPT_DIR}/common_scripsts_lib +. ${SCRIPT_DIR}/common_scripts_lib . ${SCRIPT_DIR}/format-config.sh #printVar SCRIPT diff --git a/config/requirements.txt b/config/requirements.txt index a8eb35d1506da2f13f5b2900350fab2182d362db..a9bba72ce28927f1b292581e6db72b59a0715451 100644 --- a/config/requirements.txt +++ b/config/requirements.txt @@ -1,2 +1 @@ gitpython==3.1.11 -tqdm==4.54.1 diff --git a/docker/Dockerfile.runner.in b/docker/Dockerfile.runner.in index 78b9af14753a34c706693a352866e4c445e032ec..9de39d21528beaacda69b3fda52a541df52cb3b3 100644 --- a/docker/Dockerfile.runner.in +++ b/docker/Dockerfile.runner.in @@ -31,12 +31,10 @@ ADD assets/@ARM_GCC_PKG@ /usr/local/ # CMake ADD assets/@CMAKE_PKG@ /usr/local/ -ADD assets/@GH_RUNNER_PKG@ /home/runner/app - ENV CMAKE_NAME="/usr/local/@CMAKE_NAME@" ENV ARM_GCC="/usr/local/@ARM_GCC@" -ENV PATH="/user/local/actions-runner:/usr/local/@CMAKE_NAME@/bin:/usr/local/@ARM_GCC@/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" +ENV PATH="/user/local/actions-runner:/usr/local/@CMAKE_NAME@/bin:/usr/local/@ARM_GCC@/bin:$PATH" ENV TERM="xterm-256color" ADD assets/.bashrc /home/docker/ @@ -45,6 +43,8 @@ COPY assets/cmd.sh /cmd.sh COPY assets/entrypoint.sh /entrypoint.sh COPY ci_actions.sh /ci_actions.sh +RUN echo "export PATH="/user/local/actions-runner:/usr/local/@CMAKE_NAME@/bin:/usr/local/@ARM_GCC@/bin:$PATH"" > /etc/profile.d/setup_path.sh +RUN chmod +x /etc/profile.d/setup_path.sh RUN chmod +x /cmd.sh && \ chmod +x /entrypoint.sh && \ groupadd -r runner && \ diff --git a/docker/jenkins-docker/Dockerfile b/docker/jenkins-docker/Dockerfile index 16a5f971bed74c13908c5a08b1cea3b261628f8e..f72336ec3c5df64f7783832d0796c1b7c3bd8167 100644 --- a/docker/jenkins-docker/Dockerfile +++ b/docker/jenkins-docker/Dockerfile @@ -1,4 +1,4 @@ -FROM wearemudita/mudita_os_builder:1.12 +FROM wearemudita/mudita_os_builder:latest MAINTAINER ops@mudita.com # Docker runner for MuditaOS builds @@ -28,11 +28,12 @@ RUN sed -i /etc/ssh/sshd_config \ RUN mkdir -p /var/run/sshd -RUN adduser --quiet --gecos '' --disabled-password jenkins +RUN adduser --quiet --gecos '' --disabled-password --uid 6666 jenkins COPY .ssh/authorized_keys /home/jenkins/.ssh/authorized_keys COPY start-sshd /usr/local/bin/start-sshd RUN chown -R jenkins:jenkins /home/jenkins/.ssh +RUN cat /etc/profile.d/setup_path.sh >> /home/jenkins/.bashrc #RUN chmod -x /cmd.sh && \ # chmod -x /entrypoint.sh diff --git a/test/requirements.txt b/test/requirements.txt index 029a0420c3677d4a1bfd089181bf821daf915332..7f27e7693bdb5079e102d67a4eb435957ae79706 100644 --- a/test/requirements.txt +++ b/test/requirements.txt @@ -2,7 +2,7 @@ attrs==20.3.0 iniconfig==1.1.1 packaging==20.4 pluggy==0.13.1 -py==1.9.0 +py==1.10.0 pyparsing==2.4.7 pyserial==3.5 pytest==6.1.2 @@ -13,3 +13,4 @@ dataclasses==0.6 dataclasses_json==0.5.4 tqdm==4.62.2 eyed3==0.9.6 +ghapi