-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
feat(image): add support for passing architecture and OS #3012
feat(image): add support for passing architecture and OS #3012
Conversation
@@ -35,6 +35,195 @@ Total: 1 (UNKNOWN: 0, LOW: 0, MEDIUM: 1, HIGH: 0, CRITICAL: 0) | |||
|
|||
</details> | |||
|
|||
### Scan the image on a specific Architecture and OS |
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.
pkg/commands/app.go
Outdated
# Scan a container image on a specific architecture and os | ||
$ trivy image --platform=arm/linux python:3.4-alpine | ||
|
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.
Thanks for adding, but we can remove the example. I'd like to list here only the frequently used flags.
pkg/fanal/image/remote.go
Outdated
@@ -25,6 +26,17 @@ func tryRemote(ctx context.Context, imageName string, ref name.Reference, option | |||
remoteOpts = append(remoteOpts, remote.WithTransport(t)) | |||
} | |||
|
|||
if option.Platform != "" { | |||
platform := strings.Split(option.Platform, "/") |
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.
@knqyf263 Thank you for your feedback! Made the required and necessary changes! Please take a look :)) |
Thanks for your great contribution! |
Description
Adds support for passing an architecture and OS to the image command:
They can be used as:
Pass a
--platform
argument with a valid architecture and OS combination on the remote image:Example:
This PR also introduces the tests for the same in image_test.go
Related issues
Checklist