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

[BUG] Some setting do not respect ENV variables #252

Closed
1 task done
aufi opened this issue Jun 3, 2024 · 2 comments
Closed
1 task done

[BUG] Some setting do not respect ENV variables #252

aufi opened this issue Jun 3, 2024 · 2 comments
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-priority Indicates an issue or PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.

Comments

@aufi
Copy link
Member

aufi commented Jun 3, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Konveyor version

main / latest

Priority

Major

Current Behavior

There is a mixture of Settings between ENV-based settings from https://github.com/konveyor/kantra/blob/main/cmd/settings.go (using github.com/codingconcepts/env lib) and package-level variables from version.go file https://github.com/konveyor/kantra/blob/main/cmd/version.go#L12-L16.

Current behaviour is that methods from https://github.com/konveyor/kantra/blob/main/cmd/settings.go#L55-L109 do not respect environment default from https://github.com/konveyor/kantra/blob/main/cmd/settings.go#L25-L33, but look to version.go https://github.com/konveyor/kantra/blob/main/cmd/version.go#L12-L16.

Expected Behavior

Settings should use https://github.com/konveyor/kantra/blob/main/cmd/settings.go#L25-L33 as a primary source of truth without setting env variables on its own. So run env.Set(c) first and then modify its content in custom load* methods. This affect IMG_RUNNER, but also container engine and providers config.

How Reproducible

Always (Default)

Steps To Reproduce

cd cmd && go test .

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)
	}
}

Environment

- OS:

Anything else?

Related PRs

@aufi aufi added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. kind/bug Categorizes issue or PR as related to a bug. labels Jun 3, 2024
@aufi aufi added this to Planning Jun 3, 2024
@github-project-automation github-project-automation bot moved this to 🆕 New in Planning Jun 3, 2024
@konveyor-ci-bot
Copy link

This issue is currently awaiting triage.
If contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.
The triage/accepted label can be added by org members.

@konveyor-ci-bot konveyor-ci-bot bot added the needs-priority Indicates an issue or PR lacks a `priority/foo` label and requires one. label Jun 3, 2024
@dymurray dymurray moved this from 🆕 New to ✅ Done in Planning Jun 20, 2024
@eemcmullan
Copy link
Collaborator

Fixed in #253

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. needs-priority Indicates an issue or PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one.
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants