[deckhouse-cli] download only latest patches#361
Merged
Conversation
Signed-off-by: Pavel Okhlopkov <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
d8 mirror pull --include-module [email protected]pulled every patch in the matchedsemver range (8 version tags × channel aliases = 13 pulls per module). The root
cause was that
Filter.VersionsToMirrorreturned every tag that satisfied thesemver constraint without any per-minor deduplication.
Closes #220.
Solution
Apply a latest-patch-per-minor filter to versions matched by
^,~, andrange constraints — mirroring the platform release-discovery rule
(
filterOnlyLatestPatchesininternal/mirror/platform/platform.go).Anchor exception
Versions explicitly named with an inclusive boundary operator (
>=or<=)are always preserved, even when a newer patch exists in the same minor.
>=1.40.0literally encodes "v1.40.0 OR newer" — the equality is part of theoperator and silently dropping the named boundary in favour of a later patch
would override an explicit user request. Only
>=and<=create anchors;strict bounds (
>,<) and shorthand operators (^,~) do not.Anchors that are absent from the registry are skipped — no tag is ever invented.
Behaviour table
[email protected]/^1.40.0v1.40.1only (issue #220 case)module@~1.40.0v1.40.1onlymodule@>=1.40.0v1.40.0,v1.40.1(anchor preserved)module@>=1.40.0 <=1.42.5v1.40.0,v1.40.1, …,v1.42.5module@>1.40.0v1.40.1only (strict — no anchor)module@=v1.40.0v1.40.0only (exact)Changes
internal/mirror/modules/constraints.go—SemanticVersionConstraintnowcarries an
anchorsfield populated by scanning>=/<=sub-expressionsin the raw constraint string via
extractInclusiveAnchors.internal/mirror/modules/filter.go—VersionsToMirrorappliesfilterOnlyLatestPatchesthen callsrestoreInclusiveAnchorsto re-add anyanchor that was collapsed by the per-minor filter.
internal/mirror/modules/filter_test.go— 7 new unit test cases covering>=anchor preservation,<=anchor, strict>non-anchor, caretnon-anchor, missing-anchor skip, and the
>=/<=combined case.internal/mirror/modules/pull_modules_test.go— updated integration tests +new
bare >= preserves anchorrow inTestPullModules_SemverConstraintPullsAllMatchingTags.internal/mirror/cmd/pull/flags/flags.go+internal/mirror/README.MD—documented the anchor rule and updated examples.