Skip to content

Commit fa7d755

Browse files
author
MarcoFalke
committed
ci: Pass full env to CI pod to avoid missing a var
Instead of enumerating each passed env var, just pass all. This avoids the risk of missing to enumerate one. Also, it is less code. The risk could be that an env var causes non-deterministic behavior, but this can be fixed by explicitly excluding it once the issue is known. Values with newlines can not be stored in the file and parsed by docker/podman, so they are excluded.
1 parent 6c7ebcc commit fa7d755

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

ci/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ testing compared to other parts of the codebase. If you want to keep the work tr
1414
system in a virtual machine with a Linux operating system of your choice.
1515

1616
To allow for a wide range of tested environments, but also ensure reproducibility to some extent, the test stage
17-
requires `docker` to be installed. To install all requirements on Ubuntu, run
17+
requires `bash`, `docker`, and `python3` to be installed. To install all requirements on Ubuntu, run
1818

1919
```
20-
sudo apt install docker.io bash
20+
sudo apt install bash docker.io python3
2121
```
2222

2323
To run the default test stage,

ci/test/04_install.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export ASAN_OPTIONS="detect_stack_use_after_return=1:check_initialization_order=
1818
export LSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/lsan"
1919
export TSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/tsan:halt_on_error=1:log_path=${BASE_SCRATCH_DIR}/sanitizer-output/tsan"
2020
export UBSAN_OPTIONS="suppressions=${BASE_ROOT_DIR}/test/sanitizer_suppressions/ubsan:print_stacktrace=1:halt_on_error=1:report_error_type=1"
21-
env | grep -E '^(BITCOIN_CONFIG|BASE_|QEMU_|CCACHE_|LC_ALL|BOOST_TEST_RANDOM|DEBIAN_FRONTEND|CONFIG_SHELL|(ASAN|LSAN|TSAN|UBSAN)_OPTIONS|PREVIOUS_RELEASES_DIR)' | tee /tmp/env
2221
if [[ $BITCOIN_CONFIG = *--with-sanitizers=*address* ]]; then # If ran with (ASan + LSan), Docker needs access to ptrace (https://github.com/google/sanitizers/issues/764)
2322
CI_CONTAINER_CAP="--cap-add SYS_PTRACE"
2423
fi
@@ -27,6 +26,9 @@ export P_CI_DIR="$PWD"
2726
export BINS_SCRATCH_DIR="${BASE_SCRATCH_DIR}/bins/"
2827

2928
if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
29+
# Export all env vars to avoid missing some.
30+
# Though, exclude those with newlines to avoid parsing problems.
31+
python3 -c 'import os; [print(f"{key}={value}") for key, value in os.environ.items() if "\n" not in value]' | tee /tmp/env
3032
echo "Creating $CI_IMAGE_NAME_TAG container to run in"
3133
DOCKER_BUILDKIT=1 ${CI_RETRY_EXE} docker build \
3234
--file "${BASE_ROOT_DIR}/ci/test_imagefile" \

0 commit comments

Comments
 (0)