Skip to content

Ramsess/fix release pipeline#3593

Open
ramsessanchez wants to merge 19 commits intomainfrom
ramsess/fix-release-pipeline
Open

Ramsess/fix release pipeline#3593
ramsessanchez wants to merge 19 commits intomainfrom
ramsess/fix-release-pipeline

Conversation

@ramsessanchez
Copy link
Copy Markdown
Contributor

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.

@ramsessanchez ramsessanchez requested a review from a team as a code owner April 24, 2026 20:52
@ramsessanchez
Copy link
Copy Markdown
Contributor Author

Comment thread .azure-pipelines/common-templates/install-tools.yml
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/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this just point at the authenticated .npmrc file and thus avoid having this same URL duplicated all over the place?

Copy link
Copy Markdown
Contributor Author

@ramsessanchez ramsessanchez Apr 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-Yaml usage with a lightweight YAML key/value parser to remove the powershell-yaml install step.
  • Updated pipeline/tooling to authenticate against a private npm feed, pre-install AutoRest extensions into ~/.autorest, and run Rush via npx.
  • 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.

Comment on lines +123 to +127
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
Comment on lines +39 to +41
# 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
Comment thread tools/GenerateModules.ps1
Comment on lines +51 to +52
npx rush install
npx rush build
Comment thread tools/GenerateModules.ps1
Comment on lines +74 to +75
Write-Host "npm registry: $(npm config get registry 2>&1)"
Write-Host "npm_config_registry env: $env:npm_config_registry"
Comment on lines 64 to +76
- 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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants