Skip to content

Commit

Permalink
Don't override set RUNNER_IMG (#253)
Browse files Browse the repository at this point in the history
don't override set runner img

Signed-off-by: Emily McMullan <[email protected]>
  • Loading branch information
eemcmullan authored Jun 6, 2024
1 parent 6d5fd4c commit ea0ef8a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
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)
}
}

0 comments on commit ea0ef8a

Please sign in to comment.