[mirror] Honor --modules-path-suffix and warn on a moved modules path#410
Open
Glitchy-Sheep wants to merge 19 commits into
Open
[mirror] Honor --modules-path-suffix and warn on a moved modules path#410Glitchy-Sheep wants to merge 19 commits into
Glitchy-Sheep wants to merge 19 commits into
Conversation
- `PushServiceOptions.ModulesPathSuffix` carries the flag value from `d8 mirror push` down to the push service. - `modulesSegment()` resolves the registry segment for modules: empty option keeps the default `modules`, surrounding slashes are trimmed. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Rewrite the leading "modules" registry segment to the configured
suffix in both the layout push and the discovery-index step.
The bundle layout on disk is untouched, so the remap is registry-only
and legacy module-*.tar bundles keep working.
Empty suffix ("/") pushes modules to the target repo root.
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- Cover the four `--modules-path-suffix` cases through `PushService.Push`: default and `/modules` keep `<repo>/modules/<name>`, `/` pushes to the repo root, `/my/mods` nests deeper. - Each case checks the discovery index tag follows the modules to the same repo. - A non-default suffix must leave nothing at the default `modules/` path, so modules are moved and not copied. - A non-module `install` layout stays at `<repo>/install` for every suffix. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- The push flag and README described it as a source-repo suffix, which is a pull concept; on push it selects the target repo path. - New text says what the flag does and how "/" pushes to the repo root. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
The modules registry segment was hardcoded to "modules" in the service constructor. Add a WithModulesPathSuffix option so callers can point the modules client elsewhere, defaulting to "modules" so existing behavior is unchanged. Expose GetModulesSegment for building matching references. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Route every source-registry module reference through moduleRegistryPath, which joins the configurable modules segment from the registry service. Discovery-index scope and these references now share one source of truth, so a non-default --modules-path-suffix points them at the same place. The bundle-internal "modules" tar layout is left untouched. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Pass the pull flag into the registry service so module discovery and image pulls read from the configured source path. The flag was parsed but never reached discovery, which hardcoded the "modules" segment. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Mirror the push help wording on the read side and note that "/" reads modules from the source repo root, so the round-trip flag is symmetric and discoverable. Update the pull flag help and the README table. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
validateModulesAccess was never called by Execute and encoded the old suffix semantics (suffix joined to the non-edition repo), which the fix replaced. Delete it, its test, and the now-unused path import. Clarify that the modules suffix is applied in NewService, not the RegistryPath scoping above it. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
The scope-by-path loop was copied into push, the registry service, and a test; suffix normalization was duplicated across push and the service. Consolidate the split into pkgclient.PathToSegments (fed into the variadic WithSegment) and export registryservice.NormalizeModulesPath, so push and pull cannot drift on what a suffix means. Rename the resolved modules location from "...Segment" to "...Path" (modulesPath, GetModulesPath, NormalizeModulesPath): it holds a possibly multi-segment path like "my/mods", not a single segment, and is distinct from the raw ModulesPathSuffix flag value. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Glitchy-Sheep
marked this pull request as ready for review
July 22, 2026 04:23
Map each mirrored component to its registry path and flag a non-default modules path (--modules-path-suffix). Shared by the pull and push summaries. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Move the framed-summary colours, box helpers and formatters out of the pull renderer into internal/mirror/summaryui so pull and push share one look. Add WriteRegistryLayout for the registry layout section, and document the rendered output with worked examples. Pull aliases the moved primitives to stay unchanged. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Add a Registry section to the pull summary: the source repo and each component's path, with a moved modules path (--modules-path-suffix) highlighted. Shown under --verbose-summary or when the path differs from the default. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Make PushService.Push return a PushSummary and collect what was pushed (platform, installer, security DBs, module and package counts). Render a framed push summary matching the pull one, always showing the registry layout so a moved modules path (--modules-path-suffix) is visible where it was applied. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Note in the pull and push README sections that the summary shows a Registry layout and highlights a moved modules path. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- Print a `Warning:` header above the Registry block when `--modules-path-suffix` moves modules off the default. - Warn in plain text, not by colour alone, so it holds up in piped logs and for colour-blind readers. - Wrap the Registry block in blank lines so it reads apart from the component stats. - Live in the shared `summaryui.WriteRegistryLayout`, so pull and push stay identical. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- The pull/push summary showed a full registry layout for every component; now it prints just the moved `Modules` row, in yellow with a `default:` hint. - The warning fires only when `--modules-path-suffix` actually moved the path and modules went through it, so a default path or a module-free run stays silent. - `--verbose-summary` no longer forces the section: paths shown only when there's something to act on. - Replace the `RegistryLayout` model with a slim `ModulesPathReport` and rename `WriteRegistryLayout` to `WriteModulesPathWarning`. Signed-off-by: Roman Berezkin <roman.berezkin@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.
Summary
--modules-path-suffixwas accepted by bothd8 mirror pushandd8 mirror pullbut had no effect.This PR makes it work on both sides, and warns in the pull/push summary when modules end up on a non-default path.
Problem
The flag was parsed into params on both commands and then ignored.
<repo>/modules/<name>, whatever the flag value. The registry segment came from the unpacked bundle layout, and nothing read the flag.validateModulesAccess, whichExecutenever calls. Real discovery and image pulls hardcoded themodulessegment.Fix
modulesregistry segment to the configured path, for both the layout push and the discovery-index tags.WithModulesPathSuffix), and route discovery plus every module reference through one source of truth.modules/<name>layout on disk, so a mirror pulled with one suffix and pushed with another round-trips cleanly.modules;/places modules at the repo root.Summary warning
--modules-path-suffix).Modulesrow, in yellow, with a dimmeddefault:hint.Before / After
Before:
--modules-path-suffix /is ignored. Push writes to<repo>/modules/<name>, pull reads from<repo>/modules/<name>.After: push writes to
<repo>/<name>, pull reads from<repo>/<name>. Discovery index tags follow the modules to the same repo, and the summary warns about the moved path:Tests
TestPushService_ModulesPathSuffix: runsPushService.Pushon a fake registry for four suffix values; checks image path, discovery tag, an untouched non-module layout, and the summary (module count, moved flag).TestService_ModulesPathSuffix: runs pull module discovery for the same four values; checks discovery and references agree on the source location.TestBuildModulesPathReport: resolves the modules path and flags a moved path for default /// custom / multi-segment values.TestWriteModulesPathWarning: silent on a default path and on a moved-but-unused path; shows the moved row with adefault:hint; emits colour only when enabled.TestRenderPullSummary/TestRenderPushSummary: the warning fires only when the path was moved and modules were transferred./, then pull it back with/.Notes
modules/; push applies its own target suffix.internal/mirror/summaryuipackage so pull and push look identical.PathToSegmentshelper replaces three copies of the same loop, a singleNormalizeModulesPathkeeps push and pull in sync, and a dead access-check that encoded the old suffix model is removed.