Skip to content

Commit fafa17c

Browse files
author
MarcoFalke
committed
ci: Use hard-coded root path for CI containers
1 parent fa084f5 commit fafa17c

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

ci/test/00_setup_env.sh

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

99
set -ex
1010

11-
# The root dir.
11+
# The source root dir, usually from git, usually read-only.
1212
# The ci system copies this folder.
13-
BASE_ROOT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )
14-
export BASE_ROOT_DIR
13+
BASE_READ_ONLY_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )"/../../ >/dev/null 2>&1 && pwd )
14+
export BASE_READ_ONLY_DIR
15+
# The destination root dir inside the container.
16+
if [ -z "${DANGER_RUN_CI_ON_HOST}" ] ; then
17+
# This folder only exists on the ci guest and will be a copy of BASE_READ_ONLY_DIR
18+
export BASE_ROOT_DIR="/ci_container_base"
19+
else
20+
# This folder is equal to BASE_READ_ONLY_DIR and is read-write
21+
export BASE_ROOT_DIR="${BASE_READ_ONLY_DIR}"
22+
fi
1523
# The depends dir.
1624
# This folder exists only on the ci guest, and on the ci host as a volume.
1725
export DEPENDS_DIR=${DEPENDS_DIR:-$BASE_ROOT_DIR/depends}

ci/test/04_install.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,11 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
1919
docker run --rm "${CI_IMAGE_NAME_TAG}" bash -c "env | grep --extended-regexp '^(HOME|PATH|USER)='" | tee --append /tmp/env
2020
echo "Creating $CI_IMAGE_NAME_TAG container to run in"
2121
DOCKER_BUILDKIT=1 docker build \
22-
--file "${BASE_ROOT_DIR}/ci/test_imagefile" \
22+
--file "${BASE_READ_ONLY_DIR}/ci/test_imagefile" \
2323
--build-arg "CI_IMAGE_NAME_TAG=${CI_IMAGE_NAME_TAG}" \
2424
--build-arg "FILE_ENV=${FILE_ENV}" \
2525
--tag="${CONTAINER_NAME}" \
26-
"${BASE_ROOT_DIR}"
26+
"${BASE_READ_ONLY_DIR}"
2727
docker volume create "${CONTAINER_NAME}_ccache" || true
2828
docker volume create "${CONTAINER_NAME}_depends" || true
2929
docker volume create "${CONTAINER_NAME}_previous_releases" || true
@@ -37,7 +37,7 @@ if [ -z "$DANGER_RUN_CI_ON_HOST" ]; then
3737

3838
# shellcheck disable=SC2086
3939
CI_CONTAINER_ID=$(docker run $CI_CONTAINER_CAP --rm --interactive --detach --tty \
40-
--mount type=bind,src=$BASE_ROOT_DIR,dst=/ro_base,readonly \
40+
--mount type=bind,src=$BASE_READ_ONLY_DIR,dst=/ro_base,readonly \
4141
--mount "type=volume,src=${CONTAINER_NAME}_ccache,dst=$CCACHE_DIR" \
4242
--mount "type=volume,src=${CONTAINER_NAME}_depends,dst=$DEPENDS_DIR" \
4343
--mount "type=volume,src=${CONTAINER_NAME}_previous_releases,dst=$PREVIOUS_RELEASES_DIR" \

0 commit comments

Comments
 (0)