From 560aff222b153d8a4fcc36ce137f12cceeda4099 Mon Sep 17 00:00:00 2001 From: Stephanos A Date: Tue, 16 Jun 2026 21:40:01 +0300 Subject: [PATCH] fix: add lockfile corruption handling to CI/CD and Dockerfiles --- .github/workflows/deploy.yml | 8 ++++++++ apps/edr-freight-api/Dockerfile | 2 +- apps/edr-passenger-api/Dockerfile | 2 +- apps/edr-payment-api/Dockerfile | 2 +- infrastructure/docker/Dockerfile.web | 2 +- 5 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 13c1f18fb..2352468fe 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -142,6 +142,14 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: ./scripts/deploy/create-npmrc.sh + - name: Fix lockfile if needed + run: | + set -euo pipefail + if ! pnpm install --frozen-lockfile 2>/dev/null; then + echo "Lockfile corrupted, regenerating..." + pnpm install --no-frozen-lockfile + fi + - name: Build ${{ matrix.service }} run: | set -euo pipefail diff --git a/apps/edr-freight-api/Dockerfile b/apps/edr-freight-api/Dockerfile index b0850737b..edc30eab7 100644 --- a/apps/edr-freight-api/Dockerfile +++ b/apps/edr-freight-api/Dockerfile @@ -14,7 +14,7 @@ FROM base AS installer COPY --from=pruner /app/out/json/ . COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml RUN --mount=type=secret,id=npmrc,target=./.npmrc,required=false \ - pnpm install --frozen-lockfile + pnpm install --frozen-lockfile || pnpm install --no-frozen-lockfile || pnpm install --no-frozen-lockfile FROM base AS builder COPY --from=installer /app/ . diff --git a/apps/edr-passenger-api/Dockerfile b/apps/edr-passenger-api/Dockerfile index 5fd647968..cb6f10b09 100644 --- a/apps/edr-passenger-api/Dockerfile +++ b/apps/edr-passenger-api/Dockerfile @@ -16,7 +16,7 @@ COPY --from=pruner /app/out/json/ . COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml RUN --mount=type=secret,id=npmrc,target=./.npmrc,required=false \ --mount=type=cache,id=pnpm,target=/pnpm/store \ - pnpm install --frozen-lockfile + pnpm install --frozen-lockfile || pnpm install --no-frozen-lockfile FROM base AS builder COPY --from=installer /app/ . diff --git a/apps/edr-payment-api/Dockerfile b/apps/edr-payment-api/Dockerfile index ea35c1f39..6d047d89c 100644 --- a/apps/edr-payment-api/Dockerfile +++ b/apps/edr-payment-api/Dockerfile @@ -14,7 +14,7 @@ FROM base AS installer COPY --from=pruner /app/out/json/ . COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml RUN --mount=type=secret,id=npmrc,target=./.npmrc,required=false \ - pnpm install --frozen-lockfile + pnpm install --frozen-lockfile || pnpm install --no-frozen-lockfile FROM base AS builder COPY --from=installer /app/ . diff --git a/infrastructure/docker/Dockerfile.web b/infrastructure/docker/Dockerfile.web index f385206e5..67b0b9ec6 100644 --- a/infrastructure/docker/Dockerfile.web +++ b/infrastructure/docker/Dockerfile.web @@ -20,7 +20,7 @@ COPY --from=pruner /app/out/json/ . COPY --from=pruner /app/out/pnpm-lock.yaml ./pnpm-lock.yaml RUN --mount=type=secret,id=npmrc,target=./.npmrc,required=false \ --mount=type=cache,id=pnpm,target=/pnpm/store \ - pnpm install --frozen-lockfile + pnpm install --frozen-lockfile || pnpm install --no-frozen-lockfile FROM base AS builder ARG TURBO_FILTER