-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add support to tar flag for docker scan #30
Conversation
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.
-
Change the description and name of the Argument, now that it is not only a tag (at cli/docs/scan/dockerscan/help.go)
-
Add integration tests that runs scan on .tar file
commands/scan/dockerscan.go
Outdated
if dsc.progress != nil { | ||
dsc.progress.SetHeadlineMsg("Creating image archive 📦") | ||
} | ||
log.Info("Creating image archive...") | ||
dockerSaveCmd := exec.Command("docker", "save", dsc.imageTag, "-o", imageTarPath) | ||
var stderr bytes.Buffer | ||
dockerSaveCmd.Stderr = &stderr | ||
err = dockerSaveCmd.Run() | ||
if err != nil { | ||
return fmt.Errorf("failed running command: '%s' with error: %s - %s", strings.Join(dockerSaveCmd.Args, " "), err.Error(), stderr.String()) |
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.
if dsc.progress != nil { | |
dsc.progress.SetHeadlineMsg("Creating image archive 📦") | |
} | |
log.Info("Creating image archive...") | |
dockerSaveCmd := exec.Command("docker", "save", dsc.imageTag, "-o", imageTarPath) | |
var stderr bytes.Buffer | |
dockerSaveCmd.Stderr = &stderr | |
err = dockerSaveCmd.Run() | |
if err != nil { | |
return fmt.Errorf("failed running command: '%s' with error: %s - %s", strings.Join(dockerSaveCmd.Args, " "), err.Error(), stderr.String()) | |
if dsc.progress != nil { | |
dsc.progress.SetHeadlineMsg("Creating image archive 📦") | |
} | |
log.Info("Creating image archive...") | |
dockerSaveCmd := exec.Command("docker", "save", dsc.imageTag, "-o", imageTarPath) | |
var stderr bytes.Buffer | |
dockerSaveCmd.Stderr = &stderr | |
err = dockerSaveCmd.Run() | |
if err != nil { | |
return fmt.Errorf("failed running command: '%s' with error: %s - %s", strings.Join(dockerSaveCmd.Args, " "), err.Error(), stderr.String()) |
You can move it to a separated method to help with readability
func (auditCmd *AuditCommand) SetIsTar(isTar bool) *AuditCommand { | ||
auditCmd.IsTar = isTar | ||
return auditCmd | ||
} |
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.
Why you need it in audit command? this is just for docker scan....
Co-authored-by: Assaf Attias <[email protected]>
Co-authored-by: Assaf Attias <[email protected]>
You can use the |
dev
branch.go vet ./...
.go fmt ./...
.Part of jfrog/jfrog-cli#2451