From fac229ab1f95ec77f18be8a783a2779dd781c684 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 11 Jul 2023 21:57:34 +0200 Subject: ci: Remove P_CI_DIR and --workdir The --workdir setting to the docker run command is not needed. And P_CI_DIR/PWD is equal to BASE_ROOT_DIR, so just use that directly. --- ci/test/04_install.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'ci') diff --git a/ci/test/04_install.sh b/ci/test/04_install.sh index 626461df03..2e739e7f11 100755 --- a/ci/test/04_install.sh +++ b/ci/test/04_install.sh @@ -22,7 +22,6 @@ if [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (ASa CI_CONTAINER_CAP="--cap-add SYS_PTRACE" fi -export P_CI_DIR="$PWD" export BINS_SCRATCH_DIR="${BASE_SCRATCH_DIR}/bins/" if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then @@ -53,7 +52,6 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then --mount "type=volume,src=${CONTAINER_NAME}_ccache,dst=$CCACHE_DIR" \ --mount "type=volume,src=${CONTAINER_NAME}_depends,dst=$DEPENDS_DIR" \ --mount "type=volume,src=${CONTAINER_NAME}_previous_releases,dst=$PREVIOUS_RELEASES_DIR" \ - -w $BASE_ROOT_DIR \ --env-file /tmp/env \ --name $CONTAINER_NAME \ $CONTAINER_NAME) @@ -64,7 +62,7 @@ else fi CI_EXEC () { - $CI_EXEC_CMD_PREFIX bash -c "export PATH=${BINS_SCRATCH_DIR}:\$PATH && cd \"$P_CI_DIR\" && $*" + $CI_EXEC_CMD_PREFIX bash -c "export PATH=${BINS_SCRATCH_DIR}:\$PATH && cd \"${BASE_ROOT_DIR}\" && $*" } export -f CI_EXEC -- cgit v1.2.3 From fa8dcdcc8b29e58f5d285a49dde33d94b63c893b Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 11 Jul 2023 23:10:38 +0200 Subject: ci: Set PATH inside the CI env This is needed for the next commit. This also requires dropping CI_RETRY from the docker build step, which is fine, because CI_RETRY should be called inside the build script, not outside. Also, fix a doc typo. --- ci/lint/04_install.sh | 2 ++ ci/test/00_setup_env.sh | 8 +++++--- ci/test/04_install.sh | 6 ++---- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'ci') diff --git a/ci/lint/04_install.sh b/ci/lint/04_install.sh index 148819f468..dbbd01e507 100755 --- a/ci/lint/04_install.sh +++ b/ci/lint/04_install.sh @@ -6,6 +6,8 @@ export LC_ALL=C +export PATH=$PWD/ci/retry:$PATH + ${CI_RETRY_EXE} apt-get update # Lint dependencies: # - curl/xz-utils (to install shellcheck) diff --git a/ci/test/00_setup_env.sh b/ci/test/00_setup_env.sh index 69fd05051e..723f6ad37d 100755 --- a/ci/test/00_setup_env.sh +++ b/ci/test/00_setup_env.sh @@ -15,9 +15,12 @@ export BASE_ROOT_DIR # The depends dir. # This folder exists only on the ci guest, and on the ci host as a volume. export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends} -# A folder for the ci system to put temporary files (ccache, datadirs for tests, ...) -# This folder only exists on the ci host. +# A folder for the ci system to put temporary files (build result, datadirs for tests, ...) +# This folder only exists on the ci guest. export BASE_SCRATCH_DIR=${BASE_SCRATCH_DIR:-$BASE_ROOT_DIR/ci/scratch} +# A folder for the ci system to put executables. +# This folder only exists on the ci guest. +export BINS_SCRATCH_DIR="${BASE_SCRATCH_DIR}/bins/" echo "Setting specific values in env" if [ -n "${FILE_ENV}" ]; then @@ -69,5 +72,4 @@ export SDK_URL=${SDK_URL:-https://bitcoincore.org/depends-sources/sdks} export CI_BASE_PACKAGES=${CI_BASE_PACKAGES:-build-essential libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates ccache python3 rsync git procps bison} export GOAL=${GOAL:-install} export DIR_QA_ASSETS=${DIR_QA_ASSETS:-${BASE_SCRATCH_DIR}/qa-assets} -export PATH=${BASE_ROOT_DIR}/ci/retry:$PATH export CI_RETRY_EXE=${CI_RETRY_EXE:-"retry --"} diff --git a/ci/test/04_install.sh b/ci/test/04_install.sh index 2e739e7f11..b10d560010 100755 --- a/ci/test/04_install.sh +++ b/ci/test/04_install.sh @@ -22,14 +22,12 @@ if [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (ASa CI_CONTAINER_CAP="--cap-add SYS_PTRACE" fi -export BINS_SCRATCH_DIR="${BASE_SCRATCH_DIR}/bins/" - if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then # Export all env vars to avoid missing some. # Though, exclude those with newlines to avoid parsing problems. python3 -c 'import os; [print(f"{key}={value}") for key, value in os.environ.items() if "\n" not in value and "HOME" not in key]' | tee /tmp/env echo "Creating $CI_IMAGE_NAME_TAG container to run in" - DOCKER_BUILDKIT=1 ${CI_RETRY_EXE} docker build \ + DOCKER_BUILDKIT=1 docker build \ --file "${BASE_ROOT_DIR}/ci/test_imagefile" \ --build-arg "CI_IMAGE_NAME_TAG=${CI_IMAGE_NAME_TAG}" \ --build-arg "FILE_ENV=${FILE_ENV}" \ @@ -62,7 +60,7 @@ else fi CI_EXEC () { - $CI_EXEC_CMD_PREFIX bash -c "export PATH=${BINS_SCRATCH_DIR}:\$PATH && cd \"${BASE_ROOT_DIR}\" && $*" + $CI_EXEC_CMD_PREFIX bash -c "export PATH=${BINS_SCRATCH_DIR}:${BASE_ROOT_DIR}/ci/retry:\$PATH && cd \"${BASE_ROOT_DIR}\" && $*" } export -f CI_EXEC -- cgit v1.2.3 From fabc04a4d96c4fe70e60d365aa28031d149094f3 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Mon, 24 Jul 2023 14:55:18 +0200 Subject: ci: Keep system env vars as-is --- ci/test/04_install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ci') diff --git a/ci/test/04_install.sh b/ci/test/04_install.sh index b10d560010..ff43698994 100755 --- a/ci/test/04_install.sh +++ b/ci/test/04_install.sh @@ -25,7 +25,9 @@ fi if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then # Export all env vars to avoid missing some. # Though, exclude those with newlines to avoid parsing problems. - python3 -c 'import os; [print(f"{key}={value}") for key, value in os.environ.items() if "\n" not in value and "HOME" not in key]' | tee /tmp/env + python3 -c 'import os; [print(f"{key}={value}") for key, value in os.environ.items() if "\n" not in value and "HOME" != key and "PATH" != key and "USER" != key]' | tee /tmp/env + # System-dependent env vars must be kept as is. So read them from the container. + docker run --rm "${CI_IMAGE_NAME_TAG}" bash -c "env | grep --extended-regexp '^(HOME|PATH|USER)='" | tee --append /tmp/env echo "Creating $CI_IMAGE_NAME_TAG container to run in" DOCKER_BUILDKIT=1 docker build \ --file "${BASE_ROOT_DIR}/ci/test_imagefile" \ -- cgit v1.2.3