Skip to content
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

✨ Support multiple inputs with bulk option #250

Merged
merged 2 commits into from
Jun 18, 2024

Conversation

aufi
Copy link
Member

@aufi aufi commented May 31, 2024

It was requested to allow multiple inputs for kantra analyze command. Full multiple inputs support PR#234 (or a limited/hidden input-bin directory support) would bring unwanted complications for codebase and unwanted usage of kantra tool instead of using Konveyor Hub (discussed in eng team).

It looks much cleaner to me to state in README, that kantra analyze is intentionaly a single input command, but allow script multiple inputs analysis on user-side with --bulk command option, that allows run mutliple analysis into the same output directly and create a combined static report.

Related to

It was requested to allow multiple inputs for kantra analyze command.
Full multiple inputs support (or a limited/hidden input-bin directory
support) would bring unwanted complications for codebase and unwanted usage of kantra
tool instead of using Konveyor Hub (discussed in eng team).

It looks much cleaner to me to state in README, that kantra analyze
is intentionaly a single input command, but allow script multiple inputs
analysis on user-side with --bulk command option, that allows run
mutliple analysis into the same output directly and create a combined
static report.

Related to
- https://github.com/konveyor/kantra/issues/180
- konveyor#234 (alternative)

Signed-off-by: Marek Aufart <maufart@redhat.com>
}

func (a *analyzeCommand) inputShortName() string {
return filepath.Base(a.input)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking also about safer way - urlencode fullpath (https://pkg.go.dev/net/url#QueryEscape) instead of just file basename.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is is more than fine

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would almost suggest to inline this call, but it's not a big deal.

}
err = copyFileContents(depsPath, fmt.Sprintf("%s.%s", analysisLogFilePath, a.inputShortName()))
if err == nil { // dependencies file presence is optional
err = os.Remove(depsPath);
Copy link
Member Author

@aufi aufi May 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A "normal" golang mv did not work correctly in container mount volumes, using copy&delete.

-s, --source stringArray source technology to consider for analysis. Use multiple times for additional sources: --source <source1> --source <source2> ...
-t, --target stringArray target technology to consider for analysis. Use multiple times for additional targets: --target <target1> --target <target2> ...
--analyze-known-libraries analyze known open-source libraries
--bulk running multiple analyze commands in bulk will result to combined static report
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we maybe call this something like --bulk-run ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I was thinking more about short bulk since -run looks to me kind of expected when the command is executed; another option might be combine(-ouput) which might be descriptive on what is expected to be done, but longer. Keeping this question open.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that something about combining output makes sense, if we can handle running combine AFTER a normal analysis run is made.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of time, I think this is fine for now. We can always revisit naming

README.md Show resolved Hide resolved
@eemcmullan
Copy link
Collaborator

Just a couple small things. Otherwise, LGTM! Thank you!

@eemcmullan
Copy link
Collaborator

@aufi looks like it just needs a rebase

Signed-off-by: Marek Aufart <aufi.cz@gmail.com>
@aufi aufi merged commit 883d98f into konveyor:main Jun 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants