Skip to content

Commit 5fffff5

Browse files
author
MarcoFalke
committed
ci: Cache stuff in volumes, not host folders
1 parent 1bcabe6 commit 5fffff5

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

ci/test/00_setup_env.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ export LC_ALL=C.UTF-8
88

99
# The root dir.
1010
# The ci system copies this folder.
11-
# This is where the depends build is done.
1211
BASE_ROOT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )
1312
export BASE_ROOT_DIR
1413
# The depends dir.
15-
# This folder exists on the ci host and ci guest. Changes are propagated back and forth.
14+
# This folder exists only on the ci guest, and on the ci host as a volume.
1615
export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends}
1716
# A folder for the ci system to put temporary files (ccache, datadirs for tests, ...)
1817
# This folder only exists on the ci host.
@@ -58,12 +57,14 @@ export CCACHE_SIZE=${CCACHE_SIZE:-100M}
5857
export CCACHE_TEMPDIR=${CCACHE_TEMPDIR:-/tmp/.ccache-temp}
5958
export CCACHE_COMPRESS=${CCACHE_COMPRESS:-1}
6059
# The cache dir.
61-
# This folder exists on the ci host and ci guest. Changes are propagated back and forth.
60+
# This folder exists only on the ci guest, and on the ci host as a volume.
6261
export CCACHE_DIR=${CCACHE_DIR:-$BASE_SCRATCH_DIR/.ccache}
6362
# Folder where the build result is put (bin and lib).
6463
export BASE_OUTDIR=${BASE_OUTDIR:-$BASE_SCRATCH_DIR/out/$HOST}
6564
# Folder where the build is done (dist and out-of-tree build).
6665
export BASE_BUILD_DIR=${BASE_BUILD_DIR:-$BASE_SCRATCH_DIR/build}
66+
# The folder for previous release binaries.
67+
# This folder exists only on the ci guest, and on the ci host as a volume.
6768
export PREVIOUS_RELEASES_DIR=${PREVIOUS_RELEASES_DIR:-$BASE_ROOT_DIR/releases/$HOST}
6869
export SDK_URL=${SDK_URL:-https://bitcoincore.org/depends-sources/sdks}
6970
export CI_BASE_PACKAGES=${CI_BASE_PACKAGES:-build-essential libtool autotools-dev automake pkg-config bsdmainutils curl ca-certificates ccache python3 rsync git procps bison}

ci/test/04_install.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
3939
--build-arg "FILE_ENV=${FILE_ENV}" \
4040
--tag="${CONTAINER_NAME}" \
4141
"${BASE_ROOT_DIR}"
42+
docker volume create "${CONTAINER_NAME}_ccache" || true
43+
docker volume create "${CONTAINER_NAME}_depends" || true
44+
docker volume create "${CONTAINER_NAME}_previous_releases" || true
4245

4346
if [ -n "${RESTART_CI_DOCKER_BEFORE_RUN}" ] ; then
4447
echo "Restart docker before run to stop and clear all containers started with --rm"
@@ -48,9 +51,9 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
4851
# shellcheck disable=SC2086
4952
CI_CONTAINER_ID=$(docker run $CI_CONTAINER_CAP --rm --interactive --detach --tty \
5053
--mount type=bind,src=$BASE_ROOT_DIR,dst=/ro_base,readonly \
51-
--mount type=bind,src=$CCACHE_DIR,dst=$CCACHE_DIR \
52-
--mount type=bind,src=$DEPENDS_DIR,dst=$DEPENDS_DIR \
53-
--mount type=bind,src=$PREVIOUS_RELEASES_DIR,dst=$PREVIOUS_RELEASES_DIR \
54+
--mount "type=volume,src=${CONTAINER_NAME}_ccache,dst=$CCACHE_DIR" \
55+
--mount "type=volume,src=${CONTAINER_NAME}_depends,dst=$DEPENDS_DIR" \
56+
--mount "type=volume,src=${CONTAINER_NAME}_previous_releases,dst=$PREVIOUS_RELEASES_DIR" \
5457
-w $BASE_ROOT_DIR \
5558
--env-file /tmp/env \
5659
--name $CONTAINER_NAME \

0 commit comments

Comments
 (0)