[CCSDK] try to fix npm auth in playwright job 28/143528/1 master
authorFiete Ostkamp <fiete.ostkamp@telekom.de>
Fri, 6 Mar 2026 15:44:26 +0000 (16:44 +0100)
committerFiete Ostkamp <fiete.ostkamp@telekom.de>
Fri, 6 Mar 2026 15:44:26 +0000 (16:44 +0100)
- add custom npm config to avoid attempting npm login

Issue-ID: CCSDK-4176
Change-Id: I9962e0a7241c5bea4a2092686091185ce535c940
Signed-off-by: Fiete Ostkamp <fiete.ostkamp@telekom.de>
jjb/ccsdk/cds-playwright-e2e.sh

index 33684bc..9bf4f7d 100755 (executable)
@@ -40,6 +40,24 @@ npm_install() {
        fi
 }
 
+npm_install_public_registry() {
+       local userconfig rc
+       userconfig="$(mktemp /tmp/npmrc-public.XXXXXX)"
+       cat > "$userconfig" << 'EOF'
+registry=https://registry.npmjs.org/
+always-auth=false
+EOF
+
+       rc=0
+       if [[ -f package-lock.json ]]; then
+               npm ci --userconfig "$userconfig" || rc=$?
+       else
+               npm install --userconfig "$userconfig" || rc=$?
+       fi
+       rm -f "$userconfig"
+       return "$rc"
+}
+
 # ── Install dependencies for each component ───────────────────────────────────
 
 echo "---> Installing server (LoopBack BFF) dependencies"
@@ -52,7 +70,7 @@ npm_install
 
 echo "---> Installing e2e-playwright dependencies"
 cd "$WORKSPACE/cds-ui/e2e-playwright"
-npm_install
+npm_install_public_registry
 
 # ── Install Playwright browser (Firefox, matching the config) ────────────────
 echo "---> Installing Playwright Firefox browser"