Sync eng/common directory with azure-sdk-tools for PR 14377#45544
Merged
chidozieononiwu merged 2 commits intomainfrom Mar 6, 2026
Merged
Sync eng/common directory with azure-sdk-tools for PR 14377#45544chidozieononiwu merged 2 commits intomainfrom
chidozieononiwu merged 2 commits intomainfrom
Conversation
chidozieononiwu
approved these changes
Mar 6, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Syncs eng/common pipeline templates with the corresponding changes from azure-sdk-tools PR 14377 by adding a reusable step template to authenticate npm using a temporary .npmrc.
Changes:
- Adds a new pipeline step template that copies a repo
.npmrcinto the agent temp directory (or creates one if missing). - Sets
NPM_CONFIG_USERCONFIGto point npm tooling at the temporary.npmrc, then runsnpmAuthenticate@0against it.
Comment on lines
+6
to
+12
| $repoNpmrc = "${{ parameters.RepoNpmrc }}" | ||
| $tempNpmrc = "$(Agent.TempDirectory)/.npmrc" | ||
|
|
||
| if (Test-Path $repoNpmrc) { | ||
| Copy-Item $repoNpmrc $tempNpmrc -Force | ||
| } else { | ||
| New-Item -Path $tempNpmrc -ItemType File -Force | Out-Null |
There was a problem hiding this comment.
The PowerShell step doesn’t set $ErrorActionPreference = 'Stop' (or use -ErrorAction Stop), so a non-terminating error from Copy-Item/New-Item could allow the step to continue and fail later in npmAuthenticate@0 with a less actionable error. Consider forcing terminating behavior and/or explicitly checking the copy/create result before setting NPM_CONFIG_USERCONFIG.
Suggested change
| $repoNpmrc = "${{ parameters.RepoNpmrc }}" | |
| $tempNpmrc = "$(Agent.TempDirectory)/.npmrc" | |
| if (Test-Path $repoNpmrc) { | |
| Copy-Item $repoNpmrc $tempNpmrc -Force | |
| } else { | |
| New-Item -Path $tempNpmrc -ItemType File -Force | Out-Null | |
| $ErrorActionPreference = 'Stop' | |
| $repoNpmrc = "${{ parameters.RepoNpmrc }}" | |
| $tempNpmrc = "$(Agent.TempDirectory)/.npmrc" | |
| if (Test-Path $repoNpmrc) { | |
| Copy-Item $repoNpmrc $tempNpmrc -Force -ErrorAction Stop | |
| } else { | |
| New-Item -Path $tempNpmrc -ItemType File -Force -ErrorAction Stop | Out-Null |
singankit
pushed a commit
that referenced
this pull request
Mar 16, 2026
* Authenticate to user scope .npmrc * Make RepoNpmrc a parameter --------- Co-authored-by: Chidozie Ononiwu <chononiw@microsoft.com>
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.
Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#14377 See eng/common workflow