Skip to content

Re-fork Octopus changes onto NuGet 8.0.0 - #28

Merged
enf0rc3 merged 7 commits into
release/8.0.xfrom
nessie/will/8.0.x-octopus-fork
Dec 2, 2026
Merged

enf0rc3 merged 7 commits into
release/8.0.xfrom
nessie/will/8.0.x-octopus-fork

Conversation

@enf0rc3

@enf0rc3 enf0rc3 commented Nov 17, 2026 •

Copy link
Copy Markdown

Background

Octopus Server uses our NuGet.Client fork. The fork is on NuGet 7.3 today. #24 released the 7.3 fork.

NuGet 8.0.0 has since shipped with Visual Studio 2026 version 18.12. We expect NuGet 8.0 to get long-term support.

This PR re-forks our changes onto the official 8.0.0 release.

Results

release/8.0.x is the upstream commit that nuget.org built 8.0.0 from. This PR adds 7 commits on top:

The CI commit only holds the changes NuGet 8.0 needs:

  • build.ps1 has no -Fast or -SkipUnitTest switch. The workflow passes -Pack -CI.
  • The fork versions one patch above upstream. Upstream 8.0.0 builds as 8.0.1-octopus-release.N.
  • Upstream 8.0 adds 100 to the build number of every package. The workflow applies the same offset to match the package file names.
  • The build number is now run_number * 10 + run_attempt. The old scheme passed the assembly version limit of 65534 at workflow run 656.

#24 also re-exported the .NET SDK environment variables for GitHub Actions. NuGet 8.0 builds without that change. This PR leaves the change out.

#24 also corrected 3 comments in build.ps1. This PR leaves those comments as upstream wrote them.

NuGet 8.0 packages ship net472 and net10.0 assets only. A consumer needs to target net10.0.

Quality

I compared each commit with its commit in #24. Four commits make identical changes: both proxy commits, #16, and the Octopus CI/CD commit. The other 2 commits differ because of upstream changes in 8.0.

