fix(setup-node-with-cache): force install for deploy jobs with tooling dependencies#253
Closed
bobobowis wants to merge 1 commit into
Closed
fix(setup-node-with-cache): force install for deploy jobs with tooling dependencies#253bobobowis wants to merge 1 commit into
bobobowis wants to merge 1 commit into
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
pnpm deploy jobs were failing with
datadog-ci: not foundwhen 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-cito be available, even when the cache hit allows install to be skipped for build/test jobs.Root Cause
The shared action's
check-install-neededstep 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 ranpnpm deploy(which invokes Jarvis), and Jarvis's Datadog sourcemap upload step failed.Solution
Added a new
force-installinput to the shared action that signals "this job needs tooling dependencies, always run install." Set it totruein 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: Addedforce-installinput and check.github/workflows/frontend-deploy-workflow.yml: Setforce-install: truein deploy job.github/workflows/frontend-pr-workflow.yml: Setforce-install: truein preview deploy jobshared-actions/setup-node-with-cache/README.md: Documented the new input with usage examplesImpact
admin-homeand other pnpm repos deploying with Jarvis + DatadogTesting
The fix ensures that for pnpm deploy jobs with
cache-mode: full:node_modules+ pnpm store)force-install=true)@datadog/datadog-ciare availableFor build/test jobs,
force-installremainsfalse(default) so existing behavior is unchanged.🤖 Generated by Glean Code Writer
📝 Chat link - https://app.glean.com/chat/c40e4a74a89147fca97c44e098bd8d08