Skip to content

Sync eng/common directory with azure-sdk-tools for PR 14377#45544

Merged
chidozieononiwu merged 2 commits intomainfrom
sync-eng/common-AuthenticateTempNpmrc-14377
Mar 6, 2026
Merged

Sync eng/common directory with azure-sdk-tools for PR 14377#45544
chidozieononiwu merged 2 commits intomainfrom
sync-eng/common-AuthenticateTempNpmrc-14377

Conversation

@azure-sdk
Copy link
Collaborator

Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#14377 See eng/common workflow

@azure-sdk azure-sdk requested a review from a team as a code owner March 5, 2026 23:57
@azure-sdk azure-sdk added EngSys This issue is impacting the engineering system. Central-EngSys This issue is owned by the Engineering System team. labels Mar 5, 2026
@azure-sdk azure-sdk added EngSys This issue is impacting the engineering system. Central-EngSys This issue is owned by the Engineering System team. labels Mar 5, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 .npmrc into the agent temp directory (or creates one if missing).
  • Sets NPM_CONFIG_USERCONFIG to point npm tooling at the temporary .npmrc, then runs npmAuthenticate@0 against 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
Copy link

Copilot AI Mar 6, 2026

Choose a reason for hiding this comment

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

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

Copilot uses AI. Check for mistakes.
@chidozieononiwu chidozieononiwu merged commit 98e89d2 into main Mar 6, 2026
15 of 20 checks passed
@chidozieononiwu chidozieononiwu deleted the sync-eng/common-AuthenticateTempNpmrc-14377 branch March 6, 2026 00:02
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Central-EngSys This issue is owned by the Engineering System team. EngSys This issue is impacting the engineering system.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants