This is required to pass cross builds on to a different machine after the build.
See for example #31176, but this pull will also allow someone to implement it outside this repo.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/31428.
See the guideline for information on the review process.
Type | Reviewers |
---|---|
ACK | hebasto, davidgumberg |
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update.
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
🚧 At least one of the CI tasks failed. Debug: https://github.com/bitcoin/bitcoin/runs/33978793658
Try to run the tests locally, according to the documentation. However, a CI failure may still happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being incompatible with the current code in the target branch). If so, make sure to rebase on the latest commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the affected test.
An intermittent issue.
Leave a comment here, if you need help tracking down a confusing failure.
279- run: echo "BASE_ROOT_DIR=${RUNNER_TEMP}" >> "$GITHUB_ENV"
280+ - name: Set CI directories
281+ run: |
282+ echo "CCACHE_DIR=${RUNNER_TEMP}/ccache_dir" >> "$GITHUB_ENV"
283+ echo "BASE_ROOT_DIR=${RUNNER_TEMP}" >> "$GITHUB_ENV"
284+ echo "BASE_BUILD_DIR=${RUNNER_TEMP}}/build-asan" >> "$GITHUB_ENV"
An extra brace:
0 echo "BASE_BUILD_DIR=${RUNNER_TEMP}/build-asan" >> "$GITHUB_ENV"
?
${{ runner.temp }}
over ${RUNNER_TEMP}
because it expands in the log, which feels convenient.
I mean, expanded in a log for the current step, like this:
0Run echo "CCACHE_DIR=/home/runner/work/_temp/ccache_dir" >> "$GITHUB_ENV"
1 echo "CCACHE_DIR=/home/runner/work/_temp/ccache_dir" >> "$GITHUB_ENV"
2 echo "BASE_ROOT_DIR=/home/runner/work/_temp" >> "$GITHUB_ENV"
3 echo "DEPENDS_DIR=/home/runner/work/_temp/depends" >> "$GITHUB_ENV"
4 echo "BASE_BUILD_DIR=/home/runner/work/_temp/build" >> "$GITHUB_ENV"
51 # ensure the directories exist
52 mkdir -p "${CCACHE_DIR}"
53 mkdir -p "${DEPENDS_DIR}/built"
54 mkdir -p "${DEPENDS_DIR}/sources"
55 mkdir -p "${PREVIOUS_RELEASES_DIR}"
56+ mkdir -p "${BASE_BUILD_DIR}"
Shouldn’t the definition of BASE_BUILD_DIR
from https://github.com/bitcoin/bitcoin/blob/faf15ef3a78f6ee5ef5fb9468e9de04b5fca6b21/ci/test/03_test_script.sh#L118-L119
be moved before this first usage?
It requires the caller to define it, which is intentional.
Why? What happens if the default value will be used? (especially, if a CI job doesn’t care about it)
Should I add a comment explaining it?
If it helps :)
It requires the caller to define it, which is intentional.
Why? What happens if the default value will be used? (especially, if a CI job doesn’t care about it)
My understanding is that it would fail otherwise. I suspect the error message will be:
0root@7b4d00222340:/# mkdir -p "${BASE_BUILD_DIR}"
1mkdir: cannot create directory '': No such file or directory
2root@7b4d00222340:/# mkdir -p ""
3mkdir: cannot create directory '': No such file or directory
BASE_BUILD_DIR=${BASE_BUILD_DIR:-$BASE_SCRATCH_DIR/build-$HOST}
before.
DANGER_
require in-depth knowledge of the inner workings of the CI system. Trying to make the existing code harder to understand for others seems suboptimal to solve a problem that doesn’t really exist in practise. If there is a strong use-case, I am happy to reconsider, but absent that I don’t see the value in making the code more complex.
99@@ -97,6 +100,7 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
100 --mount "${CI_DEPENDS_MOUNT}" \
101 --mount "${CI_DEPENDS_SOURCES_MOUNT}" \
102 --mount "${CI_PREVIOUS_RELEASES_MOUNT}" \
103+ ${CI_BUILD_MOUNT} \
$CI_BUILD_MOUNT
inconsistent (including --mount
) with the other mount vars?
43@@ -44,18 +44,21 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
44 CI_DEPENDS_MOUNT="type=volume,src=${CONTAINER_NAME}_depends,dst=$DEPENDS_DIR/built"
45 CI_DEPENDS_SOURCES_MOUNT="type=volume,src=${CONTAINER_NAME}_depends_sources,dst=$DEPENDS_DIR/sources"
46 CI_PREVIOUS_RELEASES_MOUNT="type=volume,src=${CONTAINER_NAME}_previous_releases,dst=$PREVIOUS_RELEASES_DIR"
47+ CI_BUILD_MOUNT=""
feel-free-to-disregard-followup: After thinking more about my comment below, (https://github.com/bitcoin/bitcoin/pull/31428/files#r1897104374) It is because we might not use any volume mount for the build dir, and we want to be able to leave it blank here.
But I’m wondering why the build directory doesn’t get it’s own volume, why doesn’t the same reasoning from #27033 apply here?
But I’m wondering why the build directory doesn’t get it’s own volume, why doesn’t the same reasoning from #27033 apply here?
The build output is not really a cache for the next build, but rather the result of the build, so a volume doesn’t help. In fact it can only be overwritten by DANGER_CI_ON_HOST_FOLDERS
, where the goal is to use a folder, not a volume.