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

🐛 Fix labels validation print #251

Merged
merged 7 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 3 additions & 3 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -495,12 +495,12 @@ func listOptionsFromLabels(sl []string, label string, out io.Writer) {
sort.Strings(newSl)

if label == outputv1.SourceTechnologyLabel {
fmt.Println(out, "available source technologies:")
fmt.Fprintln(out, "available source technologies:")
} else {
fmt.Println(out, "available target technologies:")
fmt.Fprintln(out, "available target technologies:")
}
for _, tech := range newSl {
fmt.Println(out, tech)
fmt.Fprintln(out, tech)
}
}

Expand Down
7 changes: 6 additions & 1 deletion cmd/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,13 @@ func (c *Config) trySetDefaultPodmanBin(file string) (found bool, err error) {
}

func (c *Config) loadRunnerImg() error {
// TODO(maufart): ensure Config struct works/parses it values from ENV and defaults correctly
Copy link
Member Author

Choose a reason for hiding this comment

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

A quick friday-afternoon solution, will continue/follow-up on Monday. Seems the Config mechanism is not setup correctly.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is problem affects more config options, submitted an issue #252 expecting it is a follow-up, but changing things unrelated to this PR.

runnerImg, found := os.LookupEnv("RUNNER_IMG");
if !found {
runnerImg = "quay.io/konveyor/kantra"
}
// if version tag is given in image
img := strings.TrimSuffix(RunnerImage, fmt.Sprintf(":%v", Version))
img := strings.TrimSuffix(runnerImg, fmt.Sprintf(":%v", Version))
updatedImg := fmt.Sprintf("%v:%v", img, Version)
err := os.Setenv("RUNNER_IMG", updatedImg)
if err != nil {
Expand Down
25 changes: 25 additions & 0 deletions cmd/settings_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package cmd

import (
"os"
"testing"
)

// Test RUNNER_IMG settings
func TestRunnerImgDefault(t *testing.T) {
os.Unsetenv("RUNNER_IMG") // Ensure empty variable
s := &Config{}
s.Load();
if s.RunnerImage != "quay.io/konveyor/kantra:latest" {
t.Errorf("Unexpected RUNNER_IMG default: %s", s.RunnerImage)
}
}

func TestRunnerImgCustom(t *testing.T) {
os.Setenv("RUNNER_IMG", "quay.io/some-contributor/my-kantra")
s := &Config{}
s.Load();
if s.RunnerImage != "quay.io/some-contributor/my-kantra:latest" {
t.Errorf("Unexpected RUNNER_IMG: %s", s.RunnerImage)
}
}
Loading