Skip to content

fix(ci): Make nuget.org push re-runs resume - #25666

Merged
agneszitte merged 5 commits into
masterfrom
dev/agzi/nuget-org-push-rerun
Oct 23, 2026
Merged

agneszitte merged 5 commits into
masterfrom
dev/agzi/nuget-org-push-rerun

Conversation

@agneszitte

@agneszitte agneszitte commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

GitHub Issue: closes #25665

PR Type:

🏗️ Build or CI related changes

What changed? 🚀

Before:

  • Re-running a failed nuget.org publish job stopped on the first package the previous attempt had pushed (409 on Uno.DevServer in build 241054). NuGetCommand@2 can't pass -SkipDuplicate, and its allowPackageConflicts only recognizes Azure Artifacts' conflict message, not nuget.org's.
  • Packages were pushed in alphabetical order, so a push that stopped midway could publish Uno.Sdk.Private and Uno.WinUI without their other packages. That happened with 7.0.0-dev.2428.

After (in build/ci/templates/nuget-publish-public.yml, used by the dev and release publish stages):

  • A new "Prepare the nuget.org push" step sorts the packages into three batches, pushed one after the other:
    1. all other packages,
    2. Uno.WinUI (what apps resolve),
    3. Uno.Sdk.Private (what the uno.templates Uno.Sdk updater picks new versions from).
  • If a batch fails, the later ones don't run, so a half-published version is never exposed.
  • New package IDs stop the job before anything is pushed. The step checks every package ID on nuget.org. If one doesn't exist yet (the CI key can't create it), the job fails with an error on the build summary. The error names the .nupkg to upload by hand from the nuget-packages artifact, and says to re-run once it's listed. Today that case shows up as an unexplained 403 halfway through the push.
  • On a re-run (System.JobAttempt > 1), the step leaves out packages already listed on nuget.org, so the re-run pushes only what's missing. First attempts still push everything, so an unexpected duplicate still fails.
  • allowPackageConflicts is removed from the nuget.org push, since it had no effect there.
  • The push tasks keep "Publish to nuget.org" in their display names.

Why not dotnet nuget push --skip-duplicate: NuGetAuthenticate@1 can't use an API-key service connection, so it would need the nuget.org key as a separate pipeline secret. That's one more place to rotate it every 30 days.

Validation

  • Ran the step's script locally against the 34 packages of build 241054, plus fake packages that aren't on nuget.org:
    • Attempt 1: "Packages" gets the 32 others plus the fake, "Uno.WinUI" and "Uno.Sdk.Private" get one each. Only package IDs are checked against nuget.org, not versions.
    • Attempt 2: the 34 real packages are reported as already on nuget.org, and only the existing-ID fake is left to push. The Uno.WinUI and Uno.Sdk.Private batches are skipped.
    • New ID: with a fake package whose ID isn't on nuget.org, the step exits 1 before setting any push variable. It logs: New package Uno.WinUI.FakeNotPublished isn't on nuget.org yet, and CI can't create a new package ID. Upload Uno.WinUI.FakeNotPublished.7.0.0-dev.2428.nupkg from this build's nuget-packages artifact at https://www.nuget.org/packages/manage/upload (owner: unoplatform), wait until it's listed, then re-run this job.
    • The first two cases ran without that fake, with only a fake new version of an existing ID.
  • Expanded the "Uno.UI - CI" pipeline from this branch with the Azure DevOps preview API. Both publish stages get the prepare step and the three push tasks with the expected folders and conditions.
  • The publish stages don't run on PR builds. The first master build after merge exercises the new steps.

Known limit

nuget.org doesn't list a new package right away: today's manual uploads took up to ~20 minutes. A re-run started sooner than that can still hit a 409 on a package the previous attempt just pushed. The step prints this, and a later re-run then completes the push.

PR Checklist ✅

🤖 Generated with Claude Code

Re-running the nuget.org publish job failed on the first package the
previous attempt had pushed: NuGetCommand@2 can't pass -SkipDuplicate,
and its allowPackageConflicts doesn't recognize nuget.org's 409.

A prepare step now sorts the packages into batches, leaving out the
ones already on nuget.org on a re-run (System.JobAttempt > 1). The
batches are pushed in order, with Uno.WinUI and then Uno.Sdk.Private
last, so a push that stops midway doesn't expose a version whose other
packages are missing.

Fixes #25665

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@agneszitte agneszitte self-assigned this Oct 23, 2026
@github-actions github-actions Bot added the area/build Categorizes an issue or PR as relevant to build infrastructure label Oct 23, 2026
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @agneszitte's task in 25s —— View job


Review of #25666

Verdict: ship (1 minor finding, posted inline).

Severity Count
Blocking 0
Minor 1

What I checked (by inspection only; I did not run the pipeline):

  • Batch ordering: each push task uses succeeded() and its own NuGetOrgPush<batch> variable. A failed batch therefore skips the later ones, so Uno.WinUI and Uno.Sdk.Private only go out after everything else.
  • Re-run logic: only System.JobAttempt > 1 queries nuget.org, so a first attempt still fails on an unexpected duplicate. If every package is already listed, $target is never created. The Get-ChildItem ... -ErrorAction SilentlyContinue handles that, and no batch variable is set.
  • Version matching: splitting off +build metadata and using -contains (case-insensitive) matches nuget.org's lowercase normalized versions.
  • check-master-status.ps1: the display names still start with "Publish to nuget.org".
  • Template parameters: the pushBatches parameter has a default, so existing callers don't need changes.

Notes (no action required):

  • If the nuget.org lookup fails three times, the step warns and pushes the package anyway. A 409 can follow, which matches the documented ~30-minute listing lag and is acceptable fail-open behavior.
  • The HttpClient isn't disposed. That doesn't matter in a short-lived step.
  • The first master build after merge is the real test, as the PR description says.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @agneszitte's task in 14s —— View job


Re-review of #25666 after the new commit

Verdict: ship

Severity Count
Blocking 0
Minor 0 new

I checked this by reading the code. I did not run the pipeline.

  • The latest commit (a89958b3) only changes the listing-delay message in the step from ~30 to ~20 minutes. I found no new problems in it.
  • The earlier inline suggestion is still open. It asks for a clear error when a .nupkg has no root .nuspec. It's optional.
  • The PR description's "Known limit" section still says ~30 minutes, while the script now says ~20. Update the description so the two match.

@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @agneszitte's task in 13s —— View job


Re-review of #25666 after commit e16a4876

Verdict: ship

Severity Count
Blocking 0
Minor 0

I checked this by reading the diff. I did not run the pipeline.

  • e16a4876 adds the guard I suggested earlier. A .nupkg with no root .nuspec now fails with a clear message that names the package. Before, it failed with a null-reference error. The throw sits inside the try, so the zip handle is still released.
  • That earlier inline suggestion is now resolved.
  • One item is still open from the last review. The PR description's "Known limit" section says ~30 minutes, but the script says ~20. Update the description so the two match.

The CI key can't create a package ID, so the push used to stop midway
with an unexplained 403. The prepare step now checks every package ID
first and, if one isn't on nuget.org yet, fails before pushing anything
with an error that names the file to upload by hand.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @agneszitte's task in 18s —— View job


Re-review of #25666 after commit 677baf68

Verdict: ship

Severity Count
Blocking 0
Minor 0

I checked this by reading the diff. I did not run the pipeline.

  • New-package stop: Get-NuGetOrgListing returns Reached, Exists and Versions. A 404 on the flat-container index collects the package into $newPackages, and the step exits 1 before it creates any batch variable. Nothing is pushed in that case, so there is no half-published version. The error text tells the user what to upload and where.
  • Fail-open path: if nuget.org can't be reached after 3 tries, the step warns and falls through to the normal push. That still fits the earlier "fail open" decision.
  • Re-run skip: only $isRerun filters on Versions -contains, so first attempts still fail on an unexpected duplicate.
  • Lookups on every attempt: nuget.org is now queried on first attempts too, to find new IDs. That adds one request per package. If nuget.org is down, the retries add up to about 10s per package, which is fine for this step.
  • Unverified claim: the "403 if the key doesn't allow the new package" hint in the error message depends on nuget.org's key scoping. I couldn't confirm that from the repo. It is only a hint, so it doesn't matter much.

Still open from the earlier review: the PR description's "Known limit" section says ~30 minutes, but the script says ~20. Update the description so the two match. The description also doesn't mention the new-package stop yet.

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

LGTM. A few non-blocking suggestions inline.

Checked: both callers run on hosted vmImage agents (no stale nuget-org-push folder on re-run); the nuget-packages artifact only holds *.nupkg, so copying into batch folders doesn't drop any .snupkg that nuget push would have sent along; a skipped/failed prepare step leaves the batch variables unset so all three pushes skip; -contains is case-insensitive against the lowercased flat-container versions.

- Define the last batches once, as package IDs in pushBatches.
- Don't retry nuget.org answers that a retry won't change.
- Log the 403 hint as its own warning.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @agneszitte's task in 17s —— View job


Re-review of #25666 at 987e24b0

Verdict: ship

Severity Count
Blocking 0
Minor 1

I read the diff and did not run the pipeline. I posted no inline comments.

The latest commit addresses the open review nits:

  • Batches in one place: pushBatches now drives both the PowerShell step and the push tasks. The last two batches are matched by package ID, so the names can no longer drift apart.
  • Retries: non-retryable 4xx responses no longer retry. 429 and 5xx still do.
  • Error output: the 403 hint is now its own warning line.
  • Batch variables: names like NuGetOrgPushUno.WinUI contain dots. Azure DevOps accepts dots in variable names, and the condition uses the same name the step sets.

Minor, in the PR description (not the code): the validation section still names the batches "UnoWinUI" and "UnoSdkPrivate". The batches are now Uno.WinUI and Uno.Sdk.Private, so the push tasks display as Publish to nuget.org (Uno.WinUI) and so on. The Publish to nuget.org prefix is unchanged. Update the description to match.

The first master build after merge is still the real test for the push tasks.

@agneszitte
agneszitte merged commit b4eaceb into master Oct 23, 2026
21 of 30 checks passed
@agneszitte
agneszitte deleted the dev/agzi/nuget-org-push-rerun branch October 23, 2026 17:55
@unodevops

Copy link
Copy Markdown
Contributor

🤖 Your WebAssembly Sample App stage site is ready! Visit it here:

@agneszitte

Copy link
Copy Markdown
Member Author

@Mergifyio backport release/stable/6.7 servicing/6.8

@mergify

mergify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

backport release/stable/6.7 servicing/6.8

✅ Backports have been created

Details

agneszitte added a commit that referenced this pull request Nov 3, 2026
…r-25666

fix(ci): Make nuget.org push re-runs resume (backport #25666)
agneszitte added a commit that referenced this pull request Nov 3, 2026
…6.7/pr-25666

fix(ci): Make nuget.org push re-runs resume (backport #25666)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Categorizes an issue or PR as relevant to build infrastructure area/ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Re-running the nuget.org publish job fails on packages it already pushed

3 participants