aboutsummaryrefslogtreecommitdiff
path: root/ci
diff options
context:
space:
mode:
authorMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-07-30 11:08:52 +0200
committerMarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz>2023-08-09 12:32:44 +0200
commitfafa17c00b87c685200198979ed13018e55e474a (patch)
tree9fc14ef0fb7fbddd34ef7644b9a819bf18a10fce /ci
parentfa084f5ba5dad58a55b5a0a0e9d839c54e9a9238 (diff)
ci: Use hard-coded root path for CI containers
Diffstat (limited to 'ci')
-rwxr-xr-xci/test/00_setup_env.sh14
-rwxr-xr-xci/test/04_install.sh6
2 files changed, 14 insertions, 6 deletions
diff --git a/ci/test/00_setup_env.sh b/ci/test/00_setup_env.sh
index 75b47af0ed..3014714a44 100755
--- a/ci/test/00_setup_env.sh
+++ b/ci/test/00_setup_env.sh
@@ -8,10 +8,18 @@ export LC_ALL=C.UTF-8
set -ex
-# The root dir.
+# The source root dir, usually from git, usually read-only.
# The ci system copies this folder.
-BASE_ROOT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )
-export BASE_ROOT_DIR
+BASE_READ_ONLY_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )
+export BASE_READ_ONLY_DIR
+# The destination root dir inside the container.
+if [ -z "${DANGER_RUN_CI_ON_HOST}" ] ; then
+ # This folder only exists on the ci guest and will be a copy of BASE_READ_ONLY_DIR
+ export BASE_ROOT_DIR="/ci_container_base"
+else
+ # This folder is equal to BASE_READ_ONLY_DIR and is read-write
+ export BASE_ROOT_DIR="${BASE_READ_ONLY_DIR}"
+fi
# The depends dir.
# This folder exists only on the ci guest, and on the ci host as a volume.
export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends}
diff --git a/ci/test/04_install.sh b/ci/test/04_install.sh
index 1f1251bef3..99e16bcb98 100755
--- a/ci/test/04_install.sh
+++ b/ci/test/04_install.sh
@@ -19,11 +19,11 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
docker run --rm "${CI_IMAGE_NAME_TAG}" bash -c "env | grep --extended-regexp '^(HOME|PATH|USER)='" | tee --append /tmp/env
echo "Creating $CI_IMAGE_NAME_TAG container to run in"
DOCKER_BUILDKIT=1 docker build \
- --file "${BASE_ROOT_DIR}/ci/test_imagefile" \
+ --file "${BASE_READ_ONLY_DIR}/ci/test_imagefile" \
--build-arg "CI_IMAGE_NAME_TAG=${CI_IMAGE_NAME_TAG}" \
--build-arg "FILE_ENV=${FILE_ENV}" \
--tag="${CONTAINER_NAME}" \
- "${BASE_ROOT_DIR}"
+ "${BASE_READ_ONLY_DIR}"
docker volume create "${CONTAINER_NAME}_ccache" || true
docker volume create "${CONTAINER_NAME}_depends" || true
docker volume create "${CONTAINER_NAME}_previous_releases" || true
@@ -37,7 +37,7 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
# shellcheck disable=SC2086
CI_CONTAINER_ID=$(docker run $CI_CONTAINER_CAP --rm --interactive --detach --tty \
- --mount type=bind,src=$BASE_ROOT_DIR,dst=/ro_base,readonly \
+ --mount type=bind,src=$BASE_READ_ONLY_DIR,dst=/ro_base,readonly \
--mount "type=volume,src=${CONTAINER_NAME}_ccache,dst=$CCACHE_DIR" \
--mount "type=volume,src=${CONTAINER_NAME}_depends,dst=$DEPENDS_DIR" \
--mount "type=volume,src=${CONTAINER_NAME}_previous_releases,dst=$PREVIOUS_RELEASES_DIR" \