Add 3-attempt retry to npm/pnpm install step in plugin workflows (#132)
PRI-459: Adds 3-attempt retry wrapper (5s backoff) around the Install dependencies step in plugin-ci.yaml and plugin-release.yaml to handle transient npm/pnpm registry failures. Co-authored-by: Chris Farhood <chris@farhood.org>
This commit is contained in:
committed by
GitHub
parent
2d791a8886
commit
490128a044
@@ -115,10 +115,24 @@ jobs:
|
|||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then
|
max_attempts=3
|
||||||
pnpm install --frozen-lockfile
|
attempt=1
|
||||||
else
|
while [ $attempt -le $max_attempts ]; do
|
||||||
npm ci
|
echo "Attempt $attempt of $max_attempts"
|
||||||
|
if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then
|
||||||
|
pnpm install --frozen-lockfile && break
|
||||||
|
else
|
||||||
|
npm ci && break
|
||||||
|
fi
|
||||||
|
if [ $attempt -lt $max_attempts ]; then
|
||||||
|
echo "::warning::Install step failed on attempt $attempt. Retrying in 5 seconds..."
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
attempt=$((attempt + 1))
|
||||||
|
done
|
||||||
|
if [ $attempt -gt $max_attempts ]; then
|
||||||
|
echo "::error::Install step failed after $max_attempts attempts."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Build plugin
|
- name: Build plugin
|
||||||
@@ -162,4 +176,4 @@ jobs:
|
|||||||
npx audit-ci --pnpm --audit-level=high
|
npx audit-ci --pnpm --audit-level=high
|
||||||
else
|
else
|
||||||
npx audit-ci --npm --audit-level=high
|
npx audit-ci --npm --audit-level=high
|
||||||
fi
|
fi
|
||||||
@@ -226,10 +226,24 @@ jobs:
|
|||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then
|
max_attempts=3
|
||||||
pnpm install --frozen-lockfile
|
attempt=1
|
||||||
else
|
while [ $attempt -le $max_attempts ]; do
|
||||||
npm ci
|
echo "Attempt $attempt of $max_attempts"
|
||||||
|
if [ "${{ steps.pkg-manager.outputs.manager }}" = "pnpm" ]; then
|
||||||
|
pnpm install --frozen-lockfile && break
|
||||||
|
else
|
||||||
|
npm ci && break
|
||||||
|
fi
|
||||||
|
if [ $attempt -lt $max_attempts ]; then
|
||||||
|
echo "::warning::Install step failed on attempt $attempt. Retrying in 5 seconds..."
|
||||||
|
sleep 5
|
||||||
|
fi
|
||||||
|
attempt=$((attempt + 1))
|
||||||
|
done
|
||||||
|
if [ $attempt -gt $max_attempts ]; then
|
||||||
|
echo "::error::Install step failed after $max_attempts attempts."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Build plugin
|
- name: Build plugin
|
||||||
|
|||||||
Reference in New Issue
Block a user