Skip to content

Commit 7a8fb2f

Browse files
committed
fix(e2e): mount host workdir for docker e2e
1 parent cc1ab6d commit 7a8fb2f

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/e2e-test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ jobs:
3838
options: --privileged
3939
volumes:
4040
- /var/run/docker.sock:/var/run/docker.sock
41+
- /home/runner/_work:/home/runner/_work
4142
env:
4243
MISE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4344
IMAGE_TAG: ${{ inputs.image-tag }}

e2e/with-docker-gateway.sh

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,27 @@ github_actions_host_docker_tmpdir() {
3232

3333
# Container jobs talk to the host Docker daemon. Bind mount source paths must
3434
# exist on the host, but the gateway also validates those same paths inside
35-
# the job container before handing them to Docker.
36-
if [ ! -e /home/runner/_work ] && [ ! -L /home/runner/_work ]; then
37-
mkdir -p /home/runner 2>/dev/null || return 1
38-
ln -s /__w /home/runner/_work 2>/dev/null || return 1
39-
fi
40-
35+
# the job container before handing them to Docker. This must be a real mount
36+
# rather than a symlink because the Docker driver canonicalizes file paths.
4137
if [ -d /home/runner/_work/_temp ]; then
4238
printf '%s\n' /home/runner/_work/_temp
4339
return 0
4440
fi
4541

46-
return 1
42+
echo "ERROR: GitHub Actions Docker e2e requires /home/runner/_work mounted inside the job container." >&2
43+
echo " Mount /home/runner/_work:/home/runner/_work so Docker bind paths resolve on both sides." >&2
44+
return 2
4745
}
4846

49-
WORKDIR_PARENT="$(github_actions_host_docker_tmpdir || printf '%s\n' "${TMPDIR:-/tmp}")"
47+
if WORKDIR_PARENT="$(github_actions_host_docker_tmpdir)"; then
48+
:
49+
else
50+
status=$?
51+
if [ "${status}" -eq 2 ]; then
52+
exit 2
53+
fi
54+
WORKDIR_PARENT="${TMPDIR:-/tmp}"
55+
fi
5056
WORKDIR_PARENT="${WORKDIR_PARENT%/}"
5157
WORKDIR="$(mktemp -d "${WORKDIR_PARENT}/openshell-e2e-gateway.XXXXXX")"
5258
GATEWAY_BIN="${ROOT}/target/debug/openshell-gateway"

0 commit comments

Comments
 (0)