From 4a0bac1a4841e786f50aeda34fb362cbdfd9e163 Mon Sep 17 00:00:00 2001 From: Nick Josevski Date: Thu, 28 May 2026 19:45:02 +1000 Subject: [PATCH] Add VersioningStrategy and VersionTagRegex to ChannelRule and SearchPackageVersionsQuery MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ChannelRule gains two new optional fields to support the MostRecentlyPublished ordering strategy introduced in Octopus Server: - VersioningStrategy: "MostRecentlyPublished" orders packages by publish date instead of SemVer comparison; unset or "SemVer" preserves existing behaviour - VersionTagRegex: regex matched against the full version/tag string, used with MostRecentlyPublished as an alternative to VersionRange + Tag SearchPackageVersionsQuery gains the corresponding query parameters: - versioningStrategy: passed to the /feeds/{id}/packages endpoint - versionTagRegex: regex filter on the full version string Both changes are purely additive — existing fields and behaviour are unchanged. --- pkg/channels/channel_rule.go | 10 ++++++++++ pkg/feeds/search_package_versions_query.go | 2 ++ 2 files changed, 12 insertions(+) diff --git a/pkg/channels/channel_rule.go b/pkg/channels/channel_rule.go index 98e79f64..53c271ec 100644 --- a/pkg/channels/channel_rule.go +++ b/pkg/channels/channel_rule.go @@ -14,5 +14,15 @@ type ChannelRule struct { //to specify the range of versions to include VersionRange string `json:"VersionRange,omitempty"` + // VersioningStrategy controls how packages are ordered to determine the latest version. + // Set to "MostRecentlyPublished" to use publish date ordering instead of SemVer comparison. + // When unset or "SemVer", the existing behaviour applies. + VersioningStrategy string `json:"VersioningStrategy,omitempty"` + + // VersionTagRegex is a regex matched against the full version/tag string. + // Used with VersioningStrategy "MostRecentlyPublished" as an alternative to + // VersionRange and Tag, supporting non-SemVer versioning schemes. + VersionTagRegex string `json:"VersionTagRegex,omitempty"` + resources.Resource } diff --git a/pkg/feeds/search_package_versions_query.go b/pkg/feeds/search_package_versions_query.go index b6e904ab..f4b0945a 100644 --- a/pkg/feeds/search_package_versions_query.go +++ b/pkg/feeds/search_package_versions_query.go @@ -10,4 +10,6 @@ type SearchPackageVersionsQuery struct { Skip int `uri:"skip,omitempty"` Take int `uri:"take,omitempty"` VersionRange string `uri:"versionRange,omitempty"` + VersioningStrategy string `uri:"versioningStrategy,omitempty"` + VersionTagRegex string `uri:"versionTagRegex,omitempty"` }