Skip to content

Use authenticated npmrc#49557

Open
chidozieononiwu wants to merge 2 commits into
mainfrom
net-iso
Open

Use authenticated npmrc#49557
chidozieononiwu wants to merge 2 commits into
mainfrom
net-iso

Conversation

@chidozieononiwu

Copy link
Copy Markdown
Member

This pull request updates the eng/automation/generation.yml pipeline to improve authentication for npm operations by ensuring a properly configured .npmrc file is used during package installation steps. The main focus is on securely handling npm credentials during the pipeline execution.

Pipeline authentication improvements:

  • Added a step to create an authenticated .npmrc file using the /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml template, specifying the path as $(Agent.TempDirectory)/release/.npmrc.
  • Updated npm-related steps (autorest installation and tsp-client installation) to use the authenticated .npmrc by setting the npm_config_userconfig environment variable.

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 PR updates the eng/automation/generation.yml automation pipeline to use an authenticated .npmrc during npm operations, improving how npm credentials are handled in the generation workflow.

Changes:

  • Adds a shared step to create/authenticate an .npmrc in $(Agent.TempDirectory).
  • Configures npm install steps (autorest global install and tsp-client install) to use that .npmrc via npm_config_userconfig.

Comment thread eng/automation/generation.yml Outdated
Comment thread eng/automation/generation.yml Outdated
workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client
displayName: 'Install tsp-client'
condition: ${{ eq(parameters.RELEASE_TYPE, 'TypeSpec') }}
env:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We will need to override the host in some cases like this 'tsp-client' installation whose lock file points to the 'npmjs.org'. See my draft changes at here

@chidozieononiwu chidozieononiwu Jun 20, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Perhaps we should replace the host in all cases and only opt out in the instances we need to publish to npmjs

I updated eng/common Azure/azure-sdk-tools#16082

@weidongxu-microsoft weidongxu-microsoft left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@XiaofeiCao we probably can delete this 2 codegen pipeline (as part of the process to remove AutoRest)?

@XiaofeiCao

Copy link
Copy Markdown
Contributor

@XiaofeiCao we probably can delete this 2 codegen pipeline (as part of the process to remove AutoRest)?

Yes, it'll be removed in #49549

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.

5 participants