Skip to content

Commit 58a497c

Browse files
ci: also rewrite npm-proxy.dev URLs to JFrog in setup-jfrog
Diagnostic run revealed the package-lock.json contains 415 URLs pointing to `npm-proxy.dev.databricks.com` (in addition to 774 pointing to `registry.npmjs.org`). The internal dev-proxy URLs are written by `npm install` when the lockfile is regenerated on a dev workstation whose .npmrc points to that proxy. Protected runners cannot reach npm-proxy.dev.databricks.com — every fetch fails with ECONNRESET, npm retries (default 2 attempts), then gives up with "Exit handler never called", skipping bin-linking and breaking downstream `prettier`/`nyc` calls. Extend the sed rewrite to cover both registry hosts so all `resolved:` URLs route through JFrog regardless of where the lockfile was generated. Also print the post-rewrite URL distribution so future debugging is one log scroll away. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
1 parent fcf36d9 commit 58a497c

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

.github/actions/setup-jfrog/action.yml

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,28 @@ runs:
3737
3838
# Rewrite lockfile `resolved:` URLs to JFrog. `npm ci` honors the
3939
# lockfile's `resolved:` URL over the `.npmrc` registry; protected
40-
# runners cannot reach `registry.npmjs.org` directly, so without
41-
# this rewrite npm hangs ~8 minutes on any package not already in
42-
# the `~/.npm` cache, then dies with "Exit handler never called".
43-
# The committed lockfile is kept in standard form (public-npm URLs)
44-
# so contributors can `npm ci` locally; this step adapts it for CI.
40+
# runners cannot reach `registry.npmjs.org` or the internal
41+
# `npm-proxy.dev.databricks.com` directly, so without this rewrite
42+
# npm hangs ~8 minutes on any package whose `resolved:` points
43+
# elsewhere, then dies with "Exit handler never called".
44+
# The committed lockfile is kept as-generated locally (mixed
45+
# public-npm + dev-proxy URLs) so contributors can `npm ci`
46+
# locally; this step adapts it for CI.
4547
- name: Rewrite lockfile to JFrog registry
4648
shell: bash
4749
run: |
4850
set -euo pipefail
4951
if [ -f package-lock.json ]; then
50-
sed -i 's|https://registry.npmjs.org|https://databricks.jfrog.io/artifactory/api/npm/db-npm|g' package-lock.json
52+
# Rewrite both public npm and the internal dev-proxy (the
53+
# latter is written by `npm install` when run on a dev
54+
# workstation whose .npmrc points at npm-proxy.dev).
55+
sed -i \
56+
-e 's|https://registry.npmjs.org|https://databricks.jfrog.io/artifactory/api/npm/db-npm|g' \
57+
-e 's|https://npm-proxy.dev.databricks.com|https://databricks.jfrog.io/artifactory/api/npm/db-npm|g' \
58+
package-lock.json
5159
echo "package-lock.json resolved: URLs rewritten to JFrog"
60+
echo "Resolved URL distribution after rewrite:"
61+
grep -oE '"resolved": "https://[^/]+' package-lock.json | sort | uniq -c
5262
else
5363
echo "no package-lock.json found; skipping rewrite"
5464
fi

0 commit comments

Comments
 (0)