Ramsess/fix release pipeline#3593
Conversation
| customCommand: install -g autorest@3.7.2 | ||
|
|
||
| workingDir: $(Build.SourcesDirectory) | ||
| customCommand: install -g autorest@3.7.2 --registry https://microsoftgraph.pkgs.visualstudio.com/0985d294-5762-4bc2-a565-161ef349ca3e/_packaging/PowerShell_V2_Build/npm/registry/ |
There was a problem hiding this comment.
shouldn't this just point at the authenticated .npmrc file and thus avoid having this same URL duplicated all over the place?
There was a problem hiding this comment.
this was required due to the -global install, since global install wouldn't use the local authentication file. Changed to a local install and this flag is no longer needed.
There was a problem hiding this comment.
Pull request overview
This PR updates the release/generation tooling to work in network-isolated pipelines by eliminating PSGallery dependency for YAML parsing, preconfiguring private feeds, and pre-populating AutoRest extension caches to avoid registry lookups during generation.
Changes:
- Replaced
ConvertFrom-Yamlusage with a lightweight YAML key/value parser to remove thepowershell-yamlinstall step. - Updated pipeline/tooling to authenticate against a private npm feed, pre-install AutoRest extensions into
~/.autorest, and run Rush vianpx. - Adjusted module dependency management to rely on configured NuGet sources instead of forcing nuget.org.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/WriteToModuleReadMe.ps1 | Replaces ConvertFrom-Yaml with a simple YAML parser for the Versioning block. |
| tools/ReadModuleReadMe.ps1 | Same simple YAML parsing change for reading versioning fields. |
| tools/ManageGeneratedModule.ps1 | Removes explicit nuget.org source when adding packages. |
| tools/GenerateServiceModule.ps1 | Forces AutoRest to load @autorest/modelerfour from a local cache and captures verbose logs to a file. |
| tools/GenerateModules.ps1 | Removes PSGallery dependency, switches Rush invocation to npx, and adds diagnostics about cache/registry state. |
| tools/Configure-PrivateNpmFeed.ps1 | Adds generation of a repo-local NuGet.config pointing to the private feed. |
| .azure-pipelines/common-templates/install-tools.yml | Copies authenticated .npmrc to user profile, installs tools, pre-populates ~/.autorest extension cache, and runs Rush via npx. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| npx rush install | ||
| if ($LASTEXITCODE -ne 0) { throw "rush install failed with exit code $LASTEXITCODE" } | ||
| npx rush link | ||
| if ($LASTEXITCODE -ne 0) { throw "rush link failed with exit code $LASTEXITCODE" } | ||
| npx rush rebuild |
| # Create NuGet.config to redirect dotnet restore to the private feed | ||
| $nugetFeed = $Registry -replace "/npm/registry/$", "/nuget/v3/index.json" | ||
| $nugetConfig = @" |
| } | ||
|
|
||
| $autorestLog = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), "autorest-$($ModuleFullName -replace '[^a-zA-Z0-9-]', '-').log") | ||
| 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 |
| npx rush install | ||
| npx rush build |
| Write-Host "npm registry: $(npm config get registry 2>&1)" | ||
| Write-Host "npm_config_registry env: $env:npm_config_registry" |
| - task: Npm@1 | ||
| displayName: Install AutoRest | ||
| inputs: | ||
| command: custom | ||
| customCommand: install -g autorest@3.7.2 | ||
|
|
||
| workingDir: $(Build.SourcesDirectory) | ||
| customCommand: install autorest@3.7.2 | ||
|
|
||
| - task: Npm@1 | ||
| displayName: Install AutorestCore | ||
| inputs: | ||
| command: custom | ||
| customCommand: install -g @autorest/core@3.10.4 | ||
| workingDir: $(Build.SourcesDirectory) | ||
| customCommand: install @autorest/core@3.10.4 |
There was a problem hiding this comment.
@ramsessanchez looks like there's a good reason not to use local installs over global installs, that said I think you can use the -c option to pass the .npmrc file that points at the private registry
Ensure all npm calls are skipped during autorest generation release by pre-downloading dependencies from private registry so that the pipeline is compliant with network isolation policies in release job workflow.