Skip to content

Use authenticated npmrc#1001

Open
chidozieononiwu wants to merge 1 commit into
mainfrom
net-iso
Open

Use authenticated npmrc#1001
chidozieononiwu wants to merge 1 commit into
mainfrom
net-iso

Conversation

@chidozieononiwu

Copy link
Copy Markdown
Member

This pull request updates several pipeline YAML templates to improve npm authentication handling and environment consistency across CI/CD jobs. The main enhancement is the introduction of an authenticated .npmrc file in each major pipeline step, ensuring secure and consistent npm operations. Additionally, some minor formatting improvements were made for consistency.

Pipeline authentication and environment setup:

  • Added steps to generate an authenticated .npmrc using the create-authenticated-npmrc.yml template in the following pipeline templates: build-test.yaml, publish-release.yaml, set-env.yaml, and typespec-spector.yml. The generated .npmrc is placed in a temporary directory unique to each pipeline phase. [1] [2] [3] [4]
  • Updated relevant npm, pnpm, and Node.js installation steps to use the custom .npmrc via the npm_config_userconfig environment variable, ensuring that all npm commands use authenticated access. [1] [2] [3] [4]
  • Applied the authenticated .npmrc to the dependency bump step in the nightly CI pipeline (ci-typespec-nightly.yml).

Formatting and consistency:

  • Standardized the use of double quotes in cron schedules and environment variables for consistency across YAML files. [1] [2]

These changes collectively enhance the security and reliability of npm operations in CI/CD by ensuring authenticated access and consistent environment configuration.

Copilot AI review requested due to automatic review settings June 19, 2026 01:47
@chidozieononiwu chidozieononiwu self-assigned this Jun 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates Azure DevOps pipeline YAMLs to standardize npm authentication by generating a per-phase authenticated .npmrc and wiring it into steps via npm_config_userconfig, plus some YAML formatting/quoting consistency tweaks.

Changes:

  • Added references to a create-authenticated-npmrc.yml step template across multiple pipelines/templates and began passing npm_config_userconfig to selected npm/pnpm invocations.
  • Updated the nightly dependency bump job to use an authenticated .npmrc via npm_config_userconfig.
  • Standardized some YAML quoting/formatting (e.g., cron string quoting, RUSTFLAGS, displayName quotes).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
eng/pipelines/typespec-spector.yml Adds an authenticated .npmrc template step and sets npm_config_userconfig for the spector coverage upload step.
eng/pipelines/templates/steps/set-env.yaml Adds an authenticated .npmrc template step and uses npm_config_userconfig for global npm installs during environment setup.
eng/pipelines/templates/steps/publish-release.yaml Adds an authenticated .npmrc template step and sets npm_config_userconfig for the release publishing pwsh step; publish-to-npm step remains.
eng/pipelines/templates/steps/build-test.yaml Adds an authenticated .npmrc template step and sets npm_config_userconfig for the main build/install step; also normalizes quoting.
eng/pipelines/ci-typespec-nightly.yml Re-indents/standardizes YAML and adds authenticated .npmrc usage for the nightly dependency bump step.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +5 to +7
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(Agent.TempDirectory)/build-test/.npmrc
Comment on lines +7 to +9
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(Agent.TempDirectory)/set-env/.npmrc
Comment on lines +9 to +11
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(Agent.TempDirectory)/publish-release/.npmrc
Comment on lines +24 to +26
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(Agent.TempDirectory)/spector/.npmrc
Comment on lines +36 to +38
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(Agent.TempDirectory)/nightly/.npmrc
Comment on lines +43 to +47
- script: |
cd packages/${{ parameters.PackagePath }}
echo "//registry.npmjs.org/:_authToken=$(azure-sdk-npm-token)" > ./.npmrc
npm publish --access public
displayName: "Publish to npm ${{ parameters.PackagePath }}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants