[deckhouse-cli] Add file flag to upload packages instead of dir specify#389
Open
haosb wants to merge 8 commits into
Open
[deckhouse-cli] Add file flag to upload packages instead of dir specify#389haosb wants to merge 8 commits into
haosb wants to merge 8 commits into
Conversation
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- `PushServiceOptions.Packages` is now the only source of packages to push. - CLI validation already resolves it before `PushService` runs, so the old `BundleDir` scan fallback never executed. - Drops `resolvePackagePaths` and `findPackages`, about 60 lines no code path could reach. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- `canonicalPackagePath` and `packageNameFromPath` detect chunks via `filepath.Ext == ".chunk"`, matching the real `<name>.tar.NNNN.chunk` naming chunk_writer produces. - `cmd/push` had no tests before; `validation_test.go` now covers `resolvePackages`, `collectBundlePathPackages`, and `collectFilesPackages`. - Covers chunk dedup across multiple `.chunk` files and the single-archive push path (bundle arg or `--file`). - `push_test.go` checks `packageNameFromPath` stays in sync with `canonicalPackagePath`'s `.tar`-only output. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
- `canonicalPackagePath` matches `.tar.` only in the base name, so a chunk under a directory like `bundle.tar.gz.d/` resolves to the correct package. - A chunk in such a directory is no longer collapsed to a missing `.tar` and silently skipped while push still exits 0. - Add regression tests: a parent-dir case in `TestCanonicalPackagePath` and a chunk inside a `.tar.`-named dir in `TestCollectFilesPackages`. Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Signed-off-by: Roman Berezkin <roman.berezkin@flant.com>
Glitchy-Sheep
approved these changes
Jul 3, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the d8 mirror push command to allow pushing one or more package archives directly via a new --file flag, making the bundle directory argument optional and improving validation/test coverage around argument parsing and package path handling.
Changes:
- Added
--file(repeatable) to accept tar/chunked package paths and made[images-bundle-path]optional. - Refactored push package resolution to build a unified list of package archives from either the optional bundle argument and/or
--file. - Added unit tests for push argument/package validation and for package name derivation.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Taskfile.yml | Removes an unused release tagging task. |
| internal/mirror/push.go | Switches push service input from bundle dir scanning to an explicit package path list; updates unpack/open logic accordingly. |
| internal/mirror/push_test.go | Adds coverage for packageNameFromPath expectations. |
| internal/mirror/cmd/push/validation.go | Implements optional bundle arg + --file merging, canonicalization, and temp dir defaults. |
| internal/mirror/cmd/push/validation_test.go | Adds extensive tests for new validation/package resolution behavior. |
| internal/mirror/cmd/push/push.go | Updates command usage/args and wires resolved Packages into mirror.PushServiceOptions. |
| internal/mirror/cmd/push/flags.go | Adds the --file string-array flag. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+70
to
+77
| func resolvePackages(bundleArg []string) error { | ||
| Packages = nil | ||
|
|
||
| if len(bundleArg) == 1 { | ||
| if err := collectBundlePathPackages(bundleArg[0]); err != nil { | ||
| return err | ||
| } | ||
| } |
Comment on lines
+165
to
+168
| func isPackageFile(name string) bool { | ||
| ext := filepath.Ext(name) | ||
| return ext == ".tar" || ext == ".chunk" | ||
| } |
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
--fileto specifiy platform/modules tar archives in case to simply push one archive instead of pointing to whole dir.--fileflag is specified.Manual checks and how feature look like
--fileare specified:--fileand bundle dir are not specified: