-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nydusify: support "view" subcommand to view Nydus image #603
Conversation
@YushuoEdge , a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/13445 |
@YushuoEdge , The CI test is completed, please check result:
Congratulations, your test job passed! |
03eab23
to
8915210
Compare
@YushuoEdge , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/13446 |
@YushuoEdge , The CI test is completed, please check result:
Congratulations, your test job passed! |
contrib/nydusify/cmd/nydusify.go
Outdated
|
||
&cli.StringFlag{Name: "mount-path", Value: "./image-fs", Usage: "The Path for the file system to mount on", EnvVars: []string{"MOUNT_PATH"}}, | ||
&cli.StringFlag{Name: "platform", Value: "linux/" + runtime.GOARCH, Usage: "Let nydusify choose image of specified platform from manifest index. Possible value is `amd64` or `arm64`"}, | ||
&cli.StringFlag{Name: "work-dir", Value: "./tmp", Usage: "Work directory path for image check, will be cleaned before checking", EnvVars: []string{"WORK_DIR"}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will be cleaned before viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes,maybe we should give a hint?
contrib/nydusify/cmd/nydusify.go
Outdated
&cli.StringFlag{Name: "platform", Value: "linux/" + runtime.GOARCH, Usage: "Let nydusify choose image of specified platform from manifest index. Possible value is `amd64` or `arm64`"}, | ||
&cli.StringFlag{Name: "work-dir", Value: "./tmp", Usage: "Work directory path for image check, will be cleaned before checking", EnvVars: []string{"WORK_DIR"}}, | ||
&cli.StringFlag{Name: "nydusd", Value: "nydusd", Usage: "The nydusd binary path, if unset, search in PATH environment", EnvVars: []string{"NYDUSD"}}, | ||
&cli.StringFlag{Name: "backend-type", Value: "", Usage: "Specify Nydus blob storage backend type, will check file data in Nydus image if specified", EnvVars: []string{"BACKEND_TYPE"}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will allow viewing file data in Nydus image if specified
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we specify a specific backend type here?
@@ -203,11 +205,14 @@ func (nydusd *Nydusd) Mount() error { | |||
return nil | |||
} | |||
|
|||
func (nydusd *Nydusd) Umount() error { | |||
func (nydusd *Nydusd) Umount(mountFlag bool) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use silent bool
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
return errors.Wrap(err, "clean up work directory error") | ||
} | ||
|
||
if err := os.MkdirAll(filepath.Join(fsViewer.WorkDir, "fs"), 0755); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using 0750
is safer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
func (fsViewer *FsViewer) MountImage() error { | ||
logrus.Infof("Mounting Nydus image to %s", fsViewer.NydusdConfig.MountPath) | ||
|
||
if err := os.MkdirAll(fsViewer.NydusdConfig.BlobCacheDir, 0755); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
return errors.Wrap(err, "create blob cache directory for Nydusd error") | ||
} | ||
|
||
if err := os.MkdirAll(fsViewer.NydusdConfig.MountPath, 0755); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
|
||
go func() { | ||
sig := <-sigs | ||
fmt.Println("Received Signal: ", sig) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logrus.Infof("Received Signal: %s", sig)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
done <- true | ||
}() | ||
|
||
fmt.Println("Please send signal SIGINT/SIGTERM to umount the file system") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto, use logrus.Info
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
contrib/nydusify/cmd/nydusify.go
Outdated
@@ -397,6 +398,58 @@ func main() { | |||
return checker.Check(context.Background()) | |||
}, | |||
}, | |||
{ | |||
Name: "view", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can add an alias Aliases: []string{"mount"},
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
8915210
to
7935512
Compare
@YushuoEdge , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/15298 |
@YushuoEdge , The CI test is completed, please check result:
Congratulations, your test job passed! |
Nydusify provides a fsViewer to view the file system in the Nydus image. The fsViewer will pull image's bootstrap according to its url, and it will mount the file system to pointed path. Users can view the file system then. For example, they can ran `$ trivy fs mount-path` to scan the whole image. Signed-off-by: YushuoEdge <[email protected]>
7935512
to
ea5c2e3
Compare
@YushuoEdge , the code has been updated, so a new test job has been submitted. Please wait in patience. The test job url: https://tone.openanolis.cn/ws/nrh4nnio/test_result/15299 |
@YushuoEdge , The CI test is completed, please check result:
Congratulations, your test job passed! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Nydusify provides a fsViewer to view the file system in the Nydus image.
The fsViewer will pull image's bootstrap according to its url, and it
will mount the file system to pointed path.
Users can view the file system then. For example, they can ran
$ trivy fs mount-path
to scan the whole image.
Signed-off-by: YushuoEdge [email protected]