Skip to content

Commit 06bb825

Browse files
committed
fix(docker): download driver without npm and curl
The docker image build has neither npm nor curl, only wget. Resolve the upstream gitHead via the npm registry HTTP API and fetch the upstream build script through the existing wget-or-curl helper.
1 parent 1b7d164 commit 06bb825

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

scripts/download_driver.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,22 @@ download() {
3737
DRIVER_VERSION=$(head -1 ./DRIVER_VERSION)
3838

3939
# Resolve the exact upstream commit that produced this driver version, so that the
40-
# bundled Node.js version matches the driver exactly.
41-
GIT_HEAD=$(npm view playwright@"$DRIVER_VERSION" gitHead)
40+
# bundled Node.js version matches the driver exactly. Query the npm registry over
41+
# HTTP instead of the npm CLI which is not available in the docker image build.
42+
VERSION_MANIFEST=$(mktemp)
43+
download "https://registry.npmjs.org/playwright/$DRIVER_VERSION" "$VERSION_MANIFEST"
44+
GIT_HEAD=$(grep -o '"gitHead"[[:space:]]*:[[:space:]]*"[0-9a-f]\{40\}"' "$VERSION_MANIFEST" | head -1 | grep -o '[0-9a-f]\{40\}')
45+
rm -f "$VERSION_MANIFEST"
4246
if [[ -z "$GIT_HEAD" ]]; then
4347
echo "Failed to resolve upstream commit (gitHead) for playwright@$DRIVER_VERSION"
4448
exit 1
4549
fi
4650

4751
# The Node.js version is kept in sync with the driver version in the upstream build script.
48-
NODE_VERSION=$(curl -fsSL "https://raw.githubusercontent.com/microsoft/playwright/$GIT_HEAD/utils/build/build-playwright-driver.sh" \
49-
| sed -n 's/^NODE_VERSION="\([^"]*\)".*/\1/p')
52+
BUILD_SCRIPT=$(mktemp)
53+
download "https://raw.githubusercontent.com/microsoft/playwright/$GIT_HEAD/utils/build/build-playwright-driver.sh" "$BUILD_SCRIPT"
54+
NODE_VERSION=$(sed -n 's/^NODE_VERSION="\([^"]*\)".*/\1/p' "$BUILD_SCRIPT")
55+
rm -f "$BUILD_SCRIPT"
5056
if [[ -z "$NODE_VERSION" ]]; then
5157
echo "Failed to determine Node.js version for playwright@$DRIVER_VERSION ($GIT_HEAD)"
5258
exit 1

0 commit comments

Comments
 (0)