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

✨ Add support for verbosity. #68

Merged
merged 5 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ require (
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed
)

replace github.com/konveyor/tackle2-addon => github.com/jortel/tackle2-addon v0.0.0-20231216153744-74550a371c6c

replace github.com/konveyor/tackle2-hub => github.com/jortel/tackle2-hub v0.0.0-20231216153645-0500f20f2fbe

require (
github.com/Nerzal/gocloak/v10 v10.0.1 // indirect
github.com/PaesslerAG/gval v1.2.2 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ 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-20231216153744-74550a371c6c h1:3xr1WQ/kn5RoRuRzlNRwOcIc1WHeHPFtRR59Q5Pm8iY=
github.com/jortel/tackle2-addon v0.0.0-20231216153744-74550a371c6c/go.mod h1:XEEjeA6q/gnaqUKmxQGazGIzOo1jpoAIbhxyAy7f0wo=
github.com/jortel/tackle2-hub v0.0.0-20231216153645-0500f20f2fbe h1:TPYKQczsWAATEPJJQ1dIL201N9bpCCpbYcQvPESGqxw=
github.com/jortel/tackle2-hub v0.0.0-20231216153645-0500f20f2fbe/go.mod h1:2ApwTxjVnIb3tP7XZKCEQdITsOgNHOeJ6qvchDsINFE=
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,10 +149,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=
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
Expand Down
Loading