Skip to content

Commit d6c2a46

Browse files
committed
Merge bitcoin/bitcoin#27429: ci: Run base install at most once
fa5af94 ci: Run base install at most once (MarcoFalke) Pull request description: 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. ACKs for top commit: josibake: utACK bitcoin/bitcoin@fa5af94 Tree-SHA512: 020ba747e282076ddf10547025bb576ce626378d9f8313e09b1a5f99af1cf8237e44957aa4a0b8d64015bc730a090c83af0b3908a8eda15d3fb1ca7dae69dd7c
2 parents 5a8bd45 + fa5af94 commit d6c2a46

File tree

2 files changed

+18
-11
lines changed

2 files changed

+18
-11
lines changed

ci/test/01_base_install.sh

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66

77
export LC_ALL=C.UTF-8
88

9+
CFG_DONE="ci.base-install-done" # Use a global git setting to remember whether this script ran to avoid running it twice
10+
11+
if [ "$(git config --global ${CFG_DONE})" == "true" ]; then
12+
echo "Skip base install"
13+
exit 0
14+
fi
915

1016
if [ -n "$DPKG_ADD_ARCH" ]; then
1117
dpkg --add-architecture "$DPKG_ADD_ARCH"
@@ -51,11 +57,9 @@ if [[ ${USE_MEMORY_SANITIZER} == "true" ]]; then
5157
fi
5258

5359
if [[ "${RUN_TIDY}" == "true" ]]; then
54-
if [ ! -d "${DIR_IWYU}" ]; then
55-
git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_16 "${DIR_IWYU}"/include-what-you-use
56-
cmake -B "${DIR_IWYU}"/build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-16 -S "${DIR_IWYU}"/include-what-you-use
57-
make -C "${DIR_IWYU}"/build/ install "$MAKEJOBS"
58-
fi
60+
git clone --depth=1 https://github.com/include-what-you-use/include-what-you-use -b clang_16 "${DIR_IWYU}"/include-what-you-use
61+
cmake -B "${DIR_IWYU}"/build/ -G 'Unix Makefiles' -DCMAKE_PREFIX_PATH=/usr/lib/llvm-16 -S "${DIR_IWYU}"/include-what-you-use
62+
make -C "${DIR_IWYU}"/build/ install "$MAKEJOBS"
5963
fi
6064

6165
mkdir -p "${DEPENDS_DIR}/SDKs" "${DEPENDS_DIR}/sdk-sources"
@@ -80,3 +84,5 @@ if [ -n "$ANDROID_HOME" ] && [ ! -d "$ANDROID_HOME" ]; then
8084
unzip -o "$ANDROID_TOOLS_PATH" -d "$ANDROID_HOME"
8185
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}"
8286
fi
87+
88+
git config --global ${CFG_DONE} "true"

ci/test/04_install.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,22 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
5555
$CONTAINER_NAME)
5656
export CI_CONTAINER_ID
5757
export CI_EXEC_CMD_PREFIX="docker exec ${CI_CONTAINER_ID}"
58-
$CI_EXEC_CMD_PREFIX rsync --archive --stats --human-readable /ci_base_install/ "${BASE_ROOT_DIR}"
59-
$CI_EXEC_CMD_PREFIX rsync --archive --stats --human-readable /ro_base/ "$BASE_ROOT_DIR"
60-
# Fixes permission issues when there is a container UID/GID mismatch with the owner
61-
# of the mounted bitcoin src dir.
62-
$CI_EXEC_CMD_PREFIX git config --global --add safe.directory "*"
6358
else
6459
echo "Running on host system without docker wrapper"
65-
"${BASE_ROOT_DIR}/ci/test/01_base_install.sh"
6660
fi
6761

6862
CI_EXEC () {
6963
$CI_EXEC_CMD_PREFIX bash -c "export PATH=${BINS_SCRATCH_DIR}:\$PATH && cd \"$P_CI_DIR\" && $*"
7064
}
7165
export -f CI_EXEC
7266

67+
CI_EXEC rsync --archive --stats --human-readable /ci_base_install/ "${BASE_ROOT_DIR}" || echo "/ci_base_install/ missing"
68+
CI_EXEC "${BASE_ROOT_DIR}/ci/test/01_base_install.sh"
69+
CI_EXEC rsync --archive --stats --human-readable /ro_base/ "${BASE_ROOT_DIR}" || echo "Nothing to copy from ro_base"
70+
# Fixes permission issues when there is a container UID/GID mismatch with the owner
71+
# of the git source code directory.
72+
CI_EXEC git config --global --add safe.directory \"*\"
73+
7374
CI_EXEC mkdir -p "${BINS_SCRATCH_DIR}"
7475

7576
if [ "$CI_OS_NAME" == "macos" ]; then

0 commit comments

Comments
 (0)