Skip to content
Merged
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
2 changes: 2 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ extends:
inputs:
version: 24.x

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

- script: npm ci
displayName: 'npm ci'

Expand Down
1 change: 1 addition & 0 deletions eng/1es-redirect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ extends:
- 1ES.PT.Tag-refs/tags/canary
settings:
skipBuildTagsForGitHubPullRequests: true
networkIsolationPolicy: Permissive, CFSClean
sdl:
git:
longpaths: true
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 }}
2 changes: 2 additions & 0 deletions eng/test-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ steps:
inputs:
version: ${{ parameters.version }}

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

- script: npm ci
displayName: 'npm ci'

Expand Down