Skip to content

Commit 1bb5608

Browse files
committed
ensure autorest doesnt reach for npm registry
1 parent a7dce76 commit 1bb5608

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

tools/GenerateModules.ps1

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,22 @@ if (Test-Path $coreCacheDir) {
6363
} else {
6464
Write-Host "WARNING: Autorest core cache directory not found at $coreCacheDir"
6565
}
66+
$modelerfourCacheDir = Join-Path $autorestHome "@autorest\modelerfour"
67+
if (Test-Path $modelerfourCacheDir) {
68+
Write-Host "Autorest modelerfour cache versions: $(Get-ChildItem $modelerfourCacheDir -Directory | Select-Object -ExpandProperty Name)"
69+
$modelerfourNodeModules = Join-Path $modelerfourCacheDir "4.24.3\node_modules\@autorest\modelerfour"
70+
Write-Host "Cache modelerfour 4.24.3 node_modules present: $(Test-Path $modelerfourNodeModules)"
71+
} else {
72+
Write-Host "WARNING: Autorest modelerfour cache directory not found at $modelerfourCacheDir"
73+
}
6674
Write-Host "npm registry: $(npm config get registry 2>&1)"
75+
Write-Host "npm_config_registry env: $env:npm_config_registry"
6776
Write-Host "NPM_CONFIG_USERCONFIG: $env:NPM_CONFIG_USERCONFIG"
6877
$userNpmrc = Join-Path $env:USERPROFILE ".npmrc"
6978
Write-Host "~/.npmrc exists: $(Test-Path $userNpmrc)"
79+
if (Test-Path $userNpmrc) {
80+
Write-Host "~/.npmrc registry line: $(Select-String -Path $userNpmrc -Pattern '^registry=' | Select-Object -First 1 -ExpandProperty Line)"
81+
}
7082
Write-Host "--- End diagnostics ---"
7183

7284
$RequiredGraphModules = @()

tools/GenerateServiceModule.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,10 @@ $ApiVersion | ForEach-Object {
6969
else {
7070
$FullModuleVersion = $ModuleMetadata.versions[$CurrentApiVersion].version
7171
}
72+
# Route autorest's internal npm registry calls (fetchPackageMetadata for extension
73+
# resolution) through the private feed. The public npm registry is DNS-blocked by
74+
# 1ES supply-chain security enforcement on release pipelines.
75+
$env:npm_config_registry = "https://microsoftgraph.pkgs.visualstudio.com/0985d294-5762-4bc2-a565-161ef349ca3e/_packaging/PowerShell_V2_Build/npm/registry/"
7276
$autorestLog = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), "autorest-$($ModuleFullName -replace '[^a-zA-Z0-9-]', '-').log")
7377
npx autorest --verbose --max-memory-size=$MaxMemorySize --module-version:$FullModuleVersion --module-name:$ModuleFullName --service-name:$Module --input-file:$OpenApiFile $AutoRestModuleConfig --max-cpu=2 --network-calls=2 2>&1 | Out-File -FilePath $autorestLog -Encoding utf8
7478
$autorestExitCode = $LASTEXITCODE

0 commit comments

Comments
 (0)