diff --git a/pkg/cmd/run/rerun/rerun.go b/pkg/cmd/run/rerun/rerun.go index 1efe5fb8b..32e6250a9 100644 --- a/pkg/cmd/run/rerun/rerun.go +++ b/pkg/cmd/run/rerun/rerun.go @@ -69,7 +69,11 @@ func NewCmdRerun(f *cmdutil.Factory, runF func(*RerunOptions) error) *cobra.Comm } if opts.RunID != "" && opts.JobID != "" { - return cmdutil.FlagErrorf("specify only one of `` or `--job`") + opts.RunID = "" + if opts.IO.CanPrompt() { + cs := opts.IO.ColorScheme() + fmt.Fprintf(opts.IO.ErrOut, "%s both run and job IDs specified; ignoring run ID\n", cs.WarningIcon()) + } } if runF != nil { diff --git a/pkg/cmd/run/rerun/rerun_test.go b/pkg/cmd/run/rerun/rerun_test.go index 991ab5f3a..aac5c0797 100644 --- a/pkg/cmd/run/rerun/rerun_test.go +++ b/pkg/cmd/run/rerun/rerun_test.go @@ -78,10 +78,13 @@ func TestNewCmdRerun(t *testing.T) { }, }, { - name: "with args jobID and runID fails", - tty: true, - cli: "1234 --job 5678", - wantsErr: true, + name: "with args jobID and runID uses jobID", + tty: true, + cli: "1234 --job 5678", + wants: RerunOptions{ + JobID: "5678", + RunID: "", + }, }, { name: "with arg job with no ID fails",