aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-03-31 10:20:15 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-04-06 11:52:30 +0200
commitfa5af94de6aa4643b30ab526b6249340bff34d43 (patch)
treef93ce151584d6d813d273360906484aebb8de192
parent5a8bd4505687a7ec76d731b1a8249ee04d641990 (diff)
downloadbitcoin-fa5af94de6aa4643b30ab526b6249340bff34d43.tar.xz
ci: Run base install at most once
This should avoid errors when running it twice. For example, network errors on the second invocation of 'apt update'; or unguarded modifications such as APPEND_APT_SOURCES_LIST, which will append the same string repeatedly. The base install may be run twice in Cirrus CI with dockerfiles, or locally when running twice with DANGER_RUN_CI_ON_HOST specified.
-rwxr-xr-xci/test/01_base_install.sh16
-rwxr-xr-xci/test/04_install.sh13
2 files changed, 18 insertions, 11 deletions
diff --git a/ci/test/01_base_install.sh b/ci/test/01_base_install.sh
index 607945cbb2..bc1f2bb915 100755
--- a/ci/test/01_base_install.sh
+++ b/ci/test/01_base_install.sh
@@ -6,6 +6,12 @@
export LC_ALL=C.UTF-8
+CFG_DONE="ci.base-install-done" # Use a global git setting to remember whether this script ran to avoid running it twice
+
+if [ "$(git config --global ${CFG_DONE})" == "true" ]; then
+ echo "Skip base install"
+ exit 0
+fi
if [ -n "$DPKG_ADD_ARCH" ]; then
dpkg --add-architecture "$DPKG_ADD_ARCH"
@@ -51,11 +57,9 @@ if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
fi
if [[ "${RUN_TIDY}" == "true" ]]; then
- if [ ! -d "${DIR_IWYU}" ]; then
- git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_16 "${DIR_IWYU}"/include-what-you-use
- cmake -B "${DIR_IWYU}"/build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-16 -S "${DIR_IWYU}"/include-what-you-use
- make -C "${DIR_IWYU}"/build/ install "$MAKEJOBS"
- fi
+ git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_16 "${DIR_IWYU}"/include-what-you-use
+ cmake -B "${DIR_IWYU}"/build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-16 -S "${DIR_IWYU}"/include-what-you-use
+ make -C "${DIR_IWYU}"/build/ install "$MAKEJOBS"
fi
mkdir -p "${DEPENDS_DIR}/SDKs" "${DEPENDS_DIR}/sdk-sources"
@@ -80,3 +84,5 @@ if [ -n "$ANDROID_HOME" ] && [ ! -d "$ANDROID_HOME" ]; then
unzip -o "$ANDROID_TOOLS_PATH" -d "$ANDROID_HOME"
yes | "${ANDROID_HOME}"/cmdline-tools/bin/sdkmanager --sdk_root="${ANDROID_HOME}" --install "build-tools;${ANDROID_BUILD_TOOLS_VERSION}" "platform-tools" "platforms;android-${ANDROID_API_LEVEL}" "ndk;${ANDROID_NDK_VERSION}"
fi
+
+git config --global ${CFG_DONE} "true"
diff --git a/ci/test/04_install.sh b/ci/test/04_install.sh
index 22045c4d1f..1024222e96 100755
--- a/ci/test/04_install.sh
+++ b/ci/test/04_install.sh
@@ -55,14 +55,8 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
$CONTAINER_NAME)
export CI_CONTAINER_ID
export CI_EXEC_CMD_PREFIX="docker exec ${CI_CONTAINER_ID}"
- $CI_EXEC_CMD_PREFIX rsync --archive --stats --human-readable /ci_base_install/ "${BASE_ROOT_DIR}"
- $CI_EXEC_CMD_PREFIX rsync --archive --stats --human-readable /ro_base/ "$BASE_ROOT_DIR"
- # Fixes permission issues when there is a container UID/GID mismatch with the owner
- # of the mounted bitcoin src dir.
- $CI_EXEC_CMD_PREFIX git config --global --add safe.directory "*"
else
echo "Running on host system without docker wrapper"
- "${BASE_ROOT_DIR}/ci/test/01_base_install.sh"
fi
CI_EXEC () {
@@ -70,6 +64,13 @@ CI_EXEC () {
}
export -f CI_EXEC
+CI_EXEC rsync --archive --stats --human-readable /ci_base_install/ "${BASE_ROOT_DIR}" || echo "/ci_base_install/ missing"
+CI_EXEC "${BASE_ROOT_DIR}/ci/test/01_base_install.sh"
+CI_EXEC rsync --archive --stats --human-readable /ro_base/ "${BASE_ROOT_DIR}" || echo "Nothing to copy from ro_base"
+# Fixes permission issues when there is a container UID/GID mismatch with the owner
+# of the git source code directory.
+CI_EXEC git config --global --add safe.directory \"*\"
+
CI_EXEC mkdir -p "${BINS_SCRATCH_DIR}"
if [ "$CI_OS_NAME" == "macos" ]; then