@@ -69,12 +69,23 @@ $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/"
72+ # Pass @autorest/modelerfour as a local --use:<path> argument so autorest loads it
73+ # directly from the pre-populated cache without calling fetchPackageMetadata.
74+ # fetchPackageMetadata is called unconditionally before the cache check inside
75+ # ExtensionManager.findPackage, and it hits the npm registry which is DNS-blocked
76+ # by 1ES supply-chain security on release pipelines. A local --use path bypasses
77+ # findPackage entirely: the extension goes straight into localExtensions, and when
78+ # use-extension in autorest-configuration.md is processed, resolveExtension finds
79+ # it there without any registry call.
80+ $autorestHome = if ($env: AUTOREST_HOME ) { $env: AUTOREST_HOME } else { Join-Path $env: USERPROFILE " .autorest" }
81+ $modelerFourPath = Join-Path $autorestHome " @autorest" " modelerfour" " 4.24.3" " node_modules" " @autorest" " modelerfour"
82+ $modelerFourUseFlag = if (Test-Path $modelerFourPath ) { @ (" --use:$modelerFourPath " ) } else { @ () }
83+ if ($modelerFourUseFlag.Count -eq 0 ) {
84+ Write-Host - ForegroundColor Yellow " WARNING: @autorest/modelerfour local cache not found at $modelerFourPath — autorest will attempt npm registry lookup (may fail in network-isolated environment)"
85+ }
86+
7687 $autorestLog = [System.IO.Path ]::Combine([System.IO.Path ]::GetTempPath(), " autorest-$ ( $ModuleFullName -replace ' [^a-zA-Z0-9-]' , ' -' ) .log" )
77- 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
88+ npx autorest @modelerFourUseFlag -- 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
7889 $autorestExitCode = $LASTEXITCODE
7990 if ($autorestExitCode -ne 0 ) {
8091 Write-Host - ForegroundColor Red " AutoREST failed (exit $autorestExitCode ) generating '$ModuleFullName '."
0 commit comments