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

Don't override set RUNNER_IMG #253

Merged
merged 1 commit into from
Jun 6, 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
8 changes: 4 additions & 4 deletions cmd/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,12 @@ 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
runnerImg, found := os.LookupEnv("RUNNER_IMG");
if !found {
runnerImg = "quay.io/konveyor/kantra"
// Respect existing RUNNER_IMG setting
if os.Getenv("RUNNER_IMG") != "" {
return nil
}
// if version tag is given in image
img := strings.TrimSuffix(runnerImg, fmt.Sprintf(":%v", Version))
img := strings.TrimSuffix(RunnerImage, fmt.Sprintf(":%v", Version))
updatedImg := fmt.Sprintf("%v:%v", img, Version)
err := os.Setenv("RUNNER_IMG", updatedImg)
if err != nil {
Expand Down
8 changes: 4 additions & 4 deletions cmd/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import (

// Test RUNNER_IMG settings
func TestRunnerImgDefault(t *testing.T) {
os.Unsetenv("RUNNER_IMG") // Ensure empty variable
os.Unsetenv("RUNNER_IMG") // Ensure empty variable
s := &Config{}
s.Load();
s.Load()
if s.RunnerImage != "quay.io/konveyor/kantra:latest" {
t.Errorf("Unexpected RUNNER_IMG default: %s", s.RunnerImage)
}
Expand All @@ -18,8 +18,8 @@ func TestRunnerImgDefault(t *testing.T) {
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" {
s.Load()
if s.RunnerImage != "quay.io/some-contributor/my-kantra" {
t.Errorf("Unexpected RUNNER_IMG: %s", s.RunnerImage)
}
}
Loading