Use docker cp instead of a bind mount to get repo files into the playwright container
This script runs inside the runner's own job container and talks to the host's docker daemon over a mounted socket (docker-outside-of-docker). A bind mount path only exists inside this job container, not on the host the daemon resolves it against, so docker run -v failed with ENOENT. docker cp copies file contents instead, sidestepping the path mismatch.
This commit is contained in:
@@ -36,12 +36,20 @@ npm --prefix src/admin ci
|
|||||||
# at /ms-playwright), as a sibling container reachable at the same bridge
|
# at /ms-playwright), as a sibling container reachable at the same bridge
|
||||||
# gateway IP used above. Pin the image tag to the exact resolved
|
# gateway IP used above. Pin the image tag to the exact resolved
|
||||||
# @playwright/test version so the test runner and browser build match.
|
# @playwright/test version so the test runner and browser build match.
|
||||||
|
#
|
||||||
|
# This script itself runs inside the runner's own job container, talking to
|
||||||
|
# the host's docker daemon over a mounted socket (docker-outside-of-docker) -
|
||||||
|
# `docker run -v "$CI_ROOT:/work"` would ask the *host* daemon to bind-mount a
|
||||||
|
# path that only exists inside this job container, which fails. `docker cp`
|
||||||
|
# instead copies the files by content, sidestepping the path mismatch.
|
||||||
PW_VERSION="$(node -p "require('./src/admin/node_modules/@playwright/test/package.json').version")"
|
PW_VERSION="$(node -p "require('./src/admin/node_modules/@playwright/test/package.json').version")"
|
||||||
log "Running Playwright admin e2e suite against $BASE_URL (playwright:v$PW_VERSION-noble)"
|
log "Running Playwright admin e2e suite against $BASE_URL (playwright:v$PW_VERSION-noble)"
|
||||||
docker run --rm \
|
|
||||||
-e "E2E_BASE_URL=$BASE_URL" \
|
PW_CONTAINER="$(docker create -e "E2E_BASE_URL=$BASE_URL" -w /work/src/admin "mcr.microsoft.com/playwright:v${PW_VERSION}-noble" npm run e2e)"
|
||||||
-v "$CI_ROOT:/work" -w /work/src/admin \
|
docker cp "$CI_ROOT/." "$PW_CONTAINER:/work"
|
||||||
"mcr.microsoft.com/playwright:v${PW_VERSION}-noble" \
|
pw_status=0
|
||||||
npm run e2e
|
docker start -a "$PW_CONTAINER" || pw_status=$?
|
||||||
|
docker rm -f "$PW_CONTAINER" > /dev/null
|
||||||
|
[[ "$pw_status" -eq 0 ]] || fail "Playwright e2e suite failed (exit $pw_status)"
|
||||||
|
|
||||||
log "smoke-qa.sh complete - QA environment validated end to end"
|
log "smoke-qa.sh complete - QA environment validated end to end"
|
||||||
|
|||||||
Reference in New Issue
Block a user