1
0
mirror of synced 2026-09-11 17:09:47 +00:00

devops(pipeline): resolve Maven and npm packages from DevDiv_PublicPackages feed (#1971)

This commit is contained in:
Yury Semikhatsky
2026-09-03 15:41:23 -07:00
committed by GitHub
parent 382398631c
commit 391cb63ebf
4 changed files with 71 additions and 20 deletions
+16 -19
View File
@@ -37,36 +37,30 @@ download() {
}
DRIVER_VERSION=$(head -1 ./DRIVER_VERSION)
ROOT="$(cd .. && pwd)"
# Resolve the exact upstream commit that produced this driver version, so that the
# bundled Node.js version matches the driver exactly.
GIT_HEAD=$(npm view playwright@"$DRIVER_VERSION" gitHead)
if [[ -z "$GIT_HEAD" ]]; then
echo "Failed to resolve upstream commit (gitHead) for playwright@$DRIVER_VERSION"
exit 1
fi
# All npm commands run from the repository root so that a root-level .npmrc (e.g. the one
# the release pipeline writes to point at the internal Azure Artifacts feed) is honoured.
# Locally, NPM_CONFIG_REGISTRY=<url> can be used to the same effect.
npm_at_root() {
(cd "$ROOT" && npm "$@")
}
# The Node.js version used to be pinned in the upstream driver build script. The script was
# removed in microsoft/playwright#41518, so for newer versions we follow the same policy it
# had: the latest Node.js LTS (see upstream utils/build/update-playwright-node.mjs).
NODE_VERSION=$(curl -fsSL "https://raw.githubusercontent.com/microsoft/playwright/$GIT_HEAD/utils/build/build-playwright-driver.sh" 2>/dev/null \
| sed -n 's/^NODE_VERSION="\([^"]*\)".*/\1/p')
# removed in microsoft/playwright#41518, so we follow the same policy it had: the latest
# Node.js LTS (see upstream utils/build/update-playwright-node.mjs).
NODE_VERSION=$(curl -fsSL "https://nodejs.org/dist/index.json" \
| node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>console.log(JSON.parse(s).find(r=>r.lts).version.slice(1)))")
if [[ -z "$NODE_VERSION" ]]; then
NODE_VERSION=$(curl -fsSL "https://nodejs.org/dist/index.json" \
| node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>console.log(JSON.parse(s).find(r=>r.lts).version.slice(1)))")
fi
if [[ -z "$NODE_VERSION" ]]; then
echo "Failed to determine Node.js version for playwright@$DRIVER_VERSION ($GIT_HEAD)"
echo "Failed to determine the latest Node.js LTS version"
exit 1
fi
echo "Driver version: $DRIVER_VERSION"
echo "Upstream commit: $GIT_HEAD"
echo "Node.js version: $NODE_VERSION"
# The platform-independent driver code (playwright-core) is assembled once into the driver module;
# the Node.js binary for each platform is assembled into the driver-bundle module. See issue #1196.
ROOT="$(cd .. && pwd)"
CORE_DEST="$ROOT/driver/src/main/resources/driver"
NODE_DEST="$ROOT/driver-bundle/src/main/resources/driver"
@@ -77,8 +71,11 @@ trap 'rm -rf "$TMP_DIR"' EXIT
echo "Assembling playwright-core package to $CORE_DEST/package"
rm -rf "$CORE_DEST/package"
mkdir -p "$CORE_DEST"
# Fetched via npm rather than a hard-coded registry URL so that the configured registry
# (and its credentials) are used.
CORE_TGZ="$TMP_DIR/playwright-core-$DRIVER_VERSION.tgz"
download "https://registry.npmjs.org/playwright-core/-/playwright-core-$DRIVER_VERSION.tgz" "$CORE_TGZ"
echo "Downloading playwright-core@$DRIVER_VERSION from $(npm_at_root config get registry)"
npm_at_root pack "playwright-core@$DRIVER_VERSION" --pack-destination "$TMP_DIR" --silent > /dev/null
# The npm tarball has a top-level package/ directory, so this creates $CORE_DEST/package.
tar -xzf "$CORE_TGZ" -C "$CORE_DEST"
rm -f "$CORE_TGZ"