Skip to content

Commit cf46f0e

Browse files
committed
use npmrc for subsequent npm auth
1 parent cfbf213 commit cf46f0e

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

.azure-pipelines/common-templates/install-tools.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,17 @@ steps:
4949
workingFile: $(Build.SourcesDirectory)/autorest.powershell/common/config/rush/.npmrc
5050

5151
- task: PowerShell@2
52-
displayName: Set npm userconfig for all npm subprocesses
52+
displayName: Apply npm auth config to user profile
5353
inputs:
5454
targetType: inline
5555
pwsh: true
5656
script: |
57-
Write-Host "##vso[task.setvariable variable=NPM_CONFIG_USERCONFIG]$(Build.SourcesDirectory)/.npmrc"
57+
# Copy authenticated .npmrc to the user home dir so ALL npm subprocesses
58+
# (including autorest's internal npm calls) use the private feed + auth tokens.
59+
$src = "$(Build.SourcesDirectory)/.npmrc"
60+
$dst = Join-Path $env:USERPROFILE ".npmrc"
61+
Copy-Item -Path $src -Destination $dst -Force
62+
Write-Host "Copied npm config to $dst"
5863
5964
- task: Npm@1
6065
displayName: Install AutoRest
@@ -85,5 +90,8 @@ steps:
8590
workingDirectory: "autorest.powershell"
8691
script: |
8792
rush install
93+
if ($LASTEXITCODE -ne 0) { throw "rush install failed with exit code $LASTEXITCODE" }
8894
rush link
89-
rush rebuild
95+
if ($LASTEXITCODE -ne 0) { throw "rush link failed with exit code $LASTEXITCODE" }
96+
rush rebuild
97+
if ($LASTEXITCODE -ne 0) { throw "rush rebuild failed with exit code $LASTEXITCODE" }

0 commit comments

Comments
 (0)