feat: support attach command to attach a file to existed model artifact#141
Merged
feat: support attach command to attach a file to existed model artifact#141
Conversation
There was a problem hiding this comment.
Pull Request Overview
This pull request adds a new attach command to the modctl tool while enhancing the build and push commands with spinners during the nydusification process, and it updates dependency management accordingly. Key changes include introducing attach.go in both config and backend, refactoring builder functions to use an explicit model config, and integrating spinner feedback into build/push/attach commands.
Reviewed Changes
Copilot reviewed 23 out of 24 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/modelfile/constants*.go | Renamed variables and function to export constants and utility functions appropriately. |
| pkg/config/attach.go | Introduced a new configuration type to support the attach command. |
| pkg/backend/{attach.go,attach_test.go} | Added the attach command implementation and tests, including layer replacement logic. |
| pkg/backend/build/* | Refactored builder functions to work with an explicit model config rather than a modelfile. |
| pkg/backend/push.go, pull.go, fetch.go, remote/client.go | Refactored remote client creation to use a common helper with spinner and error improvements. |
| cmd/{build.go,push.go,attach.go,root.go} | Integrated the attach command into the CLI and enhanced user feedback through spinners. |
Files not reviewed (1)
- go.mod: Language not supported
Comments suppressed due to low confidence (2)
pkg/backend/attach.go:165
- The error message refers to an 'image manifest' while the build context is for a model artifact; consider changing it to 'model manifest'.
return fmt.Errorf("failed to build image manifest: %w", err)
cmd/attach.go:70
- The field 'StoargeDir' appears to be misspelled; it should likely be 'StorageDir'.
b, err := backend.New(rootConfig.StoargeDir)
Signed-off-by: chlins <chlins.zhang@gmail.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.
This pull request introduces a new
attachcommand to themodctltool and enhances the existingbuildandpushcommands with a spinner for better user feedback during the nydusification process. Additionally, it includes necessary updates to thego.modfile and adds a new backend function to support theattachcommand.New
attachcommand:attach.goto implement theattachcommand, which allows attaching user materials into the model artifact. The command includes various flags for configuration and supports nydusification.attachCmdinroot.goto make the command available in the CLI.Enhancements to existing commands:
buildcommand to provide visual feedback during the nydusification process. [1] [2]pushcommand to provide visual feedback during the nydusification process. [1] [2]Dependency updates:
go.modto include new dependencies for the spinner and color libraries. [1] [2] [3]Backend support for
attachcommand:attach.goin thepkg/backenddirectory to implement the backend logic for theattachcommand, including functions for processing layers, building configurations, and sorting layers.