Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion eng/common/pipelines/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ extends:
displayName: Install Node.js
inputs:
versionSpec: 22.x
- script: npm install -g pnpm # Pnpm manage-package-manager-versions will respect packageManager field

- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml

- script: npm install -g pnpm@10.30.2 # Pnpm manage-package-manager-versions will respect packageManager field
displayName: Install pnpm

- script: pnpm install
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
parameters:
- name: npmrcPath
type: string
# When empty, defaults to the agent user's .npmrc ($HOME/.npmrc on
# Linux/macOS, %USERPROFILE%\.npmrc on Windows) so every subsequent
# npm / pnpm / npx call in the job inherits the registry + auth.
default: ""
- name: registryUrl
type: string
default: "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/"
- name: CustomCondition
type: string
default: succeeded()
- name: ServiceConnection
type: string
default: ""

steps:
- pwsh: |
$npmrcPath = '${{ parameters.npmrcPath }}'
if (-not $npmrcPath) { $npmrcPath = Join-Path $HOME '.npmrc' }

Write-Host "Creating .npmrc file $npmrcPath for registry ${{ parameters.registryUrl }}"
$parentFolder = Split-Path -Path $npmrcPath -Parent

if ($parentFolder -and -not (Test-Path $parentFolder)) {
Write-Host "Creating folder $parentFolder"
New-Item -Path $parentFolder -ItemType Directory | Out-Null
}

"registry=${{ parameters.registryUrl }}" | Out-File $npmrcPath
Write-Host "##vso[task.setvariable variable=resolvedNpmrcPath]$npmrcPath"
displayName: "Create .npmrc"
condition: ${{ parameters.CustomCondition }}

- task: npmAuthenticate@0
displayName: Authenticate .npmrc
condition: ${{ parameters.CustomCondition }}
inputs:
workingFile: $(resolvedNpmrcPath)
azureDevOpsServiceConnection: ${{ parameters.ServiceConnection }}
6 changes: 2 additions & 4 deletions eng/emitters/pipelines/templates/stages/emitter-stages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,7 @@ stages:
displayName: Download build artifacts

# Always publish to internal feed
- template: /eng/emitters/pipelines/templates/steps/create-authenticated-npmrc.yml
parameters:
npmrcPath: $(buildArtifactsPath)/packages/.npmrc
registryUrl: https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml

# publish to devops feed
- pwsh: |
Expand Down Expand Up @@ -389,6 +386,7 @@ stages:
inputs:
versionSpec: "22.x"
checkLatest: true
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml
- script: npm ci
displayName: Install emitter dependencies for playground bundle
workingDirectory: $(Build.SourcesDirectory)/${{ parameters.PackagePath }}
Expand Down
2 changes: 2 additions & 0 deletions eng/emitters/pipelines/templates/steps/build-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ steps:
- checkout: self

- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml

- task: NodeTool@0
displayName: Install Node.js
retryCountOnTaskFailure: 3
Expand Down

This file was deleted.

2 changes: 2 additions & 0 deletions eng/emitters/pipelines/templates/steps/test-step.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ parameters:
steps:
- checkout: self

- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml

- download: current
artifact: ${{ parameters.BuildArtifactName }}
displayName: Download build artifacts
Expand Down
2 changes: 2 additions & 0 deletions eng/tsp-core/pipelines/jobs/cli/build-tsp-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
# - script: npm install -g bun
# displayName: Install bun

- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml

- script: npm install -g pnpm
displayName: Install pnpm

Expand Down
5 changes: 4 additions & 1 deletion eng/tsp-core/pipelines/templates/install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ steps:
inputs:
version: 8.0.x

- script: npm install -g pnpm # Pnpm manage-package-manager-versions will respect packageManager field
- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml

- script: npm install -g pnpm@10.30.2 # Pnpm manage-package-manager-versions will respect packageManager field
displayName: Install pnpm

- script: pnpm config set store-dir ${{ parameters.pnpmStorePath }}
displayName: Setup pnpm cache dir

Expand Down
3 changes: 3 additions & 0 deletions packages/http-client-csharp/eng/pipeline/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ extends:
npm_config_cache: $(Agent.TempDirectory)/npm-cache
steps:
- checkout: self

- template: /eng/common/pipelines/templates/steps/create-authenticated-npmrc.yml

- pwsh: |
# Determine the TypeSpec PR URL
$repoUrl = '$(Build.Repository.Uri)'.TrimEnd('/')
Expand Down
Loading