Use authenticated npmrc#49557
Conversation
There was a problem hiding this comment.
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
.npmrcin$(Agent.TempDirectory). - Configures npm install steps (autorest global install and
tsp-clientinstall) to use that.npmrcvianpm_config_userconfig.
| workingDirectory: $(Build.SourcesDirectory)/eng/common/tsp-client | ||
| displayName: 'Install tsp-client' | ||
| condition: ${{ eq(parameters.RELEASE_TYPE, 'TypeSpec') }} | ||
| env: |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
@XiaofeiCao we probably can delete this 2 codegen pipeline (as part of the process to remove AutoRest)?
Yes, it'll be removed in #49549 |
This pull request updates the
eng/automation/generation.ymlpipeline to improve authentication for npm operations by ensuring a properly configured.npmrcfile is used during package installation steps. The main focus is on securely handling npm credentials during the pipeline execution.Pipeline authentication improvements:
.npmrcfile using the/eng/common/pipelines/templates/steps/create-authenticated-npmrc.ymltemplate, specifying the path as$(Agent.TempDirectory)/release/.npmrc.autorestinstallation andtsp-clientinstallation) to use the authenticated.npmrcby setting thenpm_config_userconfigenvironment variable.