diff --git a/cmd/kubectl-testkube/commands/common/helper.go b/cmd/kubectl-testkube/commands/common/helper.go index 1d60a1f45c..682eb67227 100644 --- a/cmd/kubectl-testkube/commands/common/helper.go +++ b/cmd/kubectl-testkube/commands/common/helper.go @@ -773,7 +773,7 @@ func RunDockerCommand(args []string) (output string, cliErr *CLIError) { return string(out), nil } -func DockerRunTestkubeAgent(options HelmOptions, cfg config.Data, containerName string) *CLIError { +func DockerRunTestkubeAgent(options HelmOptions, cfg config.Data, containerName, dockerImage string) *CLIError { // use config if set if cfg.CloudContext.AgentKey != "" && options.Master.AgentToken == "" { options.Master.AgentToken = cfg.CloudContext.AgentKey @@ -787,7 +787,7 @@ func DockerRunTestkubeAgent(options HelmOptions, cfg config.Data, containerName errors.New("agent key is required")) } - args := prepareTestkubeProDockerArgs(options, containerName) + args := prepareTestkubeProDockerArgs(options, containerName, dockerImage) output, err := RunDockerCommand(args) if err != nil { return err @@ -802,7 +802,7 @@ func DockerRunTestkubeAgent(options HelmOptions, cfg config.Data, containerName } // prepareTestkubeProDockerArgs prepares docker arguments for Testkube Pro running. -func prepareTestkubeProDockerArgs(options HelmOptions, containerName string) []string { +func prepareTestkubeProDockerArgs(options HelmOptions, containerName, dockerImage string) []string { args := []string{ "run", "--name", containerName, @@ -810,7 +810,7 @@ func prepareTestkubeProDockerArgs(options HelmOptions, containerName string) []s "-d", "-e", "CLOUD_URL=" + options.Master.URIs.Agent, "-e", "AGENT_KEY=" + options.Master.AgentToken, - "kubeshop/testkube-agent", + dockerImage, } return args diff --git a/cmd/kubectl-testkube/commands/pro/docker.go b/cmd/kubectl-testkube/commands/pro/docker.go index df713018d8..a3f676ac41 100644 --- a/cmd/kubectl-testkube/commands/pro/docker.go +++ b/cmd/kubectl-testkube/commands/pro/docker.go @@ -12,7 +12,7 @@ import ( func NewDockerCmd() *cobra.Command { var noLogin bool // ignore ask for login - var containerName string + var containerName, dockerImage string var options common.HelmOptions cmd := &cobra.Command{ @@ -62,7 +62,7 @@ func NewDockerCmd() *cobra.Command { } spinner := ui.NewSpinner("Running Testkube Docker Agent") - if cliErr := common.DockerRunTestkubeAgent(options, cfg, containerName); cliErr != nil { + if cliErr := common.DockerRunTestkubeAgent(options, cfg, containerName, dockerImage); cliErr != nil { spinner.Fail() sendErrTelemetry(cmd, cfg, "docker_run", cliErr) common.HandleCLIError(cliErr) @@ -101,6 +101,7 @@ func NewDockerCmd() *cobra.Command { cmd.Flags().BoolVarP(&noLogin, "no-login", "", false, "Ignore login prompt, set existing token later by `testkube set context`") cmd.Flags().StringVar(&containerName, "container-name", "testkube-agent", "container name for Testkube Docker Agent") + cmd.Flags().StringVar(&dockerImage, "docker-image", "kubeshop/testkube-agent", "docker image for Testkube Docker Agent") return cmd }