-
Notifications
You must be signed in to change notification settings - Fork 2.8k
refactor: remove aws flag helper message #9080
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
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.
shouldn't we delete the whole file?
|
This PR removes the AWS region and endpoint flags used by the VM, so I think we will need to define for the VM its own group with these flags or leave the AWS group and remove the extra flags, but not use it in trivy-aws. I also found a bug: VM flags are initialised without the AWS endpoint flag: Lines 1109 to 1115 in 367564a
even though it is used when scanning the artifact: trivy/pkg/fanal/artifact/vm/vm.go Line 70 in 367564a
|
I saw that the VM command uses AWS Region so I kept it. But I'm not able to understand if it's defined here Lines 1100 to 1106 in 8c8475b
why do we need to still redefine the flag set? It seems to show up in the options list. Are you saying the value will not get set? trivy vm -h | grep region
--aws-region string AWS region to scan
|
Safe to assume if we haven't seen a bug report all these years, it's not used much 😄 |
The flag value will be set, but maybe we should leave the flag definition in the |
|
since we remove in this case there will be no confusion and it will be immediately clear where these flags are used (they will also be easy to disable for other mods) |
Yes makes sense - I'll update the PR with that. |
b04369b to
b3050b8
Compare
DmitriyLewen
left a comment
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/flag/vm_flags.go
Outdated
| package flag | ||
|
|
||
| var ( | ||
| awsRegionFlag = Flag[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.
I think we can remove aws prefix now.
pkg/flag/vm_flags.go
Outdated
| var ( | ||
| awsRegionFlag = Flag[string]{ | ||
| Name: "region", | ||
| ConfigName: "cloud.aws.region", |
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.
perhaps we want to change configName.
e.g.:
| ConfigName: "cloud.aws.region", | |
| ConfigName: "vm.region", |
pkg/flag/vm_flags.go
Outdated
| } | ||
|
|
||
| func (f *VMFlagGroup) Name() string { | ||
| return "AWS" |
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.
| return "AWS" | |
| return "VM" |
|
The AWS region flag is also used in image scanning. trivy/pkg/fanal/image/registry/ecr/ecr.go Line 33 in feaef96
|
|
Is it reasonable to remove |
|
I think we should keep AWS flags since image scanning already requires it, and, as @nikpivkin pointed out, |
Ah right - I missed this one. Updated a60d3e7 |
|
@DmitriyLewen @knqyf263 @nikpivkin could you take another look? My understanding is that we're good with the AWS prefixes in the flag names for now, based on the above discussion. |
|
as correctly caught @knqyf263 and @nikpivkin we need to leave
|
The
Which would those be?
Can we create an issue for this and do it in a separate PR? The current PR is only refactoring (and removing) existing unused flags. |
I'll create an issue and a PR for it. |
Sorry for confusing. Lines 115 to 124 in c6d4607
|
|
As we discussed above, the AWS flag may be used regardless of the target (image, VM, etc.), so it should belong to an independent flag group. I don't mind if it's an AWS flag group or a cloud flag group. Additionally, removing the prefix would cause issues when specifying regions in other cloud environments, such as GCP or Azure. What do you think? |
Isn't it already removed in this PR? https://github.com/aquasecurity/trivy/pull/9080/files#diff-f11fa87118181cac251936804d9f77a088aec34600e0774ea7303455723a9dff
Should we refactor once we have the need given other services using it? To me the scope of this PR was simply to remove unnecessary flags that aren't used today. |
since some of the changes may have to be rolled back (for example, moving flags to a VM group), I wrote the necessary changes without taking into account the changes made. |
Do you mean we will rename |
|
@DmitriyLewen @knqyf263 - I've updated the scope for this PR to simply remove the helper text. |
Description
We've removed aws live cloud scanning from trivy for about a year now. This PR removes the helper message.
Checklist