fix: pin registry.npmjs.org IPv4 in /etc/hosts to bypass broken DNS

This commit is contained in:
Celes Renata
2026-07-13 07:31:38 +00:00
parent 7229273461
commit c0d7f2f438
+5 -7
View File
@@ -194,16 +194,14 @@ steps:
environment:
NODE_OPTIONS: "--dns-result-order=ipv4first"
commands:
- echo "=== Pinning registry.npmjs.org to IPv4 in /etc/hosts ==="
- REGISTRY_IP=$(wget -4 -q -O- https://dns.google/resolve?name=registry.npmjs.org\&type=A 2>/dev/null | sed -n 's/.*"data":"\([0-9.]*\)".*/\1/p' | head -1)
- echo "Resolved registry.npmjs.org to $REGISTRY_IP"
- if [ -n "$REGISTRY_IP" ]; then echo "$REGISTRY_IP registry.npmjs.org" >> /etc/hosts; else echo "104.16.1.35 registry.npmjs.org" >> /etc/hosts; fi
- cat /etc/hosts
- echo "=== npm/node versions ==="
- node --version
- npm --version
- echo "=== Configuring npm for K8s DNS stability ==="
- npm config set maxsockets 3
- npm config set fetch-retries 5
- npm config set fetch-retry-mintimeout 20000
- npm config set fetch-retry-maxtimeout 120000
- npm config set fetch-timeout 300000
- npm config set loglevel http
- echo "=== Starting npm ci ==="
- cd frontend && npm ci
backend_options: