Skip to content

PFM-ISSUE-34294 - Use the new secrets and remove the stored DOT_NPMRC secret - #193

Open
vladimir-arsov wants to merge 5 commits into
masterfrom
improvement/PFM-ISSUE-34294-Use-the-new-secrets-and-remove-the-stored-DOT_NPMRC
Open

vladimir-arsov wants to merge 5 commits into
masterfrom
improvement/PFM-ISSUE-34294-Use-the-new-secrets-and-remove-the-stored-DOT_NPMRC

Conversation

@vladimir-arsov

@vladimir-arsov vladimir-arsov commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Implements PFM-ISSUE-34294. Relates to PFM-ISSUE-33675.

changelog: Frontend-Core: [PFM-ISSUE-34294] FE workflows generate ~/.npmrc from JFROG_TOKEN; DOT_NPMRC is deprecated [PR github-actions#193]

Summary

use-npmrc no longer writes the stored whole-file secret DOT_NPMRC. It generates ~/.npmrc from the repo's existing JFROG_TOKEN, chosen by which secret the caller passes:

Secrets passed Generated ~/.npmrc Run outcome
JFROG_TOKEN (wins if both are passed) registry= the cplace-npm virtual, _authToken for that path, replace-registry-host=never; mode 600, the token never printed installs; a ::notice:: when DOT_NPMRC is passed too
only DOT_NPMRC the secret verbatim plus replace-registry-host=never, as before installs, plus a ::warning:: deprecation annotation
neither – the Use .npmrc step fails with ::error::No npm credentials: … before npm ci

The registry URL comes from the committed JFROG_NPM_PROXY constant (tools/scripts/lockfile/lib.sh), so install auth is no longer hidden in secret text.

Changes

  • .github/actions/use-npmrc/write-npmrc.sh (new): the generator, with the three paths above and a rejected token containing whitespace. action.yml takes the optional inputs jfrog-token and dot-npmrc and delegates to it. The PFM-ISSUE-34453 comment moved there and is corrected (the masked prefix is the registry= URL, not JFROG_URL).
  • write-npmrc.bats (new, 11 tests), and pr-checks.yml runs shellcheck and bats over it.
  • Eight reusables (fe-install-deps, fe-licenses, fe-sonar, fe-pr-snapshot, fe-pr-close, fe-cleanup-snapshots, fe-release, fe-release-flow) declare JFROG_TOKEN and DOT_NPMRC as optional and pass both to every use-npmrc call. fe-release-flow's nested install-deps gets both.
  • tools/scripts/artifacts/nx-project.ts: promote() and deleteArtifact() restore a dist .npmrc that an nx rebuild removed (D4 below), plus 3 jest tests.
  • The FE starter templates pass JFROG_TOKEN and no DOT_NPMRC. The README documents JFROG_TOKEN as the install credential (it needs read on the cplace-npm virtual), marks DOT_NPMRC deprecated and adds the migration steps. The lockfile README's auth wording is updated.
  • Specs: research.md, design.md, plan.md, live-test-plan.md under specs/2026-12-01_PFM-ISSUE-34294_jfrog-npmrc-secret-cutover/.

The branch is rebased onto PFM-ISSUE-33676 (#192), which made GIT_USER* optional in fe-release-flow.

Migration for consumers: at the merge, every caller that already passes JFROG_TOKEN switches, because the token wins: the release flow (secrets: inherit) and the publish/delete jobs. In the fe-install-deps, fe-licenses and fe-sonar callers, replace the DOT_NPMRC: line with JFROG_TOKEN: ${{ secrets.JFROG_TOKEN }}; in the others, delete it. Callers that still pass only DOT_NPMRC keep working with the deprecation warning. Callers on @release/26.4 and older are unaffected. Each repo's JFROG_TOKEN must read the cplace-npm virtual (pre-merge token check, live-test-plan.md §5). Removing DOT_NPMRC from the reusables and deleting the repo secrets moves to a follow-up cleanup ticket.

Live validation (clone-cplace-fe, publishing to cplace-npm-test)

Every install case forced a cache miss, so npm ci really ran through the generated file.

ID Runs Verdict Note
T1 main CI, token 47147767268 pass 3302 packages installed, no annotation
T2 licenses, token 47151775840, 47151775730 pass install + license check
T3 sonar, token 47159921084 pass cache-gated use-npmrc path; cancelled after install (no Sonar token on the clone)
T4 PR snapshot, token 47162290941 pass install via ~/.npmrc and 27 published via the dist .npmrc in one job
T5 PR close, token 47190908837 pass (D3) install + unpublish
T6 snapshot cleanup, token 47194736740 pass npm search/npm view without the E404 (D2 from 34293 is gone)
B1 release flow, both (inherit) 47314723410, 47321844455 fail, then pass first run found D4; after the fix: 27 published, promoted to 26.4.14, tag pushed, ::notice::
B2 main CI, both 47327816634 pass exactly one ::notice::
L1 main CI, DOT_NPMRC only 47333497217 pass installs, exactly one ::warning::
L2 PR snapshot, DOT_NPMRC only 47337060364, 47340732989 pass (D3) fallback in the mixed job, 27 published (legacy publish)
N1 main CI, neither 47341298154 pass the run starts, then fails at Use .npmrc with the error annotation; no npm ci

Across all runs: the token never appears in a log, the generated ~/.npmrc is never printed, and there is no unexpected auth error. Full report: live-test-plan.md §7.

Found and fixed: D4. nx rebuilds a published library from its local cache when a later project depends on it, which replaces its dist directory without the dist .npmrc. promote() and the release flow's failure cleanup then ran against JFROG_URL with only ~/.npmrc and got E401. DOT_NPMRC used to cover that by accident; the generated file authenticates only the read virtual. Without the fix, every release whose libraries are rebuilt as dependencies would fail at merge.

Deviation, test environment only (accepted): D3. The PR-close unpublish leaves cf-devkit and create-cplace-workspace: without publishConfig their unpublish goes to the default registry, which on the clone is not where the test versions live. In production the virtual's default deployment repo is cplace-npm-local, where they are published.

Watch after the merge

  • First snapshot cleanup: with D2 gone, each repo's scheduled cleanup now gets past the search and really deletes snapshots older than 4 months, which have piled up while it crashed. On the clone the search alone found 2008 candidates and took 23 min.
  • Notice for secrets: inherit callers: the notice says "Remove the DOT_NPMRC line from this caller", which an inherit caller does not have. It shows on every release run until the repo secret is deleted.

Developer Checklist:

  • Updated documentation if needed
  • Created Changelog according
    to Guidelines

🤖 Generated with Claude Code

@Kaltenbach Kaltenbach left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Design approved.

vladimir-arsov and others added 3 commits December 4, 2026 10:43
…npmrc and DOT_NPMRC cutover

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…T_NPMRC becomes a deprecated fallback

use-npmrc delegates to write-npmrc.sh: with jfrog-token it writes the
cplace-npm virtual as registry plus the token as _authToken; with only
dot-npmrc it writes that content with a deprecation warning; with neither
it fails before npm ci. fe-install-deps passes both secrets, both optional.
pr-checks runs shellcheck and bats over the new script.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… templates and README drop DOT_NPMRC

All eight reusables that run use-npmrc declare JFROG_TOKEN and DOT_NPMRC as
optional and pass both; fe-release-flow's nested install-deps gets both.
write-npmrc.bats covers every input case, whitespace tokens, overwrite and
mode 600. The templates pass JFROG_TOKEN and no DOT_NPMRC; the README
documents JFROG_TOKEN as the install credential (read on the cplace-npm
virtual), marks DOT_NPMRC deprecated and adds the migration steps.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vladimir-arsov
vladimir-arsov force-pushed the improvement/PFM-ISSUE-34294-Use-the-new-secrets-and-remove-the-stored-DOT_NPMRC branch from e48a4b3 to b2feaa2 Compare December 4, 2026 09:57
vladimir-arsov and others added 2 commits December 4, 2026 12:01
…hen a rebuild removed it

nx restores a published library from its local cache when a later project
depends on it, which replaces its dist directory without the dist .npmrc.
promote() and the release flow's failure cleanup then ran against JFROG_URL
with only ~/.npmrc. DOT_NPMRC used to cover that by accident; the generated
~/.npmrc authenticates only the cplace-npm read virtual, so both failed with
E401 (live test B1 on clone-cplace-fe).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vladimir-arsov vladimir-arsov changed the title PFM-ISSUE-34294 - Research and design for the runtime-generated .npmrc and DOT_NPMRC cutover PFM-ISSUE-34294 - Use the new secrets and remove the stored DOT_NPMRC secret Dec 4, 2026
@vladimir-arsov vladimir-arsov self-assigned this Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants