Skip to content

Fail http-client-csharp publish pipeline on step errors in manual runs - #11277

Merged
jorgerangel-msft merged 2 commits into
mainfrom
copilot/fix-publish-pipeline-manual-mode
Jul 16, 2026
Merged

Fail http-client-csharp publish pipeline on step errors in manual runs#11277
jorgerangel-msft merged 2 commits into
mainfrom
copilot/fix-publish-pipeline-manual-mode

Conversation

Copilot AI commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

In packages/http-client-csharp/eng/pipeline/publish.yml, manual runs currently downgrade step failures to warnings (SucceededWithIssues) and still open a PR in azure-sdk-for-net, giving reviewers a false positive. Manual runs should instead fail the pipeline.

Changes

  • Submit-AzureSdkForNetPr.ps1
    • Added -BuildReason parameter; sets $FailOnError when it equals 'Manual'.
    • Added Register-StepFailure helper that records each downgraded failure and preserves the existing ##vso[task.complete result=SucceededWithIssues;] signal.
    • Routed all previously swallowed failures through it — npm install/build, Generate.ps1, sparse-checkout expansion, Azure/mgmt generator builds, and per-service code generation (including their catch counterparts).
    • Before commit/PR creation, throws a summary of failures when $FailOnError is set; the existing outer catch converts this to exit 1, so no PR is opened.
  • publish.yml: passes -BuildReason '$(Build.Reason)'.

Automated (scheduled/CI/main) runs are unchanged — they continue reporting SucceededWithIssues and proceed.

$FailOnError = $BuildReason -eq 'Manual'
# ...steps use Register-StepFailure instead of Write-Warning + SucceededWithIssues...
if ($FailOnError -and $script:StepFailures.Count -gt 0) {
    $failureSummary = ($script:StepFailures | ForEach-Object { "- $_" }) -join [Environment]::NewLine
    throw "One or more steps failed during a manual run; not creating a pull request:$([Environment]::NewLine)$failureSummary"
}

@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.

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 Jul 16, 2026
Copilot AI changed the title [WIP] Fail publish pipeline if there are failures when running in manual mode Fail http-client-csharp publish pipeline on step errors in manual runs Jul 16, 2026
Copilot AI requested a review from jorgerangel-msft July 16, 2026 19:44
@pkg-pr-new

pkg-pr-new Bot commented Jul 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: ed6754f

@jorgerangel-msft
jorgerangel-msft marked this pull request as ready for review July 16, 2026 21:39
@jorgerangel-msft
jorgerangel-msft added this pull request to the merge queue Jul 16, 2026
Merged via the queue into main with commit 057a61f Jul 16, 2026
29 checks passed
@jorgerangel-msft
jorgerangel-msft deleted the copilot/fix-publish-pipeline-manual-mode branch July 16, 2026 22:55
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.

Fail Publish Pipeline if there are Failures When Running in Manual Mode

3 participants