这是indexloc提供的服务,不要输入任何密码
Skip to content

Error on no caches #1169

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

Merged
merged 8 commits into from
May 4, 2022
Merged

Error on no caches #1169

merged 8 commits into from
May 4, 2022

Conversation

gsoltis
Copy link
Contributor

@gsoltis gsoltis commented May 3, 2022

  • Ensure that users not on a team still record a "teamId"
  • Return a descriptive error instead of crashing when we cannot create caches

Fixes #1167

@vercel
Copy link

vercel bot commented May 3, 2022

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

Name Status Preview Updated
turbo-site ✅ Ready (Inspect) Visit Preview May 4, 2022 at 3:44PM (UTC)

@@ -65,11 +71,11 @@ func newSyncCache(config *config.Config, remoteOnly bool, recorder analytics.Rec
mplex.caches = append(mplex.caches, newHTTPCache(config, recorder))
}
if len(mplex.caches) == 0 {
return nil
return nil, ErrNoCachesEnabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Upstream addressed this a bit differently: thought-machine/please@e0b5e29

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought about doing that, but decided against it because having no available caches likely represents user error. Currently, the only way to disable filesystem caching entirely is by passing --remote-only, which definitely suggests a desire to use the http cache. Even in the case of --no-cache, we still try to read from the cache. So in the event that we cannot use any cache, it's probably an error that should be reported.

FWIW, for future direction, I don't think our architectural needs directly track with upstream, and I am not sure that reading from the cache when --no-cache is passed is the right thing to do, and I think that we could do with a bit of a refactor of our cache abstraction to simplify the code in run.go.

Copy link
Contributor

@nathanhammond nathanhammond May 4, 2022

Choose a reason for hiding this comment

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

turbo still gives benefits from the topsort so running without using cache isn't entirely nonsensical. Intentionally not using caches is likely a debugging scenario.

Aside, this is itching for a better UI:

  • Don't write cache: --no-cache
  • Don't read cache: --force or TURBO_FORCE
  • Don't read/write local cache: --remote-only or TURBO_REMOTE_ONLY
  • Don't read/write remote cache: turbo logout

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm all for a better set of flags here, including a way to run local-only without logging out (or unlinking)

@nathanhammond nathanhammond added pr: on hold Pull requests that are "on hold" and should not be merged and removed pr: on hold Pull requests that are "on hold" and should not be merged labels May 3, 2022
Copy link
Contributor

@nathanhammond nathanhammond left a comment

Choose a reason for hiding this comment

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

Because I can't configure Kodiak to play nicely without a review in #1171, I can't approve this without it being auto-merged. This is a perfect fixship candidate but I can't do it yet. 🤷‍♂️

@jaredpalmer jaredpalmer added the pr: fixship A PR which is approved with notes and does not require re-review. label May 3, 2022
@gsoltis gsoltis added pr: automerge Kodiak will merge these automatically after checks pass and removed pr: fixship A PR which is approved with notes and does not require re-review. labels May 4, 2022
@kodiakhq kodiakhq bot merged commit cb83549 into main May 4, 2022
@kodiakhq kodiakhq bot deleted the gsoltis/no_caches branch May 4, 2022 15:57
kodiakhq bot pushed a commit that referenced this pull request Jun 1, 2022
…t. (#1317)

This makes it possible for a repository whose CI configuration is `--remote-only` to work when receiving pull-requests from forked repositories that do not have access to secrets configuration in CI.

Example failures:
- #1302: [Error](https://github.com/vercel/turborepo/runs/6681959655?check_suite_focus=true#step:8:56)
- vercel/vercel#7575: [Error](https://github.com/vercel/vercel/runs/6599439965?check_suite_focus=true#step:10:12)

One example workaround:
vercel/vercel#7873

However, since this does not prevent the build from running to completion, I do not believe that it should be a hard error. While in the process of addressing this I also discovered that, since the `httpCache` can remove itself, there is an alternative path to triggering a panic if the `httpCache` is the only cache you have enabled and it removes itself.

Using a `noopCache` as a cache of last resort (similar to the [upstream solution](thought-machine/please@e0b5e29)) resolves both of these issues.

Related to: #1169
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: automerge Kodiak will merge these automatically after checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Turbo crashes when using --remote-only
3 participants