From 23c434c309f4f49ef369f3bbda46177e5d2724cf Mon Sep 17 00:00:00 2001 From: Egor Lazarchuk Date: Thu, 4 Jan 2024 17:01:09 +0000 Subject: [PATCH 1/3] fix: replaced ARCH with `uname -m` In the previous commits the ARCH env variable was introduced to the Dockerfile and build_container.sh scripts. It was meant to help with configuration of linux headers for musl-tools, but did not work for some reason. Considering the build_container.sh was already using `uname -m` calls to get the current arch this commit also uses it, so there is no need for ARCH anymore. Signed-off-by: Egor Lazarchuk --- Dockerfile | 1 - build_container.sh | 4 ++-- docker.sh | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 8e1a01c..134f1db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,5 @@ FROM ubuntu:22.04 ARG RUST_TOOLCHAIN="1.75.0" -ARG ARCH # Adding rust binaries to PATH. ENV PATH="$PATH:/root/.cargo/bin" diff --git a/build_container.sh b/build_container.sh index 84519a2..60bb3de 100755 --- a/build_container.sh +++ b/build_container.sh @@ -18,8 +18,8 @@ DEBIAN_FRONTEND="noninteractive" apt-get install --no-install-recommends -y \ apt-get clean && rm -rf /var/lib/apt/lists/* # help musl-gcc find linux headers -cd /usr/include/$ARCH-linux-musl \ - && ln -s ../$ARCH-linux-gnu/asm asm \ +cd /usr/include/$(uname -m)-linux-musl \ + && ln -s ../$(uname -m)-linux-gnu/asm asm \ && ln -s ../linux linux \ && ln -s ../asm-generic asm-generic diff --git a/docker.sh b/docker.sh index c4ebaa6..3f3fa0a 100755 --- a/docker.sh +++ b/docker.sh @@ -40,7 +40,7 @@ build(){ docker build -t "$new_tag" \ --build-arg GIT_BRANCH="${GIT_BRANCH}" \ --build-arg GIT_COMMIT="${GIT_COMMIT}" \ - -f Dockerfile --build-arg ARCH="${ARCH}" . + -f Dockerfile . echo "Build completed for $new_tag" } From d8fddb6151879c5647950e65ac30a1399c051a9c Mon Sep 17 00:00:00 2001 From: Egor Lazarchuk Date: Fri, 5 Jan 2024 11:58:37 +0000 Subject: [PATCH 2/3] fix(build_container): removed && Removed && from the script because they were causing the script build to succeed even if errors were occurring. Signed-off-by: Egor Lazarchuk --- build_container.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/build_container.sh b/build_container.sh index 60bb3de..bf7f660 100755 --- a/build_container.sh +++ b/build_container.sh @@ -18,10 +18,11 @@ DEBIAN_FRONTEND="noninteractive" apt-get install --no-install-recommends -y \ apt-get clean && rm -rf /var/lib/apt/lists/* # help musl-gcc find linux headers -cd /usr/include/$(uname -m)-linux-musl \ - && ln -s ../$(uname -m)-linux-gnu/asm asm \ - && ln -s ../linux linux \ - && ln -s ../asm-generic asm-generic +pushd /usr/include/$(uname -m)-linux-musl +ln -s ../$(uname -m)-linux-gnu/asm asm +ln -s ../linux linux +ln -s ../asm-generic asm-generic +popd pip3 install --no-cache-dir pytest pexpect boto3 pytest-timeout && apt purge -y python3-pip From bcd5bc25aee70d0750728f7c8296b1f438b9869e Mon Sep 17 00:00:00 2001 From: Egor Lazarchuk Date: Fri, 5 Jan 2024 12:07:33 +0000 Subject: [PATCH 3/3] refactor(build_container): global ARCH variable There are several places that need current arch of the system to install/configure the container. This commit replaces separate calls of $(uname -m) with one global ARCH variable. Signed-off-by: Egor Lazarchuk --- build_container.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build_container.sh b/build_container.sh index bf7f660..13142d2 100755 --- a/build_container.sh +++ b/build_container.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -ex +ARCH=$(uname -m) + apt-get update # DEBIAN_FRONTEND is set for tzdata. @@ -18,8 +20,8 @@ DEBIAN_FRONTEND="noninteractive" apt-get install --no-install-recommends -y \ apt-get clean && rm -rf /var/lib/apt/lists/* # help musl-gcc find linux headers -pushd /usr/include/$(uname -m)-linux-musl -ln -s ../$(uname -m)-linux-gnu/asm asm +pushd /usr/include/$ARCH-linux-musl +ln -s ../$ARCH-linux-gnu/asm asm ln -s ../linux linux ln -s ../asm-generic asm-generic popd @@ -44,7 +46,7 @@ rustup component add miri rust-src --toolchain nightly rustup component add llvm-tools-preview # needed for coverage # Install other rust targets. -rustup target add $(uname -m)-unknown-linux-musl $(uname -m)-unknown-none +rustup target add $ARCH-unknown-linux-musl $ARCH-unknown-none cargo install cargo-llvm-cov