Skip to content

Handle MostRecentlyPublished channel rule strategy in release create#608

Merged
NickJosevski merged 3 commits into
mainfrom
nj/non-semver-ordering
Jul 15, 2026
Merged

Handle MostRecentlyPublished channel rule strategy in release create#608
NickJosevski merged 3 commits into
mainfrom
nj/non-semver-ordering

Conversation

@NickJosevski

Copy link
Copy Markdown
Contributor

Summary

When a channel version rule has VersioningStrategy: "MostRecentlyPublished", the CLI now sends versioningStrategy and versionTagRegex query parameters to the package feed instead of preReleaseTag and versionRange. This ensures the server uses publish-date ordering to suggest the latest package version during release create, supporting non-SemVer versioning schemes such as Docker image tags, date-stamps, and feature branch names.

Before: a channel rule with MostRecentlyPublished strategy would have its VersionRange (empty) and Tag (empty) sent — the server would fall back to SemVer ordering, returning the wrong package suggestion.

After: versioningStrategy=MostRecentlyPublished and versionTagRegex=<pattern> are sent, the server applies publish-date ordering and the correct regex filter.

Dependency

Requires go-octopusdeploy PR #421 to be merged first, which adds VersioningStrategy/VersionTagRegex fields to ChannelRule and SearchPackageVersionsQuery. The go.mod version bump will be done in a follow-up commit once that PR is tagged.

Related

Server-side implementation: OctopusDeploy/OctopusDeploy PR #43750

Test plan

  • Existing TestReleaseCreate_BuildPackageVersionBaseline tests all pass (9 cases)
  • New test case: uses_versioningStrategy_and_versionTagRegex_query_params_when_channel_rule_has_MostRecentlyPublished_strategy — verifies correct query params are sent and preReleaseTag/versionRange are absent

…sionBaselineForChannel

When a channel version rule has VersioningStrategy "MostRecentlyPublished", send
versioningStrategy and versionTagRegex query parameters to the package feed instead
of preReleaseTag and versionRange. This ensures the server uses publish-date ordering
to suggest the latest package version, supporting non-SemVer versioning schemes.

Depends on go-octopusdeploy PR #421 (VersioningStrategy/VersionTagRegex fields on
ChannelRule and SearchPackageVersionsQuery). go.mod will be updated to the new
go-octopusdeploy release once that PR is merged and tagged.
@NickJosevski

Copy link
Copy Markdown
Contributor Author

Will fail until other related PRs in Server are merged...

@NickJosevski NickJosevski requested a review from zentron June 1, 2026 08:03
Follow-on to PR #608 to match OctopusDeploy #44073: VersionRange, Tag and
VersionTagRegex are now always applied together; VersioningStrategy only
changes ordering (publish-date vs SemVer), not which versions satisfy the
rule. Replace the earlier either/or branching that dropped Tag/VersionRange
under MostRecentlyPublished and never sent VersionTagRegex under SemVer.

Update the test to assert all four params are sent together, and correct the
expected query-param order to match uritemplates expansion (template order).

go.mod still pins the client that lacks these fields, so this does not yet
compile; bump pending the go-octopusdeploy release (see TODO).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
v2.112.1 adds VersioningStrategy and VersionTagRegex to
channels.ChannelRule and feeds.SearchPackageVersionsQuery
(go-octopusdeploy#421), which BuildPackageVersionBaselineForChannel
already consumes. Removes the go.mod TODO now that the release exists.

Corrects the expected query string in create_test.go: the client emits
query params alphabetically, confirmed against the real client build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@NickJosevski NickJosevski merged commit 1e2698a into main Jul 15, 2026
3 checks passed
NickJosevski added a commit that referenced this pull request Jul 15, 2026
Follow-on to PR #608 to match OctopusDeploy #44073: VersionRange, Tag and
VersionTagRegex are now always applied together; VersioningStrategy only
changes ordering (publish-date vs SemVer), not which versions satisfy the
rule. Replace the earlier either/or branching that dropped Tag/VersionRange
under MostRecentlyPublished and never sent VersionTagRegex under SemVer.

Update the test to assert all four params are sent together, and correct the
expected query-param order to match uritemplates expansion (template order).

go.mod still pins the client that lacks these fields, so this does not yet
compile; bump pending the go-octopusdeploy release (see TODO).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@NickJosevski NickJosevski deleted the nj/non-semver-ordering branch July 15, 2026 08:15
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