Skip to content

Sync eng/common directory with azure-sdk-tools for PR 14353#45530

Merged
chidozieononiwu merged 2 commits intomainfrom
sync-eng/common-AllowNpmJSAccess-14353
Mar 5, 2026
Merged

Sync eng/common directory with azure-sdk-tools for PR 14353#45530
chidozieononiwu merged 2 commits intomainfrom
sync-eng/common-AllowNpmJSAccess-14353

Conversation

@azure-sdk
Copy link
Collaborator

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

Copilot AI review requested due to automatic review settings March 5, 2026 01:19
@azure-sdk azure-sdk requested a review from a team as a code owner March 5, 2026 01:19
@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

This PR syncs the eng/common directory with the upstream azure-sdk-tools PR #14353. The change replaces the inline step that deleted the repo-level .npmrc file (to force use of the default npmjs registry) with a new reusable template that instead explicitly sets the project-level npm registry via npm config set registry --location=project, providing better verification and reusability.

Changes:

  • Introduces a new reusable pipeline template reset-npmrc.yml that sets (and verifies) the project-level npm registry.
  • Refactors npm-publish.yml to call the new template instead of inline-deleting the .npmrc file.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
eng/common/pipelines/templates/steps/reset-npmrc.yml New reusable template that sets the project-level npm registry via npm config set and verifies the result
eng/common/pipelines/templates/jobs/npm-publish.yml Replaces the inline "Delete repo .npmrc" step with a call to the new reset-npmrc.yml template

Comment on lines +5 to +32
- task: PowerShell@2
displayName: 'Set project npm registry'
inputs:
targetType: inline
script: |
$ErrorActionPreference = 'Stop'

Write-Host "Registry before update:"
npm config get registry --location=project
if ($LASTEXITCODE -ne 0) {
throw "Failed to read current project npm registry."
}

npm config set registry "${{ parameters.Registry }}" --location=project
if ($LASTEXITCODE -ne 0) {
throw "Failed to set project npm registry to '${{ parameters.Registry }}'."
}

Write-Host "Registry after update:"
$updatedRegistry = npm config get registry --location=project
if ($LASTEXITCODE -ne 0) {
throw "Failed to read updated project npm registry."
}

if ($updatedRegistry.Trim() -ne "${{ parameters.Registry }}") {
throw "Project npm registry mismatch. Expected '${{ parameters.Registry }}' but got '$updatedRegistry'."
}
pwsh: true
Copy link

Copilot AI Mar 5, 2026

Choose a reason for hiding this comment

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

The old "Delete repo .npmrc" step had condition: and(succeeded(), ne(variables['SkipPublishing'], 'true')), meaning it was skipped when no packages were found (SkipPublishing set to true). The new reset-npmrc.yml template exposes no condition parameter, and the call site in npm-publish.yml does not set one either — so the registry reset step will now run unconditionally even when SkipPublishing is true. This is inconsistent with the EsrpRelease@9 step immediately following it (which retains the SkipPublishing condition check). Consider either adding a CustomCondition parameter to reset-npmrc.yml (following the pattern in create-authenticated-npmrc.yml) or adding condition: and(succeeded(), ne(variables['SkipPublishing'], 'true')) to the template step directly.

Copilot uses AI. Check for mistakes.
@chidozieononiwu chidozieononiwu merged commit 1946782 into main Mar 5, 2026
15 of 18 checks passed
@chidozieononiwu chidozieononiwu deleted the sync-eng/common-AllowNpmJSAccess-14353 branch March 5, 2026 01:26
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