Skip to content

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

Merged
agneszitte merged 5 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-25666
Nov 3, 2026
Merged

agneszitte merged 5 commits into
release/stable/6.7from
mergify/bp/release/stable/6.7/pr-25666

Conversation

@mergify

@mergify mergify Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

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


This is an automatic backport of pull request #25666 done by [Mergify](https://mergify.com).

agneszitte and others added 5 commits November 3, 2026 07:39
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]>
(cherry picked from commit ae3783d)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit a89958b)
Co-Authored-By: Claude Opus 5.5 <[email protected]>
(cherry picked from commit e16a487)
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]>
(cherry picked from commit 677baf6)
- 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]>
(cherry picked from commit 987e24b)
@github-actions github-actions Bot added the area/build Categorizes an issue or PR as relevant to build infrastructure label Nov 3, 2026
@mergify mergify Bot mentioned this pull request Nov 3, 2026
1 of 5 tasks
@agneszitte
agneszitte merged commit feb3beb into release/stable/6.7 Nov 3, 2026
12 of 16 checks passed
@agneszitte
agneszitte deleted the mergify/bp/release/stable/6.7/pr-25666 branch November 3, 2026 07:41
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant