Skip to content

Commit 5bbc8c3

Browse files
chore(config): move TURBO_RUN_SUMMARY to config
1 parent 3b98c16 commit 5bbc8c3

File tree

6 files changed

+23
-5
lines changed

6 files changed

+23
-5
lines changed

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

+6-1
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ pub struct RunArgs {
901901
#[clap(long, default_missing_value = "true")]
902902
pub remote_cache_read_only: Option<Option<bool>>,
903903
/// Generate a summary of the turbo run
904-
#[clap(long, env = "TURBO_RUN_SUMMARY", default_missing_value = "true")]
904+
#[clap(long, default_missing_value = "true")]
905905
pub summarize: Option<Option<bool>>,
906906

907907
// Pass a string to enable posting Run Summaries to Vercel
@@ -959,6 +959,11 @@ impl RunArgs {
959959
Some(remote_cache_read_only.unwrap_or(true))
960960
}
961961

962+
pub fn summarize(&self) -> Option<bool> {
963+
let summarize = self.summarize?;
964+
Some(summarize.unwrap_or(true))
965+
}
966+
962967
pub fn track(&self, telemetry: &CommandEventBuilder) {
963968
// default to true
964969
track_usage!(telemetry, self.no_cache, |val| val);

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

+1
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ impl CommandBase {
107107
.run_args()
108108
.and_then(|args| args.remote_cache_read_only()),
109109
)
110+
.with_run_summary(self.args.run_args().and_then(|args| args.summarize()))
110111
.build()
111112
}
112113

crates/turborepo-lib/src/config/env.rs

+7
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const TURBO_MAPPING: &[(&str, &str)] = [
3737
("turbo_log_order", "log_order"),
3838
("turbo_remote_only", "remote_only"),
3939
("turbo_remote_cache_read_only", "remote_cache_read_only"),
40+
("turbo_run_summary", "run_summary"),
4041
]
4142
.as_slice();
4243

@@ -84,6 +85,7 @@ impl ResolvedConfigurationOptions for EnvVars {
8485
let force = self.truthy_value("force").flatten();
8586
let remote_only = self.truthy_value("remote_only").flatten();
8687
let remote_cache_read_only = self.truthy_value("remote_cache_read_only").flatten();
88+
let run_summary = self.truthy_value("run_summary").flatten();
8789

8890
// Process timeout
8991
let timeout = self
@@ -168,6 +170,7 @@ impl ResolvedConfigurationOptions for EnvVars {
168170
force,
169171
remote_only,
170172
remote_cache_read_only,
173+
run_summary,
171174

172175
// Processed numbers
173176
timeout,
@@ -313,6 +316,7 @@ mod test {
313316
env.insert("turbo_log_order".into(), "grouped".into());
314317
env.insert("turbo_remote_only".into(), "1".into());
315318
env.insert("turbo_remote_cache_read_only".into(), "1".into());
319+
env.insert("turbo_run_summary".into(), "true".into());
316320

317321
let config = EnvVars::new(&env)
318322
.unwrap()
@@ -323,6 +327,7 @@ mod test {
323327
assert_eq!(config.log_order(), LogOrder::Grouped);
324328
assert!(config.remote_only());
325329
assert!(config.remote_cache_read_only());
330+
assert!(config.run_summary());
326331
assert_eq!(turbo_api, config.api_url.unwrap());
327332
assert_eq!(turbo_login, config.login_url.unwrap());
328333
assert_eq!(turbo_team, config.team_slug.unwrap());
@@ -359,6 +364,7 @@ mod test {
359364
env.insert("turbo_log_order".into(), "".into());
360365
env.insert("turbo_remote_only".into(), "".into());
361366
env.insert("turbo_remote_cache_read_only".into(), "".into());
367+
env.insert("turbo_run_summary".into(), "".into());
362368

363369
let config = EnvVars::new(&env)
364370
.unwrap()
@@ -380,6 +386,7 @@ mod test {
380386
assert_eq!(config.log_order(), LogOrder::Auto);
381387
assert!(!config.remote_only());
382388
assert!(!config.remote_cache_read_only());
389+
assert!(!config.run_summary());
383390
}
384391

385392
#[test]

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

+5
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ pub struct ConfigurationOptions {
238238
pub(crate) log_order: Option<LogOrder>,
239239
pub(crate) remote_only: Option<bool>,
240240
pub(crate) remote_cache_read_only: Option<bool>,
241+
pub(crate) run_summary: Option<bool>,
241242
}
242243

243244
#[derive(Default)]
@@ -357,6 +358,10 @@ impl ConfigurationOptions {
357358
self.remote_cache_read_only.unwrap_or_default()
358359
}
359360

361+
pub fn run_summary(&self) -> bool {
362+
self.run_summary.unwrap_or_default()
363+
}
364+
360365
pub fn root_turbo_json_path(&self, repo_root: &AbsoluteSystemPath) -> AbsoluteSystemPathBuf {
361366
self.root_turbo_json_path
362367
.clone()

crates/turborepo-lib/src/opts.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ pub struct RunOpts {
163163
pub(crate) single_package: bool,
164164
pub log_prefix: ResolvedLogPrefix,
165165
pub log_order: ResolvedLogOrder,
166-
pub summarize: Option<Option<bool>>,
166+
pub summarize: bool,
167167
pub(crate) experimental_space_id: Option<String>,
168168
pub is_github_actions: bool,
169169
}
@@ -247,7 +247,7 @@ impl<'a> TryFrom<OptsInputs<'a>> for RunOpts {
247247
tasks: inputs.execution_args.tasks.clone(),
248248
log_prefix,
249249
log_order,
250-
summarize: inputs.run_args.summarize,
250+
summarize: inputs.config.run_summary(),
251251
experimental_space_id: inputs
252252
.run_args
253253
.experimental_space_id
@@ -502,7 +502,7 @@ mod test {
502502
single_package: false,
503503
log_prefix: crate::opts::ResolvedLogPrefix::Task,
504504
log_order: crate::opts::ResolvedLogOrder::Stream,
505-
summarize: None,
505+
summarize: false,
506506
experimental_space_id: None,
507507
is_github_actions: false,
508508
daemon: None,

crates/turborepo-lib/src/run/summary/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ impl RunTracker {
188188
task_factory: TaskSummaryFactory<'a>,
189189
) -> Result<RunSummary<'a>, Error> {
190190
let single_package = run_opts.single_package;
191-
let should_save = run_opts.summarize.flatten().is_some_and(|s| s);
191+
let should_save = run_opts.summarize;
192192

193193
let run_type = match run_opts.dry_run {
194194
None => RunType::Real,

0 commit comments

Comments
 (0)