Skip to content

Commit 24ec533

Browse files
committed
Return error if both jobID and runID are specified
1 parent 3645975 commit 24ec533

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

pkg/cmd/run/rerun/rerun.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,7 @@ func NewCmdRerun(f *cmdutil.Factory, runF func(*RerunOptions) error) *cobra.Comm
5050
}
5151

5252
if opts.RunID != "" && opts.JobID != "" {
53-
opts.RunID = ""
54-
if opts.IO.CanPrompt() {
55-
cs := opts.IO.ColorScheme()
56-
fmt.Fprintf(opts.IO.ErrOut, "%s both run and job IDs specified; ignoring run ID\n", cs.WarningIcon())
57-
}
53+
return cmdutil.FlagErrorf("specify only one of <run-id> or <job-id>")
5854
}
5955

6056
if runF != nil {

pkg/cmd/run/rerun/rerun_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,10 @@ func TestNewCmdRerun(t *testing.T) {
7676
},
7777
},
7878
{
79-
name: "with args job and runID ignores runID",
80-
tty: true,
81-
cli: "1234 --job 5678",
82-
wants: RerunOptions{
83-
JobID: "5678",
84-
},
79+
name: "with args jobID and runID fails",
80+
tty: true,
81+
cli: "1234 --job 5678",
82+
wantsErr: true,
8583
},
8684
{
8785
name: "with arg job with no ID fails",

0 commit comments

Comments
 (0)