Skip to content

Commit 97d691e

Browse files
fix(cli): no longer attempt to parse task name as continue value (#10097)
### Description #10023 added values for the `--continue` flag, but this unintentionally broke commands such as `turbo --continue build` as `build` would be interpreted as a `continue` value ### Testing Instructions Added failing test for the previous breakage and updated snapshots.
1 parent 84a1535 commit 97d691e

File tree

6 files changed

+25
-10
lines changed

6 files changed

+25
-10
lines changed

crates/turborepo-lib/src/cli/mod.rs

+16-1
Original file line numberDiff line numberDiff line change
@@ -851,7 +851,7 @@ pub struct ExecutionArgs {
851851
/// continue running tasks whose dependencies have succeeded. Use "always"
852852
/// to continue running all tasks, even those whose dependencies have
853853
/// failed.
854-
#[clap(long = "continue", value_name = "CONTINUE", num_args = 0..=1, default_value = "never", default_missing_value = "always")]
854+
#[clap(long = "continue", value_name = "CONTINUE", num_args = 0..=1, default_value = "never", default_missing_value = "always", require_equals = true)]
855855
pub continue_execution: ContinueMode,
856856
/// Run turbo in single-package mode
857857
#[clap(long)]
@@ -1944,6 +1944,21 @@ mod test {
19441944
} ;
19451945
"continue option with no value"
19461946
)]
1947+
#[test_case::test_case(
1948+
&["turbo", "run", "--continue", "build"],
1949+
Args {
1950+
command: Some(Command::Run {
1951+
execution_args: Box::new(ExecutionArgs {
1952+
tasks: vec!["build".to_string()],
1953+
continue_execution: ContinueMode::Always,
1954+
..get_default_execution_args()
1955+
}),
1956+
run_args: Box::new(get_default_run_args())
1957+
}),
1958+
..Args::default()
1959+
} ;
1960+
"continue option with no value before task"
1961+
)]
19471962
#[test_case::test_case(
19481963
&["turbo", "run", "build", "--continue=dependencies-successful"],
19491964
Args {

crates/turborepo-lib/src/cli/snapshots/turborepo_lib__cli__test__turbo-watch-build---no-daemon.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ error: unexpected argument '--no-daemon' found
77
tip: a similar argument exists: '--no-update-notifier'
88
tip: to pass '--no-daemon' as a value, use '-- --no-daemon'
99

10-
Usage: turbo watch --no-update-notifier <--cache-dir <CACHE_DIR>|--concurrency <CONCURRENCY>|--continue [<CONTINUE>]|--single-package|--framework-inference [<BOOL>]|--global-deps <GLOBAL_DEPS>|--env-mode [<ENV_MODE>]|--filter <FILTER>|--affected|--output-logs <OUTPUT_LOGS>|--log-order <LOG_ORDER>|--only|--pkg-inference-root <PKG_INFERENCE_ROOT>|--log-prefix <LOG_PREFIX>|TASKS|PASS_THROUGH_ARGS>
10+
Usage: turbo watch --no-update-notifier <--cache-dir <CACHE_DIR>|--concurrency <CONCURRENCY>|--continue[=<CONTINUE>]|--single-package|--framework-inference [<BOOL>]|--global-deps <GLOBAL_DEPS>|--env-mode [<ENV_MODE>]|--filter <FILTER>|--affected|--output-logs <OUTPUT_LOGS>|--log-order <LOG_ORDER>|--only|--pkg-inference-root <PKG_INFERENCE_ROOT>|--log-prefix <LOG_PREFIX>|TASKS|PASS_THROUGH_ARGS>
1111

1212
For more information, try '--help'.

docs/repo-docs/guides/migrating-from-nx.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ Configuration found in `nx.json` can be mapped to `turbo.json` using the tables
490490
| `nx run-many` | [`turbo run`](/repo/docs/reference/run) |
491491
| `nx reset` | [`--force`](/repo/docs/reference/run#--force) |
492492
| `--parallel` | [`--concurrency`](/repo/docs/reference/run#--concurrency-number--percentage) |
493-
| `--nxBail` | [`--continue`](/repo/docs/reference/run#--continue-option) |
493+
| `--nxBail` | [`--continue`](/repo/docs/reference/run#--continueoption) |
494494
| `--projects` | [`--filter`](/repo/docs/reference/run#--filter-string) |
495495
| `--graph` | [`--graph`](/repo/docs/reference/run#--graph-file-type) |
496496
| `--output-style` | [`--log-order`](/repo/docs/reference/run#--log-order-option) |

docs/repo-docs/reference/run.mdx

+4-4
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ turbo run build --concurrency=50%
121121
turbo run test --concurrency=5
122122
```
123123
124-
### `--continue <option>`
124+
### `--continue[=<option>]`
125125
126126
Default: `never`
127127
128128
Specify how `turbo` should handle current and pending tasks in the presence of an error (e.g. non-zero exit code from a task).
129129
130-
- When `--continue` is `never` and an error occurs, `turbo` will cancel all tasks.
131-
- When `--continue` is `dependencies-successful` and an error occurs, `turbo` will cancel dependent tasks. Tasks whose dependencies have succeeded will continue to run.
132-
- When `--continue` is `always` and an error occurs, `turbo` will continue running all tasks, even those whose dependencies have failed.
130+
- When `--continue=never` and an error occurs, `turbo` will cancel all tasks.
131+
- When `--continue=dependencies-successful` and an error occurs, `turbo` will cancel dependent tasks. Tasks whose dependencies have succeeded will continue to run.
132+
- When `--continue=always` and an error occurs, `turbo` will continue running all tasks, even those whose dependencies have failed.
133133
- When `--continue` is specified without a value, it will default to `always`.
134134
135135
In all cases, `turbo` will exit with the highest exit code value encountered during execution.

turborepo-tests/integration/tests/no-args.t

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Make sure exit code is 2 when no args are passed
9898
Override the filesystem cache directory
9999
--concurrency <CONCURRENCY>
100100
Limit the concurrency of task execution. Use 1 for serial (i.e. one-at-a-time) execution
101-
--continue [<CONTINUE>]
101+
--continue[=<CONTINUE>]
102102
Specify how task execution should proceed when an error occurs. Use "never" to cancel all tasks. Use "dependencies-successful" to continue running tasks whose dependencies have succeeded. Use "always" to continue running all tasks, even those whose dependencies have failed [default: never] [possible values: never, dependencies-successful, always]
103103
--single-package
104104
Run turbo in single-package mode

turborepo-tests/integration/tests/turbo-help.t

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ Test help flag
9898
Override the filesystem cache directory
9999
--concurrency <CONCURRENCY>
100100
Limit the concurrency of task execution. Use 1 for serial (i.e. one-at-a-time) execution
101-
--continue [<CONTINUE>]
101+
--continue[=<CONTINUE>]
102102
Specify how task execution should proceed when an error occurs. Use "never" to cancel all tasks. Use "dependencies-successful" to continue running tasks whose dependencies have succeeded. Use "always" to continue running all tasks, even those whose dependencies have failed [default: never] [possible values: never, dependencies-successful, always]
103103
--single-package
104104
Run turbo in single-package mode
@@ -273,7 +273,7 @@ Test help flag
273273
--concurrency <CONCURRENCY>
274274
Limit the concurrency of task execution. Use 1 for serial (i.e. one-at-a-time) execution
275275

276-
--continue [<CONTINUE>]
276+
--continue[=<CONTINUE>]
277277
Specify how task execution should proceed when an error occurs. Use "never" to cancel all tasks. Use "dependencies-successful" to continue running tasks whose dependencies have succeeded. Use "always" to continue running all tasks, even those whose dependencies have failed
278278

279279
[default: never]

0 commit comments

Comments
 (0)