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: warn when no local turbo found #8356

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion crates/turborepo-lib/src/shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

use crate::{cli, get_version, spawn_child, tracing::TurboSubscriber};

const TURBO_GLOBAL_WARNING_DISABLED: &str = "TURBO_GLOBAL_WARNING_DISABLED";

#[derive(Debug, Error, Diagnostic)]
#[error("cannot have multiple `--cwd` flags in command")]
#[diagnostic(code(turbo::shim::multiple_cwd))]
Expand Down Expand Up @@ -595,14 +597,25 @@
spawn_local_turbo(&repo_state, turbo_state, shim_args)
}
} else {
try_check_for_updates(&shim_args, get_version());
let version = get_version();
try_check_for_updates(&shim_args, version);
// cli::run checks for this env var, rather than an arg, so that we can support
// calling old versions without passing unknown flags.
env::set_var(
cli::INVOCATION_DIR_ENV_VAR,
shim_args.invocation_dir.as_path(),
);
debug!("Running command as global turbo");
let should_warn_on_global =
env::var(TURBO_GLOBAL_WARNING_DISABLED).map_or(true, |disable| {
match disable.as_str() {

Check failure on line 611 in crates/turborepo-lib/src/shim.rs

View workflow job for this annotation

GitHub Actions / Turborepo rust clippy

match expression looks like `matches!` macro
"1" | "true" => false,
_ => true,
}
});
if should_warn_on_global {
eprintln!("No locally installed `turbo` found. Using version: {version}.");
}
Ok(cli::run(Some(repo_state), subscriber, ui)?)
}
}
Expand Down
1 change: 1 addition & 0 deletions turborepo-tests/helpers/setup_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ else
fi

export TURBO_TELEMETRY_MESSAGE_DISABLED=1
export TURBO_GLOBAL_WARNING_DISABLED=1
export TURBO=${MONOREPO_ROOT_DIR}/target/debug/turbo${EXT}

# Undo the set -eo pipefail at the top of this script
Expand Down
Loading