[deckhouse-cli] mirror: support multiple version constraints for the same module/package#379
Merged
Conversation
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
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.
Currently repeating a module or package name in a filter expression (e.g.
--include-module foo@=v1.0.0 --include-module foo@=v1.1.0) errors out or silently drops all but the last declaration. This change makes it possible to pin multiple versions of the same name in a singlemirror pullinvocation.What changed
MultiConstraint— an OR-combination of constraints for the same name. It is produced automatically when a name is repeated on the command line and is transparent to all existing code paths.NewFilterwithmergeConstraints, which folds repeated declarations into aMultiConstraint.ExactConstraintsOfandSemverConstraintsOfhelpers that flatten aMultiConstraintinto typed slices, used byapplyChannelAliasesand the proxy-registry probe path respectively.VersionsToMirrornow recursively resolvesMultiConstraintsub-constraints and deduplicates the resulting tag list so overlapping ranges don't cause redundant pulls.applyChannelAliases(modules and packages) now iterates over all pinned tags. The historical behaviour — a single pinned tag without an explicit+channelsuffix is propagated to every release channel — is preserved only when exactly one version is pinned; when several are pinned simultaneously each one is aliased only to its own explicitly named channel (if any) to avoid them overwriting one another.probeModuleTags/probePackageTagsnow iterate over every semver sub-constraint so proxy-registry probing works correctly with aMultiConstraint.listAllVersionTagsto package mirroring sovX.Y.Z-only tags (e.g. dev packages that publish no release channels) are discovered and cloned even when they wouldn't be reached by channel-based discovery.Example
Both
v1.2.0andv1.3.0are now pulled instead of only the last declaration winning.