Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(turborepo): --continue=dependencies-successful #10023

Merged
merged 10 commits into from
Feb 25, 2025

Conversation

jenseng
Copy link
Contributor

@jenseng jenseng commented Feb 21, 2025

Description

Context: #7461

Convert --continue into a tri-state option, introducing a new mode that allows independent tasks to continue running when an error occurs (dependent tasks will be canceled).

The possible values for --continue are now:

  • never (default) -- on error: cancel all tasks
  • dependencies-successful -- on error: continue running tasks whose dependencies have succeeded
  • always -- on error: continue running all tasks, even those whose dependencies have failed

Setting --continue without a value is equivalent to setting it to always

Testing Instructions

See modified/added tests in the PR, but basically:

  • turbo run <cmd> --continue=never (or omitting it) will abort when an error occurs
  • turbo run <cmd> --continue=dependencies-successful will cancel dependent tasks when an error occurs, but keep running others
  • turbo run <cmd> --continue=always (or --continue) will keep running all other tasks when an error occurs

Convert `--continue` into a tri-state option, introducing a new mode that
allows independent tasks to continue running when an error occurs (dependent
tasks will be canceled).

The possible values for `--continue` are now:
- `none` (default) -- on error: cancel all tasks
- `independent-tasks-only` -- on error: cancel dependents, but continue others
- `all` -- on error: always continue, including dependents

For backwards compatibility, `false` (i.e. `none`) and `true` (i.e. `all`) are
still accepted, but will emit a deprecation warning. Setting `--continue`
without a value is equivalent to setting it to `all`
@jenseng jenseng requested review from anthonyshew and a team as code owners February 21, 2025 15:50
@turbo-orchestrator turbo-orchestrator bot added area: docs Improvements or additions to documentation needs: triage New issues get this label. Remove it after triage labels Feb 21, 2025
Copy link

vercel bot commented Feb 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 2:21pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 2:21pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 2:21pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 2:21pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 2:21pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 2:21pm
examples-svelte-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 2:21pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 2:21pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 25, 2025 2:21pm

Copy link

vercel bot commented Feb 21, 2025

@jenseng is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Contributor Author

@jenseng jenseng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple high level thoughts on the UX:

  • Do we want to deprecate the ability to specify --continue without a value?
  • --continue=independent-tasks-only is a bit verbose IMO. What if we did something like --continue=independent?
  • Or we could deprecate --continue entirely and have a new option that inverts the phrasing, e.g. something like --on-error with values like halt, cancel-dependents and continue

Also I'm a rust noob, so please let me know where I can improve! 😅

Copy link
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much for this contribution this is a great feature!

Only some very minor suggestions.

@jenseng
Copy link
Contributor Author

jenseng commented Feb 24, 2025

The windows tests have been failing consistently in this PR and I haven't seen that failure on other PRs/pushes. I did a debug run here where I undid this change to setup_integration_tests.sh, and that seems to have fixed it 🙃 ... not sure how that would break things, maybe hitting a weird bug/edge case in Git for Windows' bash.exe? 🤷 ... doing a couple more test runs to confirm, and if that theory holds i'll revert that line

@jenseng
Copy link
Contributor Author

jenseng commented Feb 24, 2025

The windows tests have been failing consistently in this PR and I haven't seen that failure on other PRs/pushes. I did a debug run here where I undid this change to setup_integration_tests.sh, and that seems to have fixed it 🙃 ... not sure how that would break things, maybe hitting a weird bug/edge case in Git for Windows' bash.exe? 🤷 ... doing a couple more test runs to confirm, and if that theory holds i'll revert that line

Yeah looking quite likely to be the culprit, since the new PATH value is inappropriate for bash.exe and likely causing trouble. i.e. it's setting something like: C:\Users\RUNNER~1\AppData\Local\Temp\prysk-tests-nurs9w2d/corepack:/d/a/turborepo/turborepo/turborepo-tests/integration/node_modules/.bin:... (note the mismatched path separators in the first entry and the unintended : separator)

I'll revert that line from this PR and revisit it in another PR (I think it's a good change to make, just needs to work on windows)

Co-authored-by: Anthony Shew <anthonyshew@gmail.com>
jenseng added a commit to jenseng/turborepo that referenced this pull request Feb 25, 2025
extracted from vercel#10023

fix an issue running integration tests locally (depends on how you have
corepack installed)

setup_package_manager.sh exports PATH, so we need to source it for that to
actually take effect. with PATH now set, we also need to make sure it's valid
under bash.exe (windows GHA runners)
@chris-olszewski chris-olszewski merged commit 565f90a into vercel:main Feb 25, 2025
39 checks passed
chris-olszewski pushed a commit that referenced this pull request Feb 25, 2025
### Description

Fix minor oversight in #10023 when we reworded the options

### Testing Instructions

N/A
@jenseng jenseng deleted the continue-independent branch February 25, 2025 22:32
chris-olszewski pushed a commit that referenced this pull request Feb 27, 2025
### Description

Spun out from
#10023 (comment)

setup_package_manager.sh exports `PATH`, so we need to source it for the
isolated corepack shims to actually get used in tests. Otherwise certain
npm integration tests can fail, depending on the global npm version and
if corepack's npm shims haven't been explicitly enabled globally. This
can lead to false positives and wasted time debugging integration tests
locally.

This hasn't been an issue under GitHub Actions, since actions/setup-node
is installing the same version of npm (10.5.0) that the tests expect,
but could otherwise become problematic down the road.

Fixing this uncovers two new problems around testing under Windows,
which this PR also addresses:

- the corepack path needs to be POSIX-ified, since
`C:\Users\RUNNER~1\...` contains backslashes and the name separator (:)
- corepack uses `PATHEXT` (via
[cmd-extension](https://www.npmjs.com/package/cmd-extension)) to
determine the casing of its shims' file extension (e.g. npm.cmd vs
npm.CMD), whereas node's bundled npm.cmd is always lowercase ... while
we could update all the tests to accept both styles, the easiest thing
to do is just to downcase `PATHEXT`.

### Testing Instructions

Integration tests 🥳
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: docs Improvements or additions to documentation needs: triage New issues get this label. Remove it after triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants