Skip to content

Commit

Permalink
🐛 run dep cli only when source is set to full
Browse files Browse the repository at this point in the history
Signed-off-by: Pranav Gaikwad <[email protected]>
  • Loading branch information
pranavgaikwad committed Mar 5, 2024
1 parent a24e193 commit ea6006b
Showing 1 changed file with 26 additions and 18 deletions.
44 changes: 26 additions & 18 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,23 +756,28 @@ func (a *analyzeCommand) RunAnalysis(ctx context.Context, xmlOutputDir string) e
return err
}

a.log.Info("running dependency analysis",
"log", depsLogFilePath, "input", a.input, "output", a.output, "args", strings.Join(args, " "))
a.log.Info("generating dependency log in file", "file", depsLogFilePath)
err = NewContainer(a.log).Run(
ctx,
WithStdout(dependencyLog),
WithStderr(dependencyLog),
WithVolumes(volumes),
WithEntrypointBin("/usr/bin/konveyor-analyzer-dep"),
WithEntrypointArgs(
fmt.Sprintf("--output-file=%s", DepsOutputMountPath),
fmt.Sprintf("--provider-settings=%s", ProviderSettingsMountPath),
),
WithCleanup(a.cleanup),
)
if err != nil {
return err
// run dependency analysis only when full mode is set
if a.mode == string(provider.FullAnalysisMode) {
a.log.Info("running dependency analysis",
"log", depsLogFilePath, "input", a.input, "output", a.output, "args", strings.Join(args, " "))
a.log.Info("generating dependency log in file", "file", depsLogFilePath)
err = NewContainer(a.log).Run(
ctx,
WithStdout(dependencyLog),
WithStderr(dependencyLog),
WithVolumes(volumes),
WithEntrypointBin("/usr/bin/konveyor-analyzer-dep"),
WithEntrypointArgs(
fmt.Sprintf("--output-file=%s", DepsOutputMountPath),
fmt.Sprintf("--provider-settings=%s", ProviderSettingsMountPath),
),
WithCleanup(a.cleanup),
)
if err != nil {
return err
}
} else {
a.log.Info("skipping dependency analysis", "mode", a.mode)
}

return nil
Expand Down Expand Up @@ -843,10 +848,13 @@ func (a *analyzeCommand) GenerateStaticReport(ctx context.Context) error {
args := []string{}
staticReportArgs := []string{"/usr/local/bin/js-bundle-generator",
fmt.Sprintf("--analysis-output-list=%s", AnalysisOutputMountPath),
fmt.Sprintf("--deps-output-list=%s", DepsOutputMountPath),
fmt.Sprintf("--output-path=%s", path.Join("/usr/local/static-report/output.js")),
fmt.Sprintf("--application-name-list=%s", filepath.Base(a.input)),
}
if a.mode == string(provider.FullAnalysisMode) {
staticReportArgs = append(staticReportArgs,
fmt.Sprintf("--deps-output-list=%s", DepsOutputMountPath))
}
cpArgs := []string{"&& cp -r",
"/usr/local/static-report", OutputPath}

Expand Down

0 comments on commit ea6006b

Please sign in to comment.