Skip to content

fix(setup-node-with-cache): force install for deploy jobs with tooling dependencies#253

Closed
bobobowis wants to merge 1 commit into
mainfrom
fix/pnpm-deploy-force-install
Closed

fix(setup-node-with-cache): force install for deploy jobs with tooling dependencies#253
bobobowis wants to merge 1 commit into
mainfrom
fix/pnpm-deploy-force-install

Conversation

@bobobowis

Copy link
Copy Markdown
Contributor

Description

pnpm deploy jobs were failing with datadog-ci: not found when Jarvis tried to upload sourcemaps to Datadog. The shared cache action's install-skipping logic allowed pnpm repos with cache hits to skip install entirely when the cache looked intact and no workspaces/postinstall hooks were detected.

This worked fine for yarn-based deploys, but pnpm's cache-first strategy exposed a gap: deploy jobs need tooling dependencies like @datadog/datadog-ci to be available, even when the cache hit allows install to be skipped for build/test jobs.

Root Cause

The shared action's check-install-needed step verified cache integrity and checked for workspaces/lerna/postinstall hooks, but didn't account for deploy jobs that shell out to tooling packages (e.g., npx @datadog/datadog-ci@5.21.0).

For pnpm repos like admin-home using cache-mode: full: cache hit + no workspaces + no postinstall = skip install entirely. The deploy job then ran pnpm deploy (which invokes Jarvis), and Jarvis's Datadog sourcemap upload step failed.

Solution

Added a new force-install input to the shared action that signals "this job needs tooling dependencies, always run install." Set it to true in deploy jobs for both production (frontend-deploy-workflow.yml) and preview (frontend-pr-workflow.yml).

The logic short-circuits at the top of the install-needed check so deploy jobs always run install after cache restore, regardless of cache integrity or repo structure. This keeps the performance optimization for build/test jobs intact.

Changes

  • shared-actions/setup-node-with-cache/action.yml: Added force-install input and check
  • .github/workflows/frontend-deploy-workflow.yml: Set force-install: true in deploy job
  • .github/workflows/frontend-pr-workflow.yml: Set force-install: true in preview deploy job
  • shared-actions/setup-node-with-cache/README.md: Documented the new input with usage examples

Impact

  • ✅ Fixes production deploy failure for admin-home and other pnpm repos deploying with Jarvis + Datadog
  • ✅ Platform-level fix — no per-repo workarounds needed
  • ✅ Preserves cache-performance optimizations for build/test jobs

Testing

The fix ensures that for pnpm deploy jobs with cache-mode: full:

  1. Cache hit still happens (restores node_modules + pnpm store)
  2. Install runs anyway (because force-install=true)
  3. Tooling dependencies like @datadog/datadog-ci are available
  4. Jarvis's Datadog sourcemap upload succeeds
  5. Deploy completes normally

For build/test jobs, force-install remains false (default) so existing behavior is unchanged.


🤖 Generated by Glean Code Writer
📝 Chat link - https://app.glean.com/chat/c40e4a74a89147fca97c44e098bd8d08

…g dependencies

## Problem

pnpm deploy jobs were failing with "datadog-ci: not found" when Jarvis tried to
upload sourcemaps to Datadog. The shared cache action's install-skipping logic
allowed pnpm repos with cache hits to skip install entirely when the cache looked
intact and no workspaces/postinstall hooks were detected.

This worked fine for yarn-based deploys because the old flow was more install-driven,
but pnpm's cache-first strategy exposed a gap: deploy jobs need tooling dependencies
like @datadog/datadog-ci to be available, even when the cache hit allows install to
be skipped for build/test jobs.

## Root Cause

The shared action's `check-install-needed` step verified cache integrity and
checked for workspaces/lerna/postinstall hooks, but didn't account for deploy jobs
that shell out to tooling packages (e.g., `npx @datadog/datadog-ci@5.21.0`).

For pnpm repos like admin-home using cache-mode: full, a cache hit + no workspaces
+ no postinstall = skip install entirely. The deploy job then ran `pnpm deploy`
(which invokes Jarvis), and Jarvis's Datadog sourcemap upload step failed because
the datadog-ci binary was not in the expected package-manager path.

## Solution

Add a new `force-install` input to the shared action that signals "this job needs
tooling dependencies, always run install." Set it to `true` in deploy jobs for both
production (frontend-deploy-workflow.yml) and preview (frontend-pr-workflow.yml).

The logic short-circuits at the top of the install-needed check so deploy jobs
always run install after cache restore, regardless of cache integrity or repo
structure. This is deterministic, safe, and keeps the performance optimization
for build/test jobs intact.

## Changes

- shared-actions/setup-node-with-cache/action.yml:
  - Add `force-install` input (default: false)
  - Check `force-install` at the top of install-needed logic and set NEEDS_INSTALL=true
- .github/workflows/frontend-deploy-workflow.yml:
  - Set `force-install: true` in deploy job setup step
- .github/workflows/frontend-pr-workflow.yml:
  - Set `force-install: true` in preview deploy job setup step
- shared-actions/setup-node-with-cache/README.md:
  - Document the new input in the inputs table
  - Add force-install to the "Smart install detection" list
  - Add a usage example for deploy jobs

## Testing

The fix ensures that for pnpm deploy jobs with cache-mode: full:
1. Cache hit still happens (restores node_modules + pnpm store)
2. Install runs anyway (because force-install=true)
3. Tooling dependencies like @datadog/datadog-ci are available in the package path
4. Jarvis's Datadog sourcemap upload succeeds
5. The rest of the deploy proceeds normally

For build/test jobs, force-install remains false (default) so the existing
cache-performance behavior is unchanged.

## Impact

Fixes the immediate production deploy failure for admin-home and any other pnpm
repos that deploy with Jarvis + Datadog sourcemap upload enabled. Also future-proofs
the shared workflows against similar tooling-dependency failures in other deploy
contexts.

Generated by Glean Code Writer
@bobobowis bobobowis closed this Jul 16, 2026
@bobobowis bobobowis deleted the fix/pnpm-deploy-force-install branch July 16, 2026 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants