Skip to content

ci(craft): publish each NuGet package as its own craft target - #5753

Merged
jamescrosswell merged 2 commits into
mainfrom
ci/craft-nuget-workspaces
Oct 21, 2026
Merged

jamescrosswell merged 2 commits into
mainfrom
ci/craft-nuget-workspaces

Conversation

@ric-oliv

@ric-oliv ric-oliv commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

getsentry/craft#686 adds a workspaces mode to craft's nuget target, for repos with many NuGet packages that depend on each other. We publish all 22 packages through a single nuget target today.

This PR turns that mode on. Craft reads Sentry.slnx and the project files and splits the target into one nuget[<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-duplicate and 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 targets from the head of #686 with this config, on a copy of main without submodules. That's how getsentry/publish checks out the repo. It lists exactly the 22 packages from 6.12.1, plus github and registry. Each target's file pattern matches only its own .nupkg and .snupkg, and every package comes after the packages it depends on. On version7 it also picks up Sentry.Extensions.Hosting without any config change.

Discovery doesn't evaluate MSBuild. Five test apps have their own Directory.Build.props, so test/Directory.Build.props never sets IsPackable=false for them and craft treats them as packages. includeWorkspaces drops AndroidTestApp and SingleFileTestApp, and excludeWorkspaces drops Sentry.TrimTest, Sentry.MauiTrimTest and Sentry.Testing.CrashableApp. The perfview projects under modules/ 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 nuget target and keep using --skip-duplicate. Our release.yml pins 2.34.1, and 2.35.1 is the current getsentry/craft:latest image 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.yml gives the publish issue one checkbox per package. Until then the issue shows a single nuget checkbox, 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 .nupkg already reached nuget.org even though its target failed. That happens when nuget.org accepts the upload and craft times out anyway, or when the .nupkg push works and the .snupkg push 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.p7s that nuget.org adds when it signs the package. If they match, craft skips the .nupkg and pushes the .snupkg on 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 .snupkg matches nuget.org's copy byte for byte.

This also fixes a gap we have today. With --skip-duplicate, a retry skips the .snupkg together with the .nupkg, so those symbols are never published and nothing reports it.

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]>
@ric-oliv
ric-oliv requested a review from BYK October 20, 2026 10:16
@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.82%. Comparing base (876f7a6) to head (a8ebeab).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ric-oliv
ric-oliv marked this pull request as ready for review October 21, 2026 10:42
@github-actions github-actions Bot added the risk: medium PR risk score: medium label Oct 21, 2026

@sentry-junior sentry-junior Bot 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.

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 targets from the head of getsentry/craft#686 (cf6df6f) on this branch (a8ebeab), without submodules. It lists exactly the 22 .nupkg names from the 6.12.1 GitHub release, in dependency order, plus github and registry. The only warnings are the two missing modules/perfview projects.
  • Older craft versions: in 2.34.1 and 2.35.1 the target config schema is .passthrough(), and the nuget target has no expand and still passes --skip-duplicate. So the new keys are ignored until #686 ships, as described. release.yml pins 2.34.1, and 2.35.1 is the latest craft release.
  • Publish issue: dependabot.yml covers github-actions, so the craft action bump will come automatically. getsentry/publish's update-issue.js appends 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)

  1. The nuget checkbox doesn't skip the expanded targets. Craft matches publish state by target id, and the ids are now nuget[Sentry], nuget[Sentry.AspNetCore] and so on. An issue created by the 2.34.1 prepare action has a single nuget box. 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.
  2. 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.
  3. Possible follow-up for the silent-miss risk you called out: a CI step could compare craft targets with the .nupkg files that dotnet pack produces. 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.

@ric-oliv

Copy link
Copy Markdown
Member Author

@jamescrosswell We're technically now on a point where both dotnet and Craft are ready to go.

Do you agree? :)

@BYK BYK left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Craft change landed, if you give me the go, I'll cut a new release.

Comment thread .craft.yml
@@ -1 +1 @@
minVersion: 2.26.3

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'd bump this to 3.0.0 or whatever the new version becomes to be safe.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

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!

@ric-oliv ric-oliv Oct 22, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Here it is #5770!

@jamescrosswell jamescrosswell left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

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

@jamescrosswell
jamescrosswell merged commit 29f984f into main Oct 21, 2026
@jamescrosswell
jamescrosswell deleted the ci/craft-nuget-workspaces branch October 21, 2026 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants