Skip to content

Use RegenPreview parallel regeneration in publish pipeline for manual runs - #11713

Merged
Jorge Rangel (jorgerangel-msft) merged 18 commits into
mainfrom
copilot/update-pipeline-regeneration-step
Aug 20, 2026
Merged

Use RegenPreview parallel regeneration in publish pipeline for manual runs#11713
Jorge Rangel (jorgerangel-msft) merged 18 commits into
mainfrom
copilot/update-pipeline-regeneration-step

Conversation

Copilot AI commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

The publish pipeline's regen step regenerates SDK libraries one service directory at a time via dotnet msbuild eng/service.proj, while RegenPreview.ps1 already regenerates libraries concurrently. This shares that mechanism with Submit-AzureSdkForNetPr.ps1, gated to manual pipeline runs. Pipeline parameters and the set of files committed to the azure-sdk-for-net PR are unchanged.

RegenPreview.psm1 — new shared helpers (moved out of RegenPreview.ps1)

  • Get-SdkLibrariesToRegenerate — discovers libraries whose tsp-location.yaml references a TypeSpec C# emitter package json. -EmitterPackageJsonPaths restricts to specific emitters; -AzureLibrariesOnly preserves the local script's Azure.* filter.
  • Invoke-SdkLibraryRegeneration — installs tsp-client and builds the codegen plugin once, then runs dotnet build /t:GenerateCode /p:SkipTspClientInstall=true /p:SkipBuildPlugin=true per library in parallel. Options: -ThrottleLimit, -NpmRegistry (temporary .env override), -AdditionalBuildArgs, -SerialServiceDirectories.
  • Write-RegenerationReport — pass/fail summary, optional JSON report path.
  • -SerialServiceDirectories runs those libraries (e.g. ai, whose libraries share a generator plugin output folder) in a serial batch after the parallel one, replacing the old /m:1 /p:BuildInParallel=false handling.

RegenPreview.ps1

  • Delegates to the shared helpers; behavior unchanged.

Submit-AzureSdkForNetPr.ps1

  • New -UseParallelRegeneration switch and -RegenerationThrottleLimit. When set, the discovered libraries are regenerated in parallel with /p:Trace=true instead of looping over service directories.
  • Each failed library is reported through the existing Register-StepFailure path, so manual runs still fail before opening a PR.
  • Without the switch, the per-service-directory msbuild loop is untouched.

publish.yml

  • Passes the switch only for manual runs, using the same expression idiom as the existing flags:
${{ replace(replace('True', ne(variables['Build.Reason'], 'Manual'), ''), 'True', '-UseParallelRegeneration') }}

docs/RegenPreview.md

  • Documents the shared helpers and when the pipeline uses them.

Note for reviewers

The parallel path regenerates only the libraries matching the emitter patterns, whereas the msbuild path regenerates every generatable project in a matched service directory — so the resulting PR could contain slightly fewer changes if a matched service directory also holds libraries generated by other emitters.

Copilot AI and others added 2 commits August 18, 2026 16:14
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added the emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp label Aug 18, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI changed the title Use RegenPreview parallel regeneration for manual publish pipeline runs Use RegenPreview parallel regeneration in publish pipeline for manual runs Aug 18, 2026
@pkg-pr-new

pkg-pr-new Bot commented Aug 18, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http-client-csharp@11713

commit: ab011bc

Comment thread packages/http-client-csharp/eng/pipeline/publish.yml
Comment thread packages/http-client-csharp/eng/scripts/docs/RegenPreview.md Outdated
Comment thread packages/http-client-csharp/eng/scripts/Submit-AzureSdkForNetPr.ps1 Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Shares SDK regeneration helpers and enables faster per-library regeneration for manual publish runs.

Changes:

  • Extracts discovery, parallel regeneration, and reporting into RegenPreview.psm1.
  • Adds manual-run parallel regeneration to the PR submission pipeline.
  • Documents the shared workflow and preserves the existing automated path.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Submit-AzureSdkForNetPr.ps1 Adds optional parallel regeneration and failure reporting.
RegenPreview.psm1 Provides shared regeneration helpers.
RegenPreview.ps1 Delegates existing behavior to shared helpers.
docs/RegenPreview.md Documents helper APIs and pipeline usage.
publish.yml Enables parallel regeneration for manual runs.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Comment thread packages/http-client-csharp/eng/scripts/RegenPreview.psm1 Outdated
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Comment thread packages/http-client-csharp/eng/scripts/RegenPreview.ps1 Outdated
Copilot AI and others added 2 commits August 18, 2026 17:03
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Comment thread packages/http-client-csharp/eng/scripts/RegenPreview.ps1 Outdated
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>
Co-authored-by: jorgerangel-msft <102122018+jorgerangel-msft@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated no new comments.

Suppressed comments (3)

packages/http-client-csharp/eng/scripts/Submit-AzureSdkForNetPr.ps1:624

  • This derives the parallel scope from the requested switches instead of $emitterPatterns, which only contains emitters that were prepared successfully. If the Azure or management generator setup fails in the caught blocks above, its switch remains true and this branch still regenerates those libraries with stale artifacts, contradicting the existing “continuing without ... regeneration” recovery. Restrict discovery directly to the successfully prepared emitter patterns.
                $allLibraries = @(Get-SdkLibrariesToRegenerate -SdkRepoPath $tempDir)
                $librariesToRegenerate = @(Filter-LibrariesByGenerator `
                    -Libraries $allLibraries `
                    -Azure:$RegenerateAzureLibraries `

packages/http-client-csharp/eng/scripts/Submit-AzureSdkForNetPr.ps1:68

  • The PR description promises a -RegenerationThrottleLimit parameter, but only the parallel switch is exposed here and the invocation always uses the helper's automatic 4–12 job limit. Manual pipeline callers therefore cannot apply the documented throttle control. Add the integer parameter and forward it to Invoke-SdkLibraryRegeneration -ThrottleLimit.

This issue also appears on line 621 of the same file.

  [Parameter(Mandatory = $false)]
  [switch]$UseParallelRegeneration

packages/http-client-csharp/eng/scripts/RegenPreview.psm1:1032

  • The shared discovery API is missing the -AzureLibrariesOnly option described by this PR. The removed local helper explicitly excluded Microsoft.* and every name not starting with Azure., but all three replacement call sites in RegenPreview.ps1 now use this unrestricted helper. Any matching non-Azure library is therefore newly included in local selection/regeneration, despite the stated behavior-preservation goal. Add the switch here and pass it from the local script's discovery calls to retain the previous contract.
        [Parameter(Mandatory = $false)]
        [string[]]$EmitterPackageJsonPaths

Merged via the queue into main with commit 6f61820 Aug 20, 2026
30 checks passed
@jorgerangel-msft
Jorge Rangel (jorgerangel-msft) deleted the copilot/update-pipeline-regeneration-step branch August 20, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants