Skip to content

Commit

Permalink
Support verbose reporting of analyzer output.
Browse files Browse the repository at this point in the history
Signed-off-by: Jeff Ortel <jortel@redhat.com>
  • Loading branch information
jortel committed Dec 11, 2023
1 parent 673b1e1 commit b3dce34
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 9 deletions.
10 changes: 8 additions & 2 deletions cmd/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ type Analyzer struct {
// Run analyzer.
func (r *Analyzer) Run() (b *builder.Issues, err error) {
output := path.Join(Dir, "report.yaml")
cmd := command.Command{Path: "/usr/bin/konveyor-analyzer"}
cmd := command.New("/usr/bin/konveyor-analyzer")
cmd.Options, err = r.options(output)
if err != nil {
return
}
if Verbosity > 0 {
cmd.Reporter.Verbosity = command.LiveOutput
}
b = &builder.Issues{Path: output}
err = cmd.Run()
return
Expand Down Expand Up @@ -75,11 +78,14 @@ type DepAnalyzer struct {
// Run analyzer.
func (r *DepAnalyzer) Run() (b *builder.Deps, err error) {
output := path.Join(Dir, "deps.yaml")
cmd := command.Command{Path: "/usr/bin/konveyor-analyzer-dep"}
cmd := command.New("/usr/bin/konveyor-analyzer-dep")
cmd.Options, err = r.options(output)
if err != nil {
return
}
if Verbosity > 0 {
cmd.Reporter.Verbosity = command.LiveOutput
}
b = &builder.Deps{Path: output}
err = cmd.Run()
if err != nil {
Expand Down
14 changes: 10 additions & 4 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ package main

import (
"errors"
"os"
"path"
"time"

"github.com/gin-gonic/gin/binding"
"github.com/konveyor/tackle2-addon/ssh"
hub "github.com/konveyor/tackle2-hub/addon"
"github.com/konveyor/tackle2-hub/api"
"github.com/konveyor/tackle2-hub/nas"
"os"
"path"
"time"
)

var (
Expand All @@ -21,6 +22,7 @@ var (
RuleDir = ""
OptDir = ""
Source = "Analysis"
Verbosity = 0
)

func init() {
Expand All @@ -34,6 +36,8 @@ func init() {

// Data Addon data passed in the secret.
type Data struct {
// Verbosity level.
Verbosity int `json:"verbosity"`
// Mode options.
Mode Mode `json:"mode"`
// Scope options.
Expand All @@ -51,7 +55,9 @@ func main() {
// Get the addon data associated with the task.
d := &Data{}
err = addon.DataWith(d)
if err != nil {
if err == nil {
Verbosity = d.Verbosity
} else {
return
}
//
Expand Down
2 changes: 1 addition & 1 deletion cmd/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ func (r *Rules) convert() (err error) {
if err != nil {
return
}
cmd := command.Command{Path: "/usr/bin/windup-shim"}
cmd := command.New("/usr/bin/windup-shim")
cmd.Options.Add("convert")
cmd.Options.Add("--outputdir", output)
cmd.Options.Add(RuleDir)
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ require (
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed
)

replace github.com/konveyor/tackle2-addon => github.com/jortel/tackle2-addon v0.0.0-20231211180417-fdbbda8e376f

require (
github.com/Nerzal/gocloak/v10 v10.0.1 // indirect
github.com/PaesslerAG/gval v1.2.2 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ=
github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8=
github.com/jortel/go-utils v0.1.2 h1:R0TcGRCcwoL793CymcKC5AF9idWXT2cR6eQ2xpBUsoI=
github.com/jortel/go-utils v0.1.2/go.mod h1:sl6vav63ODI0sUfSz8e0pImNmCVFnVsuOFhZmwe9GDk=
github.com/jortel/tackle2-addon v0.0.0-20231211180417-fdbbda8e376f h1:EYNId4STGb5LsS8IOIHRQvndIl9d0dmM3AZRIvIvJIg=
github.com/jortel/tackle2-addon v0.0.0-20231211180417-fdbbda8e376f/go.mod h1:KQ1rdOjbrv8huxW7UnmojHGkdZLevOHpaQN9dcyZgfQ=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
Expand All @@ -145,8 +147,6 @@ github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBF
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/konveyor/analyzer-lsp v0.0.0-20230712145100-60dc2048444c h1:DbOZO3cNmLBJ5Z6iXyl7Fb3ejWxicHAa3OHI++0KJd4=
github.com/konveyor/analyzer-lsp v0.0.0-20230712145100-60dc2048444c/go.mod h1:+k6UreVv8ztI29/RyQN8/71AAmB0aWwQoWwZd3yR8sc=
github.com/konveyor/tackle2-addon v0.3.0-beta.3.0.20231122051613-31d1afa8ce1c h1:7lLxdzpFs/rwvLTm+saFrNz3Tqn6+/l5s2J01iRgGdA=
github.com/konveyor/tackle2-addon v0.3.0-beta.3.0.20231122051613-31d1afa8ce1c/go.mod h1:KQ1rdOjbrv8huxW7UnmojHGkdZLevOHpaQN9dcyZgfQ=
github.com/konveyor/tackle2-hub v0.3.0-beta.2 h1:1YTYX7ktHWmowNWElQtOzBldWflZe81Z89nxYMVRFzM=
github.com/konveyor/tackle2-hub v0.3.0-beta.2/go.mod h1:2ApwTxjVnIb3tP7XZKCEQdITsOgNHOeJ6qvchDsINFE=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
Expand Down

0 comments on commit b3dce34

Please sign in to comment.