Skip to content

Commit 63744f7

Browse files
authored
fix: remove no-bind-mounts from tests and documentation (#23)
1 parent 60ec7df commit 63744f7

File tree

4 files changed

+32
-16
lines changed

4 files changed

+32
-16
lines changed

.github/workflows/test.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,9 @@ jobs:
2020
-
2121
name: Docker info
2222
run: docker info
23-
-
24-
name: Set up QEMU
25-
uses: docker/setup-qemu-action@v3
2623
-
2724
name: Set up Docker Buildx
2825
uses: docker/setup-buildx-action@v3
29-
with:
30-
platforms: linux/amd64,linux/arm64
3126
-
3227
name: Setup bats and bats libs
3328
id: setup-bats

docs/gitlab-com.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ ddev-initialize:
2020
- name: docker:dind
2121
when: always
2222
script:
23-
# Fix for: Error response from daemon: invalid mount config for type "bind": bind source path does not exist: /builds/*/*'
24-
- ddev config global --no-bind-mounts=true
2523
- ddev --version
2624
# ... do things
2725
```

tests/setup_suite.bash

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,28 @@ setup_suite() {
99
docker network create "$NETWORK"
1010
fi
1111

12-
docker run --privileged -e DOCKER_TLS_CERTDIR="" --name ddev-dind -d --network ddev-docker --network-alias docker docker:dind
12+
# Create a shared volume for bind mounts
13+
SHARED_VOLUME="ddev-shared-volume"
14+
if docker volume inspect "$SHARED_VOLUME" &>/dev/null; then
15+
echo "Volume '$SHARED_VOLUME' already exists."
16+
else
17+
echo "Creating volume '$SHARED_VOLUME'."
18+
docker volume create "$SHARED_VOLUME"
19+
fi
20+
21+
# Initialize the shared volume with full permissions
22+
docker run --rm \
23+
-v "$SHARED_VOLUME:/mnt/ddev-shared" \
24+
alpine:latest sh -c "mkdir -p /mnt/ddev-shared && chmod -R 777 /mnt/ddev-shared"
25+
26+
# Run DIND with the shared volume mounted
27+
docker run --privileged -e DOCKER_TLS_CERTDIR="" \
28+
--name ddev-dind \
29+
-d \
30+
--network ddev-docker \
31+
--network-alias docker \
32+
-v "$SHARED_VOLUME:/mnt/ddev-shared" \
33+
docker:dind
1334
waitForDinD
1435
}
1536

@@ -33,4 +54,5 @@ waitForDinD() {
3354
teardown_suite() {
3455
docker stop ddev-dind
3556
docker rm ddev-dind
57+
docker volume rm ddev-shared-volume
3658
}

tests/test.bats

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ setup() {
4242

4343
@test "Create and run a ddev project" {
4444
local TEST_COMMAND="
45-
mkdir ~/ddev-test
46-
cd ~/ddev-test
45+
mkdir -p /mnt/ddev-shared/ddev-test
46+
cd /mnt/ddev-shared/ddev-test
4747
echo '<?php echo \"Hello World\";' > index.php
4848
ddev config --project-type php --auto
49-
ddev config global --no-bind-mounts=true
5049
ddev start
5150
curl https://ddev-test.ddev.site/index.php
5251
ddev poweroff
@@ -66,13 +65,11 @@ setup() {
6665
assert_success
6766
}
6867

69-
# Use "--no-bind-mounts=true" to make "ddev debug test" pass. This is only required in testing environment
7068
@test "Run ddev debug test" {
7169
local TEST_COMMAND="
72-
mkdir ~/ddev-test
73-
cd ~/ddev-test
70+
mkdir -p /mnt/ddev-shared/ddev-test-debug
71+
cd /mnt/ddev-shared/ddev-test-debug
7472
ddev config --project-type php --auto
75-
ddev config global --no-bind-mounts=true
7673
ddev debug test
7774
"
7875
run docker-run "${TEST_COMMAND}"
@@ -84,5 +81,9 @@ setup() {
8481
docker-run() {
8582
local COMMAND=${1}
8683

87-
docker run --rm -it --network ddev-docker ghcr.io/ddev/ddev-gitlab-ci:"${DDEV_VERSION}" /bin/sh -c "${COMMAND}"
84+
# Mount the shared volume to make bind mounts work
85+
docker run --rm -it \
86+
--network ddev-docker \
87+
-v "ddev-shared-volume:/mnt/ddev-shared" \
88+
ghcr.io/ddev/ddev-gitlab-ci:"${DDEV_VERSION}" /bin/sh -c "${COMMAND}"
8889
}

0 commit comments

Comments
 (0)