Skip to content

Commit 1b16c71

Browse files
committed
fix(ci): reinstall stale graph-ui node_modules in the license gate
License gate step 3/3 ran `npm ci` only when graph-ui/node_modules was missing. Jenkins main build #32 (commit 2093ca0) reused a node_modules tree left in the persistent workspace by build #31 (2026-10-06), which was installed from a lockfile that predates the @types/node devDependency. The install was skipped, `tsc -b` failed with TS2688 "Cannot find type definition file for 'node'", and every later stage was skipped. A stale tree is also a correctness problem for the gate itself: the npm license check would inspect packages that are not the ones this candidate ships. The gate now reuses an existing tree only when `npm ls --all` confirms it matches package.json and package-lock.json. Otherwise it runs `npm ci --ignore-scripts`, which replaces the tree. A fresh `npm ci` of the current lockfile passes `npm ls --all`, so a matching tree does not trigger a reinstall on every run. Since 9f26f16 the Jenkinsfile also cleans the workspace after each build. This change keeps the gate correct for local runs and for any workspace the cleanup misses.
1 parent 2093ca0 commit 1b16c71

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎scripts/license-gate.sh‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ echo "=== License gate 3/3: UI npm production tree ==="
113113
# production dependency tree must be allow-listed too. --ignore-scripts: no
114114
# dependency postinstall code runs inside the security job.
115115
if command -v npm &>/dev/null && [ -f graph-ui/package-lock.json ]; then
116-
if [ ! -d graph-ui/node_modules ]; then
116+
# Reuse an existing tree only when it matches the lockfile. A directory
117+
# left over from an older checkout (persistent CI workspace, stale local
118+
# clone) would otherwise skip the install, build against missing packages,
119+
# and license-check a tree that is not the one this candidate ships.
120+
if [ ! -d graph-ui/node_modules ] ||
121+
! (cd graph-ui && npm ls --all >/dev/null 2>&1); then
117122
(cd graph-ui && npm ci --ignore-scripts --silent)
118123
fi
119124
# The optional native image-processing package may be absent from the

0 commit comments

Comments
 (0)