Repository navigation
ci(craft): publish each NuGet package as its own craft target - #5753
Conversation
Craft's nuget target is dropping --skip-duplicate (getsentry/craft#686). With our single nuget target, a retry after a partly failed publish would stop at the first package that's already on nuget.org. With workspaces enabled, craft splits the target into one target per package, in dependency order, and a retry skips the packages that already went out. Craft releases without workspace support pass the new keys through and keep publishing everything as one target, so this is safe to merge before the craft release. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5753 +/- ##
=======================================
Coverage 75.82% 75.82%
=======================================
Files 519 519
Lines 19235 19235
Branches 3741 3741
=======================================
Hits 14584 14584
Misses 3781 3781
Partials 870 870 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Looks good to me. I checked the config and the claims in the description, and found nothing blocking.
What I verified
- Expansion: I ran
craft targetsfrom the head of getsentry/craft#686 (cf6df6f) on this branch (a8ebeab), without submodules. It lists exactly the 22.nupkgnames from the 6.12.1 GitHub release, in dependency order, plusgithubandregistry. The only warnings are the two missingmodules/perfviewprojects. - Older craft versions: in 2.34.1 and 2.35.1 the target config schema is
.passthrough(), and the nuget target has noexpandand still passes--skip-duplicate. So the new keys are ignored until #686 ships, as described.release.ymlpins 2.34.1, and 2.35.1 is the latest craft release. - Publish issue:
dependabot.ymlcoversgithub-actions, so the craft action bump will come automatically. getsentry/publish'supdate-issue.jsappends targets from the state file that the issue doesn't list, so the per-package checkboxes do appear after the first run.
Worth knowing (non-blocking)
- The
nugetcheckbox doesn't skip the expanded targets. Craft matches publish state by target id, and the ids are nownuget[Sentry],nuget[Sentry.AspNetCore]and so on. An issue created by the 2.34.1 prepare action has a singlenugetbox. If someone ticks it to skip NuGet, the new craft still runs all 22 targets. In practice that's harmless, because #686's check finds identical packages on nuget.org and skips them. It's just not a skip. - Publishing becomes sequential. Today the single target pushes all packages in parallel. Now craft runs one target after another, and the first failure stops the remaining ones. That's what keeps the dependency order, but a release will take a bit longer.
- Possible follow-up for the silent-miss risk you called out: a CI step could compare
craft targetswith the.nupkgfiles thatdotnet packproduces. A filter that misses a new package (or picks up a new test app) would then fail a PR instead of quietly shipping a release without it.
|
@jamescrosswell We're technically now on a point where both dotnet and Craft are ready to go. Do you agree? :) |
BYK
left a comment
There was a problem hiding this comment.
Craft change landed, if you give me the go, I'll cut a new release.
| @@ -1 +1 @@ | |||
| minVersion: 2.26.3 | |||
There was a problem hiding this comment.
I'd bump this to 3.0.0 or whatever the new version becomes to be safe.
There was a problem hiding this comment.
Good point... I'll open another PR bumping this.
but we don't have any release planned for now, so feel free to cut the new release already!
jamescrosswell
left a comment
There was a problem hiding this comment.
@jamescrosswell We're technically now on a point where both dotnet and Craft are ready to go.
Do you agree? :)
Sure let's give it a go. Especially since --skip-duplicate has already been removed from craft.
getsentry/craft#686 adds a
workspacesmode to craft's nuget target, for repos with many NuGet packages that depend on each other. We publish all 22 packages through a singlenugettarget today.This PR turns that mode on. Craft reads
Sentry.slnxand the project files and splits the target into onenuget[<PackageId>]target per package, in dependency order. Each target keeps its own publish state, so a retry only runs the packages that didn't go out.#686 also drops
--skip-duplicateand replaces it with a check against nuget.org, described below. That check would get a retry of a single target through as well, but it downloads and compares every package that's already published. With one target per package, a retry skips those and only works on the ones that failed.#skip-changelog
What craft will publish
I ran
craft targetsfrom the head of #686 with this config, on a copy ofmainwithout submodules. That's how getsentry/publish checks out the repo. It lists exactly the 22 packages from 6.12.1, plusgithubandregistry. Each target's file pattern matches only its own.nupkgand.snupkg, and every package comes after the packages it depends on. Onversion7it also picks upSentry.Extensions.Hostingwithout any config change.Discovery doesn't evaluate MSBuild. Five test apps have their own
Directory.Build.props, sotest/Directory.Build.propsnever setsIsPackable=falsefor them and craft treats them as packages.includeWorkspacesdropsAndroidTestAppandSingleFileTestApp, andexcludeWorkspacesdropsSentry.TrimTest,Sentry.MauiTrimTestandSentry.Testing.CrashableApp. The perfview projects undermodules/aren't checked out during publish, and craft skips them with a warning.The risk I see is the opposite case. If we add a package that the filters miss, craft doesn't publish it and the release still succeeds.
When to merge
Craft versions without workspace support pass the new keys through. With this config, craft 2.34.1 and 2.35.1 both still list a single
nugettarget and keep using--skip-duplicate. Ourrelease.ymlpins 2.34.1, and 2.35.1 is the currentgetsentry/craft:latestimage that getsentry/publish runs. So this PR can merge before craft releases #686, and it takes effect with that release. Merging it first means our first release on that craft already uses one target per package.Once craft is released, Dependabot's bump of the craft action in
release.ymlgives the publish issue one checkbox per package. Until then the issue shows a singlenugetcheckbox, and getsentry/publish adds the per-package targets to it as they finish.Retrying after a partial publish
A retry can find a package whose
.nupkgalready reached nuget.org even though its target failed. That happens when nuget.org accepts the upload and craft times out anyway, or when the.nupkgpush works and the.snupkgpush fails. Our PDBs ship only in the.snupkg, so that version would have no symbols on the NuGet symbol server.#686 handles this without
--skip-duplicate. Before each push, craft checks whether nuget.org already has that version. If it does, craft downloads it and compares every file with ours, ignoring the.signature.p7sthat nuget.org adds when it signs the package. If they match, craft skips the.nupkgand pushes the.snupkgon its own when nuget.org doesn't have it yet. If they differ, the target fails. If craft can't reach nuget.org to check, it pushes as before, and a duplicate fails. A retry within a few minutes of an upload can still get a 409 while nuget.org validates the package, and waiting a few minutes before retrying gets past it.I ran that check from craft against nuget.org with the release files of all 23 packages in 7.0.0-rc.2. Every package came back identical with its symbols published, and every
.snupkgmatches nuget.org's copy byte for byte.This also fixes a gap we have today. With
--skip-duplicate, a retry skips the.snupkgtogether with the.nupkg, so those symbols are never published and nothing reports it.