-
Notifications
You must be signed in to change notification settings - Fork 555
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: add --remote-repo-url to "iac test" #3453
Conversation
cf43973
to
371d827
Compare
we also discussed on slack to check that we do some sanitisation on registry side for the remote url string. So probably merging this after any registry changes. |
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.
Blocking as Hammer refrains from adding new dependencies to the CLI unless totally needed. We think it's not a must here, and would prefer no new dependency is introduced
371d827
to
c804c5a
Compare
c804c5a
to
2a12048
Compare
What does this PR do?
This PR adds support for the
--remote-repo-url
flag to theiac test
command. The flag can be used by a user to override the URL of the Git repository, that is otherwise auto-detected by the command.Where should the reviewer start?
Most of the logic is in
src/cli/commands/test/iac/scan.ts
. The change in this PR creates anIacOutputMeta
object at the beginning of the scan and passes it down to the components that need the information in it. Previously, theIacOutputMeta
was constructed by the individual components, and surfaced up the stack. Because theIacOutputMeta
is not dependent on the paths being scanned, it can be constructed once from a combination of flag values and auto-detected information (like the name of the current working directory and the URL of the Git repository, if any).How should this be manually tested?
Use different combinations of current working directory and flags:
snyk iac test --report
creates a project group whose name is the name of the current working directory.snyk iac test --report
creates a project group whose name is derived from the URL of the Git repository, in the same way as the examples below.snyk iac test --report --remote-repo-url=foo/bar
creates a project group whose name isfoo/bar
.snyk iac test --report --remote-repo-url=https://example.com/foo/bar.git
creates a project group whose name isfoo/bar
.snyk iac test --report --remote-repo-url=git@example.com:foo/bar.git
creates a project group whose name isfoo/bar
.The summary section will always return the correct project name. For example,
What are the relevant tickets?
CFG-1842