ci: use docker build cache arg directly
What changed, and why it matters
This commit removes a CI (Continuous Integration) shell script feature that managed a local Docker build cache directory. It is a cleanup/revert of an earlier change and does not touch any Bitcoin Core node, wallet, consensus, or network code. There is no security-relevant change to user-facing software.
No security action required. Treat as routine CI maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff reverts PR #31545’s host-side Docker build cache logic in ci/test/02_run_container.sh. It deletes ~30 lines that interpreted DANGER_DOCKER_BUILD_CACHE_HOST_DIR, created temporary cache directories, constructed –cache-from/–cache-to arguments, and moved cache data after docker build. The remaining script simply uses the pre-existing $DOCKER_BUILD_CACHE_ARG variable directly. No cryptographic, consensus, P2P, RPC, or wallet code is modified.
Changed components
ci/test/02_run_container.shInspect captured patch +0 / −32
diff --git a/ci/test/02_run_container.sh b/ci/test/02_run_container.sh
index b3553f7f..eefac848 100755
--- a/ci/test/02_run_container.sh
+++ b/ci/test/02_run_container.sh
@@ -19,29 +19,6 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
fi
echo "Creating $CI_IMAGE_NAME_TAG container to run in"
- DOCKER_BUILD_CACHE_ARG=""
- DOCKER_BUILD_CACHE_TEMPDIR=""
- DOCKER_BUILD_CACHE_OLD_DIR=""
- DOCKER_BUILD_CACHE_NEW_DIR=""
- # If set, use an `docker build` cache directory on the CI host
- # to cache docker image layers for the CI container image.
- # This cache can be multiple GB in size. Prefixed with DANGER
- # as setting it removes (old cache) files from the host.
- if [ "$DANGER_DOCKER_BUILD_CACHE_HOST_DIR" ]; then
- # Directory where the current cache for this run could be. If not existing
- # or empty, "docker build" will warn, but treat it as cache-miss and continue.
- DOCKER_BUILD_CACHE_OLD_DIR="${DANGER_DOCKER_BUILD_CACHE_HOST_DIR}/${CONTAINER_NAME}"
- # Temporary directory for a newly created cache. We can't write the new
- # cache into OLD_DIR directly, as old cache layers would not be removed.
- # The NEW_DIR contents are moved to OLD_DIR after OLD_DIR has been cleared.
- # This happens after `docker build`. If a task fails or is aborted, the
- # DOCKER_BUILD_CACHE_TEMPDIR might be retained on the host. If the host isn't
- # ephemeral, it has to take care of cleaning old TEMPDIR's up.
- DOCKER_BUILD_CACHE_TEMPDIR="$(mktemp --directory ci-docker-build-cache-XXXXXXXXXX)"
- DOCKER_BUILD_CACHE_NEW_DIR="${DOCKER_BUILD_CACHE_TEMPDIR}/${CONTAINER_NAME}"
- DOCKER_BUILD_CACHE_ARG="--cache-from type=local,src=${DOCKER_BUILD_CACHE_OLD_DIR} --cache-to type=local,dest=${DOCKER_BUILD_CACHE_NEW_DIR},mode=max"
- fi
-
# Use buildx unconditionally
# Using buildx is required to properly load the correct driver, for use with registry caching. Neither build, nor BUILDKIT=1 currently do this properly
# shellcheck disable=SC2086
@@ -56,15 +33,6 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
$DOCKER_BUILD_CACHE_ARG \
"${BASE_READ_ONLY_DIR}"
- if [ "$DANGER_DOCKER_BUILD_CACHE_HOST_DIR" ]; then
- if [ -e "${DOCKER_BUILD_CACHE_NEW_DIR}/index.json" ]; then
- echo "Removing the existing docker build cache in ${DOCKER_BUILD_CACHE_OLD_DIR}"
- rm -rf "${DOCKER_BUILD_CACHE_OLD_DIR}"
- echo "Moving the contents of ${DOCKER_BUILD_CACHE_NEW_DIR} to ${DOCKER_BUILD_CACHE_OLD_DIR}"
- mv "${DOCKER_BUILD_CACHE_NEW_DIR}" "${DOCKER_BUILD_CACHE_OLD_DIR}"
- fi
- fi
-
docker volume create "${CONTAINER_NAME}_ccache" || true
docker volume create "${CONTAINER_NAME}_depends" || true
docker volume create "${CONTAINER_NAME}_depends_sources" || true
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.