Skip to content

[deckhouse-cli] mirror: support multiple version constraints for the same module/package#379

Merged
ldmonster merged 2 commits into
mainfrom
fix/packages-mirroring
Jun 2, 2026
Merged

[deckhouse-cli] mirror: support multiple version constraints for the same module/package#379
ldmonster merged 2 commits into
mainfrom
fix/packages-mirroring

Conversation

@ldmonster
Copy link
Copy Markdown
Collaborator

@ldmonster ldmonster commented Jun 2, 2026

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 single mirror pull invocation.

What changed

  • Added 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.
  • Replaced the "module redeclared" error in NewFilter with mergeConstraints, which folds repeated declarations into a MultiConstraint.
  • Added ExactConstraintsOf and SemverConstraintsOf helpers that flatten a MultiConstraint into typed slices, used by applyChannelAliases and the proxy-registry probe path respectively.
  • VersionsToMirror now recursively resolves MultiConstraint sub-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 +channel suffix 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 / probePackageTags now iterate over every semver sub-constraint so proxy-registry probing works correctly with a MultiConstraint.
  • Added listAllVersionTags to package mirroring so vX.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

d8 mirror pull \
  --include-package myapp@=v1.2.0 \
  --include-package myapp@=v1.3.0 \
  ...

Both v1.2.0 and v1.3.0 are now pulled instead of only the last declaration winning.

Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
@ldmonster ldmonster self-assigned this Jun 2, 2026
@ldmonster ldmonster changed the title [deckhouse-cli] fix multiple packages and modules pull times [deckhouse-cli] mirror: support multiple version constraints for the same module/package Jun 2, 2026
@ldmonster ldmonster added the bug Something isn't working label Jun 2, 2026
Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
@ldmonster ldmonster merged commit 7c7c19b into main Jun 2, 2026
5 checks passed
@ldmonster ldmonster deleted the fix/packages-mirroring branch June 2, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant