Skip to content

Commit ad654a4

Browse files
committed
Merge bitcoin#32767: ci: Allow running CI in worktrees
fa68dcb ci: Add missing errexit to lint CI install (MarcoFalke) fa535a6 ci: Allow running CI in worktrees (MarcoFalke) faf6a04 ci: Clean UID/GID mismatch (MarcoFalke) Pull request description: Fixes bitcoin#30028 (modulo lint and tidy CI). The error on current master in a worktree is: ``` $ git worktree add ./main origin/master && cd ./main $ MAKEJOBS="-j$(nproc)" FILE_ENV="./ci/test/00_setup_env_mac_cross.sh" ./ci/test_run_all.sh ... + git config --global ci.base-install-done true fatal: not a git repository: /root/b-c-ci/.git/worktrees/main ``` So just use a plain file, instead of git. Also, enable pipefail while touching this bash script. ACKs for top commit: willcl-ark: tACK fa68dcb Tree-SHA512: 0ce360a80883b4aa655fe8a99c38eb54a465b17c7cdb0a69a2d886ff78da32d6af996412ffc5b0db0322acafa9650619838573484de8243dc41594a04a6e17ec
2 parents 67e6746 + fa68dcb commit ad654a4

File tree

6 files changed

+10
-12
lines changed

6 files changed

+10
-12
lines changed

ci/lint/04_install.sh renamed to ci/lint/01_install.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
export LC_ALL=C
88

9+
set -o errexit -o pipefail -o xtrace
10+
911
export CI_RETRY_EXE="/ci_retry --"
1012

1113
pushd "/"

ci/lint_imagefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ ENV LC_ALL=C.UTF-8
1212
COPY ./ci/retry/retry /ci_retry
1313
COPY ./.python-version /.python-version
1414
COPY ./ci/lint/container-entrypoint.sh /entrypoint.sh
15-
COPY ./ci/lint/04_install.sh /install.sh
15+
COPY ./ci/lint/01_install.sh /install.sh
1616

1717
RUN /install.sh && \
1818
echo 'alias lint="./ci/lint/06_script.sh"' >> ~/.bashrc && \

ci/lint_run_all.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ cp "./ci/retry/retry" "/ci_retry"
1313
cp "./.python-version" "/.python-version"
1414
mkdir --parents "/test/lint"
1515
cp --recursive "./test/lint/test_runner" "/test/lint/"
16-
set -o errexit; source ./ci/lint/04_install.sh
16+
set -o errexit; source ./ci/lint/01_install.sh
1717
set -o errexit
1818
./ci/lint/06_script.sh

ci/test/01_base_install.sh

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

77
export LC_ALL=C.UTF-8
88

9-
set -ex
9+
set -o errexit -o pipefail -o xtrace
1010

11-
CFG_DONE="ci.base-install-done" # Use a global git setting to remember whether this script ran to avoid running it twice
11+
CFG_DONE="${BASE_ROOT_DIR}/ci.base-install-done" # Use a global setting to remember whether this script ran to avoid running it twice
1212

13-
if [ "$(git config --global ${CFG_DONE})" == "true" ]; then
13+
if [ "$( cat "${CFG_DONE}" || true )" == "done" ]; then
1414
echo "Skip base install"
1515
exit 0
1616
fi
@@ -105,4 +105,4 @@ if [ -n "$XCODE_VERSION" ] && [ ! -d "${DEPENDS_DIR}/SDKs/${OSX_SDK_BASENAME}" ]
105105
tar -C "${DEPENDS_DIR}/SDKs" -xf "$OSX_SDK_PATH"
106106
fi
107107

108-
git config --global ${CFG_DONE} "true"
108+
echo -n "done" > "${CFG_DONE}"

ci/test/02_run_container.sh

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,13 +153,9 @@ CI_EXEC () {
153153
export -f CI_EXEC
154154

155155
# Normalize all folders to BASE_ROOT_DIR
156-
CI_EXEC rsync --archive --stats --human-readable "${BASE_READ_ONLY_DIR}/" "${BASE_ROOT_DIR}" || echo "Nothing to copy from ${BASE_READ_ONLY_DIR}/"
156+
CI_EXEC rsync --recursive --perms --stats --human-readable "${BASE_READ_ONLY_DIR}/" "${BASE_ROOT_DIR}" || echo "Nothing to copy from ${BASE_READ_ONLY_DIR}/"
157157
CI_EXEC "${BASE_ROOT_DIR}/ci/test/01_base_install.sh"
158158

159-
# Fixes permission issues when there is a container UID/GID mismatch with the owner
160-
# of the git source code directory.
161-
CI_EXEC git config --global --add safe.directory \"*\"
162-
163159
CI_EXEC mkdir -p "${BINS_SCRATCH_DIR}"
164160

165161
CI_EXEC "${BASE_ROOT_DIR}/ci/test/03_test_script.sh"

test/lint/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ or `--help`:
5454
| `py_lint` | [ruff](https://github.com/astral-sh/ruff)
5555
| markdown link check | [mlc](https://github.com/becheran/mlc)
5656

57-
In use versions and install instructions are available in the [CI setup](../../ci/lint/04_install.sh).
57+
In use versions and install instructions are available in the [CI setup](../../ci/lint/01_install.sh).
5858

5959
Please be aware that on Linux distributions all dependencies are usually available as packages, but could be outdated.
6060

0 commit comments

Comments
 (0)