Sync eng/common directory with azure-sdk-tools for PR 14353#37470
Sync eng/common directory with azure-sdk-tools for PR 14353#37470chidozieononiwu merged 2 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Syncs eng/common pipeline templates with upstream azure-sdk-tools changes by replacing the “delete repo .npmrc” approach with a reusable step template that sets the npm project registry.
Changes:
- Add a new
reset-npmrc.ymlsteps template to set the npm project registry vianpm config. - Update
npm-publish.ymlto use the new template when publishing tohttps://registry.npmjs.org/instead of deleting the repo.npmrc.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| eng/common/pipelines/templates/steps/reset-npmrc.yml | New reusable step template that sets the npm project registry. |
| eng/common/pipelines/templates/jobs/npm-publish.yml | Switch npmjs publishing path to use the new reset-npmrc template. |
| Write-Host "No repo .npmrc found at $npmrcPath." | ||
| } | ||
| pwsh: true | ||
| - template: /eng/common/pipelines/templates/steps/reset-npmrc.yml |
There was a problem hiding this comment.
This reset-npmrc step now runs even when SkipPublishing is set to true (e.g., when no packages are found and publishing is skipped). Previously the registry-change step was conditioned on ne(variables['SkipPublishing'], 'true'). Consider applying the same condition to this template call (or adding a CustomCondition parameter to the template) so the job doesn’t mutate npm config unnecessarily when publishing is skipped.
| - template: /eng/common/pipelines/templates/steps/reset-npmrc.yml | |
| - template: /eng/common/pipelines/templates/steps/reset-npmrc.yml | |
| condition: and(succeeded(), ne(variables['SkipPublishing'], 'true')) |
|
|
||
| steps: | ||
| - task: PowerShell@2 | ||
| displayName: 'Set project npm registry' | ||
| inputs: | ||
| targetType: inline |
There was a problem hiding this comment.
This template uses npm config ... --location=project, which writes to the .npmrc in the current working directory. Since the task doesn’t set workingDirectory, the update could end up in an unexpected folder (and not affect later npm commands that run elsewhere). Consider adding a WorkingDirectory parameter (or otherwise setting workingDirectory on the PowerShell task) so the project .npmrc is updated deterministically.
| steps: | |
| - task: PowerShell@2 | |
| displayName: 'Set project npm registry' | |
| inputs: | |
| targetType: inline | |
| WorkingDirectory: '$(System.DefaultWorkingDirectory)' | |
| steps: | |
| - task: PowerShell@2 | |
| displayName: 'Set project npm registry' | |
| inputs: | |
| targetType: inline | |
| workingDirectory: ${{ parameters.WorkingDirectory }} |
Sync eng/common directory with azure-sdk-tools for PR Azure/azure-sdk-tools#14353 See eng/common workflow