Skip to content

Commit

Permalink
move env var handling into rust and expose summarize env as a command
Browse files Browse the repository at this point in the history
  • Loading branch information
arlyon committed Mar 28, 2023
1 parent 0f3d967 commit 7d6a2af
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 16 deletions.
14 changes: 1 addition & 13 deletions cli/internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package run
import (
gocontext "context"
"fmt"
"os"
"sort"
"sync"
"time"
Expand Down Expand Up @@ -81,6 +80,7 @@ func optsFromArgs(args *turbostate.ParsedArgsFromRust) (*Opts, error) {
opts.cacheOpts.OverrideDir = runPayload.CacheDir
opts.cacheOpts.Workers = runPayload.CacheWorkers
opts.runOpts.logPrefix = runPayload.LogPrefix
opts.runOpts.summarize = runPayload.Summarize
opts.runOpts.experimentalSpaceID = runPayload.ExperimentalSpaceID

// Runcache flags
Expand Down Expand Up @@ -136,18 +136,6 @@ func optsFromArgs(args *turbostate.ParsedArgsFromRust) (*Opts, error) {
}

func configureRun(base *cmdutil.CmdBase, opts *Opts, signalWatcher *signals.Watcher) *run {
if os.Getenv("TURBO_FORCE") == "true" {
opts.runcacheOpts.SkipReads = true
}

if os.Getenv("TURBO_REMOTE_ONLY") == "true" {
opts.cacheOpts.SkipFilesystem = true
}

if os.Getenv("TURBO_RUN_SUMMARY") == "true" {
opts.runOpts.summarize = true
}

processes := process.NewManager(base.Logger.Named("processes"))
signalWatcher.AddOnClose(processes.Close)
return &run{
Expand Down
1 change: 1 addition & 0 deletions cli/internal/turbostate/turbostate.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ type RunPayload struct {
Scope []string `json:"scope"`
Since string `json:"since"`
SinglePackage bool `json:"single_package"`
Summarize bool `json:"summarize"`
Tasks []string `json:"tasks"`
PkgInferenceRoot string `json:"pkg_inference_root"`
LogPrefix string `json:"log_prefix"`
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ atty = { workspace = true }
axum = "0.6.2"
axum-server = "0.4.4"
chrono = { workspace = true, features = ["serde"] }
clap = { workspace = true, features = ["derive"] }
clap = { workspace = true, features = ["derive", "env"] }
clap_complete = { workspace = true }
command-group = { version = "2.1.0", features = ["with-tokio"] }
config = "0.13"
Expand Down
7 changes: 5 additions & 2 deletions crates/turborepo-lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ pub struct RunArgs {
#[clap(long, action = ArgAction::Append)]
pub filter: Vec<String>,
/// Ignore the existing cache (to force execution)
#[clap(long)]
#[clap(long, env = "TURBO_FORCE")]
pub force: bool,
/// Specify glob of global filesystem dependencies to be hashed. Useful
/// for .env and files
Expand Down Expand Up @@ -347,7 +347,7 @@ pub struct RunArgs {
pub profile: Option<String>,
/// Ignore the local filesystem cache for all tasks. Only
/// allow reading and caching artifacts using the remote cache.
#[clap(long)]
#[clap(long, env = "TURBO_REMOTE_ONLY")]
pub remote_only: bool,
/// Specify package(s) to act as entry points for task execution.
/// Supports globs.
Expand All @@ -358,6 +358,9 @@ pub struct RunArgs {
/// to identify which packages have changed.
#[clap(long)]
pub since: Option<String>,
/// Opt in to using the turbo run summary.
#[clap(long, hide = true, env = "TURBO_RUN_SUMMARY")]
pub summarize: Option<bool>,
/// Use "none" to remove prefixes from task logs. Note that tasks running
/// in parallel interleave their logs and prefix is the only way
/// to identify which task produced a log.
Expand Down

0 comments on commit 7d6a2af

Please sign in to comment.