Skip to content
Merged
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
21 changes: 21 additions & 0 deletions .azure-pipelines/common-templates/install-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
steps:
- task: UseDotNet@2
displayName: Use .NET SDK
retryCountOnTaskFailure: 2
inputs:
version: 8.x

- task: UseDotNet@2
displayName: Use .NET SDK
retryCountOnTaskFailure: 2
inputs:
version: 6.x

Expand All @@ -27,6 +29,7 @@ steps:

- task: NodeTool@0
displayName: Install NodeJs
retryCountOnTaskFailure: 2
inputs:
versionSpec: 18.x

Expand Down Expand Up @@ -63,13 +66,15 @@ steps:

- task: Npm@1
displayName: Install AutoRest
retryCountOnTaskFailure: 2
inputs:
command: custom
workingDir: $(Build.SourcesDirectory)
customCommand: install --no-package-lock autorest@3.7.2

- task: Npm@1
displayName: Install AutorestCore
retryCountOnTaskFailure: 2
inputs:
command: custom
workingDir: $(Build.SourcesDirectory)
Expand All @@ -84,6 +89,7 @@ steps:

- task: Npm@1
displayName: Install Rush
retryCountOnTaskFailure: 2
inputs:
command: custom
workingDir: $(Build.SourcesDirectory)
Expand All @@ -96,6 +102,21 @@ steps:
pwsh: true
workingDirectory: "autorest.powershell"
script: |
# Belt-and-suspenders for 1ES network isolation (CFSClean): force npm_config_registry to
# the authenticated private feed so Rush's self-install of its own toolchain (the Rush and
# pnpm packages it downloads into ~/.rush via `npm install`) resolves from the private feed
# instead of defaulting to registry.npmjs.org. The env var is the highest-precedence npm
# config source and is inherited by every child process, so it covers the self-install npm
# calls that do not pick up the transformed common/config/rush/.npmrc.
if (-not $env:npm_config_registry) {
$userNpmrc = Join-Path $env:USERPROFILE ".npmrc"
if (Test-Path $userNpmrc) {
$regLine = Select-String -Path $userNpmrc -Pattern '^registry=' | Select-Object -First 1
if ($regLine) { $env:npm_config_registry = ($regLine.Line -replace '^registry=', '').Trim() }
}
}
Write-Host "npm_config_registry = $env:npm_config_registry"

npx --no-install rush install
if ($LASTEXITCODE -ne 0) { throw "rush install failed with exit code $LASTEXITCODE" }
npx --no-install rush link
Expand Down
Loading