Skip to content

Commit

Permalink
remove dependency only pod, use new dep-output flag to get dependencies
Browse files Browse the repository at this point in the history
Signed-off-by: Shawn Hurley <shawn@hurley.page>
  • Loading branch information
shawn-hurley committed Mar 13, 2024
1 parent 51c297a commit cf01b66
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 95 deletions.
34 changes: 4 additions & 30 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -724,20 +724,18 @@ func (a *analyzeCommand) RunAnalysis(ctx context.Context, xmlOutputDir string) e
if labelSelector != "" {
args = append(args, fmt.Sprintf("--label-selector=%s", labelSelector))
}
if a.mode == string(provider.FullAnalysisMode) {
a.log.Info("running dependency retrieval during analysis")
args = append(args, fmt.Sprintf("--dep-output-file=%s", DepsOutputMountPath))
}

analysisLogFilePath := filepath.Join(a.output, "analysis.log")
depsLogFilePath := filepath.Join(a.output, "dependency.log")
// create log files
analysisLog, err := os.Create(analysisLogFilePath)
if err != nil {
return fmt.Errorf("failed creating analysis log file at %s", analysisLogFilePath)
}
defer analysisLog.Close()
dependencyLog, err := os.Create(depsLogFilePath)
if err != nil {
return fmt.Errorf("failed creating dependency analysis log file %s", depsLogFilePath)
}
defer dependencyLog.Close()

a.log.Info("running source code analysis", "log", analysisLogFilePath,
"input", a.input, "output", a.output, "args", strings.Join(args, " "), "volumes", volumes)
Expand All @@ -756,30 +754,6 @@ func (a *analyzeCommand) RunAnalysis(ctx context.Context, xmlOutputDir string) e
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
Loading

0 comments on commit cf01b66

Please sign in to comment.