Add npmAuthenticate task to fix E401 errors on CI agents#7363
Closed
ilonatommy wants to merge 4 commits into
Closed
Add npmAuthenticate task to fix E401 errors on CI agents#7363ilonatommy wants to merge 4 commits into
ilonatommy wants to merge 4 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens CI for the Azure DevOps report publishing task by preventing npm from sending potentially stale agent-level credentials to a public Azure Artifacts npm feed, avoiding intermittent E401 failures.
Changes:
- Add
always-auth=falseto the task’s project-level.npmrcso npm won’t send auth headers for read operations against the public registry.
Provides a fresh npm auth token on every build, preventing stale agent-level credentials from causing E401 errors on public feeds. Fixes #7362
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Problem
Some
NetCore-Publicpool agents have stale npm auth tokens inC:\Users\cloudtest\.npmrc. Whennpm ciruns against the publicdotnet-public-npmfeed, npm sends these stale credentials instead of using anonymous access, resulting in E401 errors. This has been blocking PR #7361 (Dependabot security fix) for 2 days.Fix
Add
npmAuthenticate@0pipeline task before the Build Azure DevOps plugin step ineng/pipelines/templates/BuildAndTest.yml. This provides a fresh valid token on every build, overriding any stale agent-level credentials.Evidence
Two different agents failed across separate builds while others succeeded in the same build:
Fixes #7362