ReleaseNotes (#10)

  • Our ReleaseNotes code is nullable-annotated in 9 files. NuGet 8.0 compiles every project with nullable types on.
  • The public API entries carry nullable annotations. The net8.0 file is now net10.0. Upstream removed the netstandard2.0 file.
  • PackageSearchMetadata.ReleaseNotes has a JsonIgnore attribute for each serializer. Upstream added System.Text.Json attributes to that model.
  • ReleaseNotes passes through upstream's new CacheStrings method. The 2 upstream tests that count cached strings now expect one more.

Original version string (#13)

Two cherry-picks had merge conflicts. #10 conflicted for the reasons above. #16 conflicted where upstream added a test next to our tests. This PR keeps both tests.

All NuGet.Core unit tests pass on net10.0 and net472 in CI. CI only runs test/NuGet.Core.Tests. The NuGet.CommandLine tests have no CI run.

OctopusDeploy/OctopusDeploy#51140 moves Octopus Server to this fork.

🤖 Generated with Claude Code

(cherry picked from commit 84c6e31)
…Cache.UseProxy() was returning _overrideProxySet (that was always true) for our usages (#11)

Removed UseProxy from the proxy cache (as it wasn't a actual configuration option from our consumer, and instead it was inferred), and instead rely on the default HttpClientHandler behavior that sets it to true

Also renamed _overrideProxyCredentials -> _overrideDefaultProxyCredentials to be more clear that its to be treated differently to the _overrideProxyWithCustomProxy that i also re-named to make it clear that this is really a 'third' option for the proxy.

This will mean the IProxyCache.GetProxy hierarchy is now (depending on configuration):

Custom Proxy
User Proxy
System Proxy
No Proxy

(cherry picked from commit 9c5f644)
- Add ReleaseNotes property to IPackageSearchMetadata interface
  - Implement ReleaseNotes in all metadata classes (LocalPackageSearchMetadata, PackageSearchMetadataV2Feed, etc.)
  - Fix PackageSearchMetadataBuilder.FromIdentity() to include ReleaseNotes
  - Fix PackageSearchMetadataV2Feed second constructor missing ReleaseNotes assignment
  - Add ReleaseNotes to PackageSearchMetadataContextInfo and Create() method
  - Update wrapper classes (RecommendedPackageSearchMetadata, TransitivePackageSearchMetadata)
  - Add V2FeedPackageInfo constructor overload for backwards compatibility
  - Update PublicAPI.Unshipped.txt files for all target frameworks
  - Update GlobalSuppressions.cs for new method signatures
  - Fix test fixtures and add missing ReleaseNotes assertions

(cherry picked from commit b0d0a26)
Throw if we accidentally use a normalized version.

Even though this will be a runtime failure, I feel it's better we're more obvious when something is wrong.

(cherry picked from commit b1f6924)
… credentials change (#16)

Added Credentials to the equality comparer for PackageSource so that when HttpSourceResourceProvider caches HttpClients, it creates a new client when the credentials change. Previously it was returning the same HttpClient (which already has credentials set) regardles of the PackageSource.Credentails value.

This was a re-implementation of dd0d988#diff-2e2f5bc7aba32eb58bd35315bbc3322399bbf8efd6e84fe7ef1bd95b45dab6a3

(cherry picked from commit 19f95b6)
- Added support for a "permanent" pre-release of -octopus that we will use as our own internal version based off the "official" releases.

removed unused config in the main yml

re-added configure

Updated CI/CD to include build information and simplified create release config

Updated prefix to be dev so its "lower" than proper release versions (#18)

NuGet feeds order alphabetically descending after the semver, this means versions with "pr-" are considered "newer" than our  "octopus-release" branch

Update nuget package versioning to use "octopus" and "branch name" (#17)

We want to include "octopus" in the version name to make it clear that the version is a "octopus" version, and use the branch name in the version release label for PR's too.

Refactor NuGet package list in workflow file (#14)

Reverted the packages version specification as the wildcard is not supported, they were previously just defaulting to the 'latest' created package.

Fix build conflict with official package (#12)

When we 'create a release' it is specifying the package version against the "PackageId" However this causes a conflict on the package id `Nuget.CommandLine` becuse we push a new `Nuget.CommandLine` and we also consume a `Nuget.CommandLine` to do the release.

The new config will specify the new packageId and packageName only for the specific step that we have the new one, so every other instance will use the official version.

(cherry picked from commit cb37afb)
@enf0rc3
enf0rc3 force-pushed the nessie/will/8.0.x-octopus-fork branch from 0999106 to 870f986 Compare November 30, 2026 20:31
@enf0rc3
enf0rc3 marked this pull request as ready for review December 1, 2026 00:11
@borland

borland commented Dec 1, 2026

Copy link
Copy Markdown

I've reviewed the changes here. I haven't gone in-depth, but I've confirmed that they fit my expectations based on the previous times we've done this.

I've sent a claude review agent for the PR, it will approve if it doesn't find anything major or minor that needs fixing

@borland borland left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤖 Claude: Approving. The six fork commits are faithful ports of the 7.3 fork. A git range-diff against release/7.3.x shows only nullable annotations, the PublicAPI move to net10.0, the new upstream CacheStrings hooks for ReleaseNotes, and test fixups. The CI run for this PR built, tested and pushed 8.0.1-dev-…​.46301 packages whose names match PACKAGE_VERSION. I found two minor issues and nothing that should block the merge.

Minor: CI build number runs out of UInt16 range, and the new +100 offset causes a duplicate version first

Location: .github/workflows/main.yml ("Set BuildNumber" and "Set PackageVersion"), together with build/config.props and build/common.targets

BUILD_NUMBER is run_number with the 2-digit run_attempt appended. This PR's run is NuGet#462, so it builds as 46201 and the offset makes it 46301. Both counts are close to the 65535 limit.

  • Run 655: 65501 + 100 is more than 65535, so neither the workflow nor config.props adds the offset, and the package is …​.65501. Run 654 attempt 1 already produced …​.65501 (65401 + 100). The Octopus package push will then fail on the duplicate version, or overwrite the earlier package.
  • Run 656 onwards: PreReleaseVersion = 65601. That value goes into FileVersion and the net472 AssemblyVersion ($(SemanticVersion).$(PreReleaseVersion)). An assembly version part above 65534 is a compiler error (CS7034), so the build will fail.

The nightly schedule alone adds one run a day, so this is about 190 runs away, roughly six months or less. The run_number + attempt scheme came over from #24, but the offset makes the collision new. The best time to fix it is now: no 8.0.1-octopus-release.* package exists yet, so a smaller build number won't sort below anything already released.

Suggestion: use a smaller monotonic number, e.g. run_number * 10 + min(run_attempt, 9), or run_number minus a fixed base. Keep the result plus 100 at or below 65534.

Minor: nuget spec no longer writes the $version$ token (from #13, also in the 7.3 fork)

Location: src/NuGet.Clients/NuGet.CommandLine/Commands/SpecCommand.cs:139, test/NuGet.Clients.Tests/NuGet.CommandLine.Test/NuGetSpecCommandTest.cs:44,85

SpecCommand sets manifest.Metadata.Version = new NuGetVersion("1.0.0"), or NuGetVersion.Parse("1.0.0") when there is no project file. With the fork's ToString() that version serialises as its original string, <version>1.0.0</version>. The #13 commit changed the replacement to look for <version>1.0</version>, which never matches.

  • Effect: nuget.exe spec in a project folder writes a fixed 1.0.0 version instead of $version$.
  • Tests: NuGetSpecCommandTest was changed to expect 1.0, so SpecCommand_NoProjectFile, SpecCommand_NoProjectFile_WithArg and SpecCommand_WithProjectFile should all fail. CI never noticed because the workflow only runs test/NuGet.Core.Tests.

The SpecCommand.cs hunk looks like it was copied from an older fork where the sample version was 1.0. The 7.3 and 8.0 upstream code already uses 1.0.0.

Suggestion: drop the SpecCommand.cs hunk and the two NuGetSpecCommandTest expectation changes from the #13 commit. NuGet.CommandLine is one of the packages pushed to Octopus.

What I checked and could not check

  • Ported code: I compared each ported commit with its 7.3 counterpart. Nothing was lost in the #10 and #16 conflict resolutions. 8.0 still uses the same collections keyed by PackageSource as 7.3, so including Credentials in Equals touches the same places as before.
  • CI run: I read the steps of the PR's run (46507091072). It ran all 19 NuGet.Core test projects with no failures, and the package push and release creation succeeded.
  • Not run: I could not run test/NuGet.Clients.Tests (Windows/net472 only), so the SpecCommand finding comes from reading the code, not from running it.
  • Not checked: I did not search every new 8.0 production code path for ToString() on a NuGetVersion built with the numeric constructor, which throws in the fork. The NuGet.Core suite passes, but coverage outside those tests is unknown.

The Octopus workflow needs four changes to build NuGet 8.0.

build.ps1 has no -Fast or -SkipUnitTest switch. The workflow now passes
-Pack -CI, which builds the nupkg files and leaves the unit tests to
their own step.

Upstream 8.0.0 now builds as 8.0.1-octopus-release.N. A pre-release of
8.0.0 sorts below 8.0.0, so security scanners would treat the fork as
older than the upstream release it contains. build/config.props keeps
the upstream version so merges from upstream stay conflict free; CI
bumps the patch through the PatchNuGetVersion environment variable.

Upstream 8.0 adds 100 to the build number of every package it builds
(the "Offset the CI build number by 100" block in build/config.props).
The workflow applies the same offset to PACKAGE_VERSION so it matches
the package file names the build produces.

The build number is now run_number * 10 + run_attempt. It becomes the
last part of the net472 assembly version, which must stay at or below
65534. The old scheme (run_number followed by a 2-digit attempt) passed
that limit at run 656, and the offset made runs 654 and 655 produce the
same version. The new scheme leaves room for about 6,500 runs.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@enf0rc3
enf0rc3 force-pushed the nessie/will/8.0.x-octopus-fork branch from 870f986 to 8e551a7 Compare December 1, 2026 02:47
@borland

borland commented Dec 1, 2026

Copy link
Copy Markdown

To answer the claude review

CI build number runs out of UInt16 range, and the new +100 offset causes a duplicate version first
Suggestion: use a smaller monotonic number, e.g. run_number * 10 + min(run_attempt, 9), or run_number minus a fixed base. Keep the result plus 100 at or below 65534.

This seems valid but not important. We can worry about it next time we re-fork, or if the nightlies break in 6 months, whichever comes first

Minor: nuget spec no longer writes the $version$ token

I'm not sure if this is an intentional change in our fork, or not.

Given the issue is also in the 7.3 fork and that hasn't caused any problems, I'd say we're fine. My suggestion would be to merge this PR now, then follow up either with a change to put back the $version$ token, or to add some kind of test or comment explaining that the change is deliberate

My conclusion is yes, approve

@enf0rc3
enf0rc3 merged commit d047efa into release/8.0.x Dec 2, 2026
2 checks passed
@enf0rc3

enf0rc3 commented Dec 2, 2026

Copy link
Copy Markdown
Author

Both items from the review are fixed in this PR. They went in before the merge.

Build number. The workflow now uses run_number * 10 + run_attempt. Run 463 built and pushed 8.0.1-dev-nessie-will-8.0.x-octopus-fork.4731 with the new scheme. The change went in now because no 8.0.1-octopus-release package existed yet. A smaller number sorts below nothing. The fix is part of the "Fix CI/CD workflow for NuGet 8.0" commit.

nuget spec. The change in #13 was unintentional. The default manifest writes 1.0.0. The command then replaces that text with $version$. SpecCommand.cs and its test match upstream again. The fix is part of the #13 commit.

7.3. release/7.3.x keeps the old build number scheme and the old nuget spec behaviour. We plan to stop building 7.3, so that branch needs no change.

The PR was merged with a rebase to keep one commit per fork change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants