From 6d1fa9442a20cc94108ac3e85c8375c6257c7a25 Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Thu, 29 Sep 2022 12:43:51 -0700 Subject: [PATCH 01/11] Revert "Drop log line breaking JSON dry-run output when remote caching is enabled (#2067)" This reverts commit d48fcdf031015c12dcdf610f7487ebde003d838d. --- cli/internal/cache/cache.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/internal/cache/cache.go b/cli/internal/cache/cache.go index b8839d5a7797f..998ff01317a0f 100644 --- a/cli/internal/cache/cache.go +++ b/cli/internal/cache/cache.go @@ -7,12 +7,14 @@ package cache import ( "errors" + "fmt" "sync" "github.com/spf13/pflag" "github.com/vercel/turborepo/cli/internal/analytics" "github.com/vercel/turborepo/cli/internal/fs" "github.com/vercel/turborepo/cli/internal/turbopath" + "github.com/vercel/turborepo/cli/internal/ui" "github.com/vercel/turborepo/cli/internal/util" "golang.org/x/sync/errgroup" ) @@ -130,6 +132,7 @@ func newSyncCache(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client clien } if useHTTPCache { + fmt.Println(ui.Dim("• Remote computation caching enabled")) implementation := newHTTPCache(opts, client, recorder) cacheImplementations = append(cacheImplementations, implementation) } From 94762d731013863d791c9256478524649c766289 Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Thu, 29 Sep 2022 13:07:54 -0700 Subject: [PATCH 02/11] Log Remote caching enablement with configured UI displayer --- cli/internal/cache/cache.go | 12 +++++++----- cli/internal/cmdutil/cmdutil.go | 4 ++++ cli/internal/run/run.go | 4 +++- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/cli/internal/cache/cache.go b/cli/internal/cache/cache.go index 998ff01317a0f..e02a0377a4fc8 100644 --- a/cli/internal/cache/cache.go +++ b/cli/internal/cache/cache.go @@ -7,9 +7,9 @@ package cache import ( "errors" - "fmt" "sync" + "github.com/mitchellh/cli" "github.com/spf13/pflag" "github.com/vercel/turborepo/cli/internal/analytics" "github.com/vercel/turborepo/cli/internal/fs" @@ -93,8 +93,8 @@ func AddFlags(opts *Opts, flags *pflag.FlagSet) { } // New creates a new cache -func New(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, recorder analytics.Recorder, onCacheRemoved OnCacheRemoved) (Cache, error) { - c, err := newSyncCache(opts, repoRoot, client, recorder, onCacheRemoved) +func New(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, recorder analytics.Recorder, terminal cli.Ui, onCacheRemoved OnCacheRemoved) (Cache, error) { + c, err := newSyncCache(opts, repoRoot, client, recorder, terminal, onCacheRemoved) if err != nil && !errors.Is(err, ErrNoCachesEnabled) { return nil, err } @@ -105,7 +105,7 @@ func New(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, record } // newSyncCache can return an error with a usable noopCache. -func newSyncCache(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, recorder analytics.Recorder, onCacheRemoved OnCacheRemoved) (Cache, error) { +func newSyncCache(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, recorder analytics.Recorder, terminal cli.Ui, onCacheRemoved OnCacheRemoved) (Cache, error) { // Check to see if the user has turned off particular cache implementations. useFsCache := !opts.SkipFilesystem useHTTPCache := !opts.SkipRemote @@ -132,9 +132,11 @@ func newSyncCache(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client clien } if useHTTPCache { - fmt.Println(ui.Dim("• Remote computation caching enabled")) + terminal.Info(ui.Dim("• Remote computation caching enabled")) implementation := newHTTPCache(opts, client, recorder) cacheImplementations = append(cacheImplementations, implementation) + } else { + terminal.Info(ui.Dim("• Remote computation caching disabled")) } if useNoopCache { diff --git a/cli/internal/cmdutil/cmdutil.go b/cli/internal/cmdutil/cmdutil.go index 1027633dd75d6..a19ffee17c575 100644 --- a/cli/internal/cmdutil/cmdutil.go +++ b/cli/internal/cmdutil/cmdutil.go @@ -147,8 +147,12 @@ func NewHelper(turboVersion string) *Helper { // GetCmdBase returns a CmdBase instance configured with values from this helper. // It additionally returns a mechanism to set an error, so func (h *Helper) GetCmdBase(flags *pflag.FlagSet) (*CmdBase, error) { + // terminal is for color/no-color output terminal := h.getUI(flags) + + // logger is configured with verbosity level using --verbosity flag from end users logger, err := h.getLogger() + if err != nil { return nil, err } diff --git a/cli/internal/run/run.go b/cli/internal/run/run.go index d4e40cb3b7005..782db34da1cba 100644 --- a/cli/internal/run/run.go +++ b/cli/internal/run/run.go @@ -93,6 +93,7 @@ Arguments passed after '--' will be passed through to the named tasks. func GetCmd(helper *cmdutil.Helper, signalWatcher *signals.Watcher) *cobra.Command { var opts *Opts var flags *pflag.FlagSet + cmd := &cobra.Command{ Use: "run [...] [] -- ", Short: "Run tasks across projects in your monorepo", @@ -119,6 +120,7 @@ func GetCmd(helper *cmdutil.Helper, signalWatcher *signals.Watcher) *cobra.Comma return nil }, } + flags = cmd.Flags() opts = optsFromFlags(flags) return cmd @@ -727,7 +729,7 @@ func (r *run) initCache(ctx gocontext.Context, rs *runSpec, analyticsClient anal apiClient := r.base.APIClient // Theoretically this is overkill, but bias towards not spamming the console once := &sync.Once{} - return cache.New(rs.Opts.cacheOpts, r.base.RepoRoot, apiClient, analyticsClient, func(_cache cache.Cache, err error) { + return cache.New(rs.Opts.cacheOpts, r.base.RepoRoot, apiClient, analyticsClient, r.base.UI, func(_cache cache.Cache, err error) { // Currently the HTTP Cache is the only one that can be disabled. // With a cache system refactor, we might consider giving names to the caches so // we can accurately report them here. From d87a9fcffea587e531fc8b0ec2f71ceaad2f0ce8 Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Thu, 29 Sep 2022 13:19:52 -0700 Subject: [PATCH 03/11] Use base.Logger instead --- cli/internal/cache/cache.go | 12 ++++++------ cli/internal/run/run.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cli/internal/cache/cache.go b/cli/internal/cache/cache.go index e02a0377a4fc8..dfe4dd4b5f05e 100644 --- a/cli/internal/cache/cache.go +++ b/cli/internal/cache/cache.go @@ -9,7 +9,7 @@ import ( "errors" "sync" - "github.com/mitchellh/cli" + "github.com/hashicorp/go-hclog" "github.com/spf13/pflag" "github.com/vercel/turborepo/cli/internal/analytics" "github.com/vercel/turborepo/cli/internal/fs" @@ -93,8 +93,8 @@ func AddFlags(opts *Opts, flags *pflag.FlagSet) { } // New creates a new cache -func New(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, recorder analytics.Recorder, terminal cli.Ui, onCacheRemoved OnCacheRemoved) (Cache, error) { - c, err := newSyncCache(opts, repoRoot, client, recorder, terminal, onCacheRemoved) +func New(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, recorder analytics.Recorder, logger hclog.Logger, onCacheRemoved OnCacheRemoved) (Cache, error) { + c, err := newSyncCache(opts, repoRoot, client, recorder, logger, onCacheRemoved) if err != nil && !errors.Is(err, ErrNoCachesEnabled) { return nil, err } @@ -105,7 +105,7 @@ func New(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, record } // newSyncCache can return an error with a usable noopCache. -func newSyncCache(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, recorder analytics.Recorder, terminal cli.Ui, onCacheRemoved OnCacheRemoved) (Cache, error) { +func newSyncCache(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, recorder analytics.Recorder, logger hclog.Logger, onCacheRemoved OnCacheRemoved) (Cache, error) { // Check to see if the user has turned off particular cache implementations. useFsCache := !opts.SkipFilesystem useHTTPCache := !opts.SkipRemote @@ -132,11 +132,11 @@ func newSyncCache(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client clien } if useHTTPCache { - terminal.Info(ui.Dim("• Remote computation caching enabled")) + logger.Info(ui.Dim("• Remote computation caching enabled")) implementation := newHTTPCache(opts, client, recorder) cacheImplementations = append(cacheImplementations, implementation) } else { - terminal.Info(ui.Dim("• Remote computation caching disabled")) + logger.Info(ui.Dim("• Remote computation caching disabled")) } if useNoopCache { diff --git a/cli/internal/run/run.go b/cli/internal/run/run.go index 782db34da1cba..deeb466751f7a 100644 --- a/cli/internal/run/run.go +++ b/cli/internal/run/run.go @@ -729,7 +729,7 @@ func (r *run) initCache(ctx gocontext.Context, rs *runSpec, analyticsClient anal apiClient := r.base.APIClient // Theoretically this is overkill, but bias towards not spamming the console once := &sync.Once{} - return cache.New(rs.Opts.cacheOpts, r.base.RepoRoot, apiClient, analyticsClient, r.base.UI, func(_cache cache.Cache, err error) { + return cache.New(rs.Opts.cacheOpts, r.base.RepoRoot, apiClient, analyticsClient, r.base.Logger, func(_cache cache.Cache, err error) { // Currently the HTTP Cache is the only one that can be disabled. // With a cache system refactor, we might consider giving names to the caches so // we can accurately report them here. From a461e1645f460ab927f78e1bbeb32a30e33e6203 Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Thu, 29 Sep 2022 13:37:19 -0700 Subject: [PATCH 04/11] Move all into CmdBase.LogInfo --- cli/internal/cache/cache.go | 16 ++++++++-------- cli/internal/cmdutil/cmdutil.go | 17 +++++++++++++++++ cli/internal/run/run.go | 23 ++++++----------------- cli/internal/ui/ui.go | 1 + 4 files changed, 32 insertions(+), 25 deletions(-) diff --git a/cli/internal/cache/cache.go b/cli/internal/cache/cache.go index dfe4dd4b5f05e..fd09580ae8ed1 100644 --- a/cli/internal/cache/cache.go +++ b/cli/internal/cache/cache.go @@ -9,12 +9,11 @@ import ( "errors" "sync" - "github.com/hashicorp/go-hclog" "github.com/spf13/pflag" "github.com/vercel/turborepo/cli/internal/analytics" + "github.com/vercel/turborepo/cli/internal/cmdutil" "github.com/vercel/turborepo/cli/internal/fs" "github.com/vercel/turborepo/cli/internal/turbopath" - "github.com/vercel/turborepo/cli/internal/ui" "github.com/vercel/turborepo/cli/internal/util" "golang.org/x/sync/errgroup" ) @@ -93,8 +92,9 @@ func AddFlags(opts *Opts, flags *pflag.FlagSet) { } // New creates a new cache -func New(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, recorder analytics.Recorder, logger hclog.Logger, onCacheRemoved OnCacheRemoved) (Cache, error) { - c, err := newSyncCache(opts, repoRoot, client, recorder, logger, onCacheRemoved) +func New(opts Opts, base *cmdutil.CmdBase, client client, recorder analytics.Recorder, onCacheRemoved OnCacheRemoved) (Cache, error) { + + c, err := newSyncCache(opts, base, client, recorder, onCacheRemoved) if err != nil && !errors.Is(err, ErrNoCachesEnabled) { return nil, err } @@ -105,7 +105,7 @@ func New(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, record } // newSyncCache can return an error with a usable noopCache. -func newSyncCache(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, recorder analytics.Recorder, logger hclog.Logger, onCacheRemoved OnCacheRemoved) (Cache, error) { +func newSyncCache(opts Opts, base *cmdutil.CmdBase, client client, recorder analytics.Recorder, onCacheRemoved OnCacheRemoved) (Cache, error) { // Check to see if the user has turned off particular cache implementations. useFsCache := !opts.SkipFilesystem useHTTPCache := !opts.SkipRemote @@ -124,7 +124,7 @@ func newSyncCache(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client clien cacheImplementations := make([]Cache, 0, 2) if useFsCache { - implementation, err := newFsCache(opts, recorder, repoRoot) + implementation, err := newFsCache(opts, recorder, base.RepoRoot) if err != nil { return nil, err } @@ -132,11 +132,11 @@ func newSyncCache(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client clien } if useHTTPCache { - logger.Info(ui.Dim("• Remote computation caching enabled")) + base.LogInfo("• Remote computation caching enabled") implementation := newHTTPCache(opts, client, recorder) cacheImplementations = append(cacheImplementations, implementation) } else { - logger.Info(ui.Dim("• Remote computation caching disabled")) + base.LogInfo("• Remote computation caching disabled") } if useNoopCache { diff --git a/cli/internal/cmdutil/cmdutil.go b/cli/internal/cmdutil/cmdutil.go index a19ffee17c575..e548b2ab74616 100644 --- a/cli/internal/cmdutil/cmdutil.go +++ b/cli/internal/cmdutil/cmdutil.go @@ -220,3 +220,20 @@ func (b *CmdBase) LogError(format string, args ...interface{}) { b.Logger.Error("error", err) b.UI.Error(fmt.Sprintf("%s%s", ui.ERROR_PREFIX, color.RedString(" %v", err))) } + +// LogWarning logs an error and outputs it to the UI. +func (b *CmdBase) LogWarning(prefix string, err error) { + b.Logger.Warn(prefix, "warning", err) + + if prefix != "" { + prefix = " " + prefix + ": " + } + + b.UI.Error(fmt.Sprintf("%s%s%s", ui.WARNING_PREFIX, prefix, color.YellowString(" %v", err))) +} + +// LogInfo logs an message and outputs it to the UI. +func (b *CmdBase) LogInfo(msg string) { + b.Logger.Info(msg) + b.UI.Info(fmt.Sprintf("%s%s", ui.INFO_PREFIX, color.WhiteString(" %v", msg))) +} diff --git a/cli/internal/run/run.go b/cli/internal/run/run.go index deeb466751f7a..7b72773fdb428 100644 --- a/cli/internal/run/run.go +++ b/cli/internal/run/run.go @@ -202,7 +202,7 @@ func (r *run) run(ctx gocontext.Context, targets []string) error { } else if !r.opts.runOpts.noDaemon { turbodClient, err := daemon.GetClient(ctx, r.base.RepoRoot, r.base.Logger, r.base.TurboVersion, daemon.ClientOpts{}) if err != nil { - r.logWarning("", errors.Wrap(err, "failed to contact turbod. Continuing in standalone mode")) + r.base.LogWarning("", errors.Wrap(err, "failed to contact turbod. Continuing in standalone mode")) } else { defer func() { _ = turbodClient.Close() }() r.base.Logger.Debug("running in daemon mode") @@ -223,7 +223,7 @@ func (r *run) run(ctx gocontext.Context, targets []string) error { scmInstance, err := scm.FromInRepo(r.base.RepoRoot.ToStringDuringMigration()) if err != nil { if errors.Is(err, scm.ErrFallback) { - r.logWarning("", err) + r.base.LogWarning("", err) } else { return errors.Wrap(err, "failed to create SCM") } @@ -701,17 +701,6 @@ func getDefaultOptions() *Opts { } } -// logError logs an error and outputs it to the UI. -func (r *run) logWarning(prefix string, err error) { - r.base.Logger.Warn(prefix, "warning", err) - - if prefix != "" { - prefix = " " + prefix + ": " - } - - r.base.UI.Error(fmt.Sprintf("%s%s%s", ui.WARNING_PREFIX, prefix, color.YellowString(" %v", err))) -} - func (r *run) initAnalyticsClient(ctx gocontext.Context) analytics.Client { apiClient := r.base.APIClient var analyticsSink analytics.Sink @@ -729,12 +718,12 @@ func (r *run) initCache(ctx gocontext.Context, rs *runSpec, analyticsClient anal apiClient := r.base.APIClient // Theoretically this is overkill, but bias towards not spamming the console once := &sync.Once{} - return cache.New(rs.Opts.cacheOpts, r.base.RepoRoot, apiClient, analyticsClient, r.base.Logger, func(_cache cache.Cache, err error) { + return cache.New(rs.Opts.cacheOpts, r.base, apiClient, analyticsClient, func(_cache cache.Cache, err error) { // Currently the HTTP Cache is the only one that can be disabled. // With a cache system refactor, we might consider giving names to the caches so // we can accurately report them here. once.Do(func() { - r.logWarning("Remote Caching is unavailable", err) + r.base.LogWarning("Remote Caching is unavailable", err) }) }) } @@ -746,7 +735,7 @@ func (r *run) executeTasks(ctx gocontext.Context, g *completeGraph, rs *runSpec, turboCache, err := r.initCache(ctx, rs, analyticsClient) if err != nil { if errors.Is(err, cache.ErrNoCachesEnabled) { - r.logWarning("No caches are enabled. You can try \"turbo login\", \"turbo link\", or ensuring you are not passing --remote-only to enable caching", nil) + r.base.LogWarning("No caches are enabled. You can try \"turbo login\", \"turbo link\", or ensuring you are not passing --remote-only to enable caching", nil) } else { return errors.Wrap(err, "failed to set up caching") } @@ -858,7 +847,7 @@ func (r *run) executeDryRun(ctx gocontext.Context, engine *core.Scheduler, g *co if err != nil { if errors.Is(err, cache.ErrNoCachesEnabled) { - r.logWarning("No caches are enabled. You can try \"turbo login\", \"turbo link\", or ensuring you are not passing --remote-only to enable caching", nil) + r.base.LogWarning("No caches are enabled. You can try \"turbo login\", \"turbo link\", or ensuring you are not passing --remote-only to enable caching", nil) } else { return nil, errors.Wrap(err, "failed to set up caching") } diff --git a/cli/internal/ui/ui.go b/cli/internal/ui/ui.go index 642a41e49c7d9..78949d512dd60 100644 --- a/cli/internal/ui/ui.go +++ b/cli/internal/ui/ui.go @@ -24,6 +24,7 @@ var gray = color.New(color.Faint) var bold = color.New(color.Bold) var ERROR_PREFIX = color.New(color.Bold, color.FgRed, color.ReverseVideo).Sprint(" ERROR ") var WARNING_PREFIX = color.New(color.Bold, color.FgYellow, color.ReverseVideo).Sprint(" WARNING ") +var INFO_PREFIX = color.New(color.Bold, color.FgWhite, color.ReverseVideo).Sprint(" INFO ") var ansiRegex = regexp.MustCompile(ansiEscapeStr) From 9b87a34759e4f823baeaad035e835cd7e01ac095 Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Thu, 29 Sep 2022 13:49:38 -0700 Subject: [PATCH 05/11] rm blank line --- cli/internal/cache/cache.go | 1 - 1 file changed, 1 deletion(-) diff --git a/cli/internal/cache/cache.go b/cli/internal/cache/cache.go index fd09580ae8ed1..c50b38ac71f25 100644 --- a/cli/internal/cache/cache.go +++ b/cli/internal/cache/cache.go @@ -93,7 +93,6 @@ func AddFlags(opts *Opts, flags *pflag.FlagSet) { // New creates a new cache func New(opts Opts, base *cmdutil.CmdBase, client client, recorder analytics.Recorder, onCacheRemoved OnCacheRemoved) (Cache, error) { - c, err := newSyncCache(opts, base, client, recorder, onCacheRemoved) if err != nil && !errors.Is(err, ErrNoCachesEnabled) { return nil, err From b306c7d1c1490c51198bcf726b35767df41c25a7 Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Thu, 29 Sep 2022 14:22:32 -0700 Subject: [PATCH 06/11] Create log function abstractions in run struct so we can hide terminal output in dry-run --- cli/internal/cache/cache.go | 12 ++++------ cli/internal/cmd/auth/logout.go | 2 +- cli/internal/cmd/auth/unlink.go | 2 +- cli/internal/cmd/info/bin.go | 2 +- cli/internal/cmdutil/cmdutil.go | 20 +++++++++++----- cli/internal/login/login.go | 4 ++-- cli/internal/prune/prune.go | 2 +- cli/internal/run/run.go | 41 +++++++++++++++++++++++++++------ 8 files changed, 58 insertions(+), 27 deletions(-) diff --git a/cli/internal/cache/cache.go b/cli/internal/cache/cache.go index c50b38ac71f25..b8839d5a7797f 100644 --- a/cli/internal/cache/cache.go +++ b/cli/internal/cache/cache.go @@ -11,7 +11,6 @@ import ( "github.com/spf13/pflag" "github.com/vercel/turborepo/cli/internal/analytics" - "github.com/vercel/turborepo/cli/internal/cmdutil" "github.com/vercel/turborepo/cli/internal/fs" "github.com/vercel/turborepo/cli/internal/turbopath" "github.com/vercel/turborepo/cli/internal/util" @@ -92,8 +91,8 @@ func AddFlags(opts *Opts, flags *pflag.FlagSet) { } // New creates a new cache -func New(opts Opts, base *cmdutil.CmdBase, client client, recorder analytics.Recorder, onCacheRemoved OnCacheRemoved) (Cache, error) { - c, err := newSyncCache(opts, base, client, recorder, onCacheRemoved) +func New(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, recorder analytics.Recorder, onCacheRemoved OnCacheRemoved) (Cache, error) { + c, err := newSyncCache(opts, repoRoot, client, recorder, onCacheRemoved) if err != nil && !errors.Is(err, ErrNoCachesEnabled) { return nil, err } @@ -104,7 +103,7 @@ func New(opts Opts, base *cmdutil.CmdBase, client client, recorder analytics.Rec } // newSyncCache can return an error with a usable noopCache. -func newSyncCache(opts Opts, base *cmdutil.CmdBase, client client, recorder analytics.Recorder, onCacheRemoved OnCacheRemoved) (Cache, error) { +func newSyncCache(opts Opts, repoRoot turbopath.AbsoluteSystemPath, client client, recorder analytics.Recorder, onCacheRemoved OnCacheRemoved) (Cache, error) { // Check to see if the user has turned off particular cache implementations. useFsCache := !opts.SkipFilesystem useHTTPCache := !opts.SkipRemote @@ -123,7 +122,7 @@ func newSyncCache(opts Opts, base *cmdutil.CmdBase, client client, recorder anal cacheImplementations := make([]Cache, 0, 2) if useFsCache { - implementation, err := newFsCache(opts, recorder, base.RepoRoot) + implementation, err := newFsCache(opts, recorder, repoRoot) if err != nil { return nil, err } @@ -131,11 +130,8 @@ func newSyncCache(opts Opts, base *cmdutil.CmdBase, client client, recorder anal } if useHTTPCache { - base.LogInfo("• Remote computation caching enabled") implementation := newHTTPCache(opts, client, recorder) cacheImplementations = append(cacheImplementations, implementation) - } else { - base.LogInfo("• Remote computation caching disabled") } if useNoopCache { diff --git a/cli/internal/cmd/auth/logout.go b/cli/internal/cmd/auth/logout.go index 6bae51d21ac54..f2465f1d89800 100644 --- a/cli/internal/cmd/auth/logout.go +++ b/cli/internal/cmd/auth/logout.go @@ -20,7 +20,7 @@ func LogoutCmd(helper *cmdutil.Helper) *cobra.Command { return err } if err := base.UserConfig.Delete(); err != nil && !os.IsNotExist(err) { - base.LogError("could not logout. Something went wrong: %w", err) + base.LogError("could not logout. Something went wrong: %w", true, err) return err } diff --git a/cli/internal/cmd/auth/unlink.go b/cli/internal/cmd/auth/unlink.go index d48e26e291e3e..167578f86ca02 100644 --- a/cli/internal/cmd/auth/unlink.go +++ b/cli/internal/cmd/auth/unlink.go @@ -18,7 +18,7 @@ func UnlinkCmd(helper *cmdutil.Helper) *cobra.Command { return err } if err := base.RepoConfig.Delete(); err != nil { - base.LogError("could not unlink. Something went wrong: %w", err) + base.LogError("could not unlink. Something went wrong: %w", true, err) return err } diff --git a/cli/internal/cmd/info/bin.go b/cli/internal/cmd/info/bin.go index 5b83ce3d06638..fa91d650a80cd 100644 --- a/cli/internal/cmd/info/bin.go +++ b/cli/internal/cmd/info/bin.go @@ -20,7 +20,7 @@ func BinCmd(helper *cmdutil.Helper) *cobra.Command { } path, err := os.Executable() if err != nil { - base.LogError("could not get path to turbo binary: %w", err) + base.LogError("could not get path to turbo binary: %w", true, err) return err } diff --git a/cli/internal/cmdutil/cmdutil.go b/cli/internal/cmdutil/cmdutil.go index e548b2ab74616..5635d95a1c943 100644 --- a/cli/internal/cmdutil/cmdutil.go +++ b/cli/internal/cmdutil/cmdutil.go @@ -190,6 +190,7 @@ func (h *Helper) GetCmdBase(flags *pflag.FlagSet) (*CmdBase, error) { h.TurboVersion, h.clientOpts, ) + return &CmdBase{ UI: terminal, Logger: logger, @@ -215,25 +216,32 @@ type CmdBase struct { } // LogError prints an error to the UI -func (b *CmdBase) LogError(format string, args ...interface{}) { +func (b *CmdBase) LogError(format string, shouldPrintToTerminal bool, args ...interface{}) { err := fmt.Errorf(format, args...) b.Logger.Error("error", err) - b.UI.Error(fmt.Sprintf("%s%s", ui.ERROR_PREFIX, color.RedString(" %v", err))) + + if shouldPrintToTerminal { + b.UI.Error(fmt.Sprintf("%s%s", ui.ERROR_PREFIX, color.RedString(" %v", err))) + } } // LogWarning logs an error and outputs it to the UI. -func (b *CmdBase) LogWarning(prefix string, err error) { +func (b *CmdBase) LogWarning(prefix string, err error, shouldPrintToTerminal bool) { b.Logger.Warn(prefix, "warning", err) if prefix != "" { prefix = " " + prefix + ": " } - b.UI.Error(fmt.Sprintf("%s%s%s", ui.WARNING_PREFIX, prefix, color.YellowString(" %v", err))) + if shouldPrintToTerminal { + b.UI.Error(fmt.Sprintf("%s%s%s", ui.WARNING_PREFIX, prefix, color.YellowString(" %v", err))) + } } // LogInfo logs an message and outputs it to the UI. -func (b *CmdBase) LogInfo(msg string) { +func (b *CmdBase) LogInfo(msg string, shouldPrintToTerminal bool) { b.Logger.Info(msg) - b.UI.Info(fmt.Sprintf("%s%s", ui.INFO_PREFIX, color.WhiteString(" %v", msg))) + if shouldPrintToTerminal { + b.UI.Info(fmt.Sprintf("%s%s", ui.INFO_PREFIX, color.WhiteString(" %v", msg))) + } } diff --git a/cli/internal/login/login.go b/cli/internal/login/login.go index e66d08dd09fbe..b03b56987ee40 100644 --- a/cli/internal/login/login.go +++ b/cli/internal/login/login.go @@ -51,7 +51,7 @@ func NewLoginCommand(helper *cmdutil.Helper) *cobra.Command { } else if errors.Is(err, errTryAfterEnable) || errors.Is(err, errNeedCachingEnabled) || errors.Is(err, errOverage) { base.UI.Info("Remote Caching not enabled. Please run 'turbo login' again after Remote Caching has been enabled") } else { - base.LogError("SSO login failed: %v", err) + base.LogError("SSO login failed: %v", true, err) } return err } @@ -61,7 +61,7 @@ func NewLoginCommand(helper *cmdutil.Helper) *cobra.Command { if errors.Is(err, context.Canceled) { base.UI.Info("Canceled. Turborepo not set up.") } else { - base.LogError("login failed: %v", err) + base.LogError("login failed: %v", true, err) } return err } diff --git a/cli/internal/prune/prune.go b/cli/internal/prune/prune.go index 1fca461d66fe8..599cac1df07b3 100644 --- a/cli/internal/prune/prune.go +++ b/cli/internal/prune/prune.go @@ -53,7 +53,7 @@ func GetCmd(helper *cmdutil.Helper) *cobra.Command { } if opts.scope == "" { err := errors.New("at least one target must be specified") - base.LogError(err.Error()) + base.LogError(err.Error(), true) return err } p := &prune{ diff --git a/cli/internal/run/run.go b/cli/internal/run/run.go index 7b72773fdb428..1552158c375fa 100644 --- a/cli/internal/run/run.go +++ b/cli/internal/run/run.go @@ -114,7 +114,7 @@ func GetCmd(helper *cmdutil.Helper, signalWatcher *signals.Watcher) *cobra.Comma run := configureRun(base, opts, signalWatcher) ctx := cmd.Context() if err := run.run(ctx, tasks); err != nil { - base.LogError("run failed: %v", err) + base.LogError("run failed: %v", true, err) return err } return nil @@ -173,6 +173,24 @@ type run struct { processes *process.Manager } +// logWarning logs an error and outputs it to the UI. +func (r *run) logError(prefix string, err error) { + shouldPrintToTerminal := !r.opts.runOpts.dryRun + r.base.LogError(prefix, shouldPrintToTerminal, err) +} + +// logWarning logs an error and outputs it to the UI. +func (r *run) logWarning(prefix string, err error) { + shouldPrintToTerminal := !r.opts.runOpts.dryRun + r.base.LogWarning(prefix, err, shouldPrintToTerminal) +} + +// logWarning logs an error and outputs it to the UI. +func (r *run) logInfo(msg string) { + shouldPrintToTerminal := !r.opts.runOpts.dryRun + r.base.LogInfo(msg, shouldPrintToTerminal) +} + func (r *run) run(ctx gocontext.Context, targets []string) error { startAt := time.Now() packageJSONPath := r.base.RepoRoot.UntypedJoin("package.json") @@ -202,7 +220,7 @@ func (r *run) run(ctx gocontext.Context, targets []string) error { } else if !r.opts.runOpts.noDaemon { turbodClient, err := daemon.GetClient(ctx, r.base.RepoRoot, r.base.Logger, r.base.TurboVersion, daemon.ClientOpts{}) if err != nil { - r.base.LogWarning("", errors.Wrap(err, "failed to contact turbod. Continuing in standalone mode")) + r.logWarning("", errors.Wrap(err, "failed to contact turbod. Continuing in standalone mode")) } else { defer func() { _ = turbodClient.Close() }() r.base.Logger.Debug("running in daemon mode") @@ -223,7 +241,7 @@ func (r *run) run(ctx gocontext.Context, targets []string) error { scmInstance, err := scm.FromInRepo(r.base.RepoRoot.ToStringDuringMigration()) if err != nil { if errors.Is(err, scm.ErrFallback) { - r.base.LogWarning("", err) + r.logWarning("", err) } else { return errors.Wrap(err, "failed to create SCM") } @@ -718,12 +736,21 @@ func (r *run) initCache(ctx gocontext.Context, rs *runSpec, analyticsClient anal apiClient := r.base.APIClient // Theoretically this is overkill, but bias towards not spamming the console once := &sync.Once{} - return cache.New(rs.Opts.cacheOpts, r.base, apiClient, analyticsClient, func(_cache cache.Cache, err error) { + // rs.Opts.runOpts + + useHTTPCache := !rs.Opts.cacheOpts.SkipRemote + if useHTTPCache { + r.logInfo("• Remote computation caching enabled") + } else { + r.logInfo("• Remote computation caching disabled") + } + + return cache.New(rs.Opts.cacheOpts, r.base.RepoRoot, apiClient, analyticsClient, func(_cache cache.Cache, err error) { // Currently the HTTP Cache is the only one that can be disabled. // With a cache system refactor, we might consider giving names to the caches so // we can accurately report them here. once.Do(func() { - r.base.LogWarning("Remote Caching is unavailable", err) + r.logWarning("Remote Caching is unavailable", err) }) }) } @@ -735,7 +762,7 @@ func (r *run) executeTasks(ctx gocontext.Context, g *completeGraph, rs *runSpec, turboCache, err := r.initCache(ctx, rs, analyticsClient) if err != nil { if errors.Is(err, cache.ErrNoCachesEnabled) { - r.base.LogWarning("No caches are enabled. You can try \"turbo login\", \"turbo link\", or ensuring you are not passing --remote-only to enable caching", nil) + r.logWarning("No caches are enabled. You can try \"turbo login\", \"turbo link\", or ensuring you are not passing --remote-only to enable caching", nil) } else { return errors.Wrap(err, "failed to set up caching") } @@ -847,7 +874,7 @@ func (r *run) executeDryRun(ctx gocontext.Context, engine *core.Scheduler, g *co if err != nil { if errors.Is(err, cache.ErrNoCachesEnabled) { - r.base.LogWarning("No caches are enabled. You can try \"turbo login\", \"turbo link\", or ensuring you are not passing --remote-only to enable caching", nil) + r.logWarning("No caches are enabled. You can try \"turbo login\", \"turbo link\", or ensuring you are not passing --remote-only to enable caching", nil) } else { return nil, errors.Wrap(err, "failed to set up caching") } From 919236b3be125f0e15469d57e61dfe9f0f50c5be Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Thu, 29 Sep 2022 14:23:41 -0700 Subject: [PATCH 07/11] Improve actual message --- cli/internal/run/run.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/internal/run/run.go b/cli/internal/run/run.go index 1552158c375fa..a0653fbe049e1 100644 --- a/cli/internal/run/run.go +++ b/cli/internal/run/run.go @@ -740,9 +740,9 @@ func (r *run) initCache(ctx gocontext.Context, rs *runSpec, analyticsClient anal useHTTPCache := !rs.Opts.cacheOpts.SkipRemote if useHTTPCache { - r.logInfo("• Remote computation caching enabled") + r.logInfo("• Remote caching enabled") } else { - r.logInfo("• Remote computation caching disabled") + r.logInfo("• Remote caching disabled") } return cache.New(rs.Opts.cacheOpts, r.base.RepoRoot, apiClient, analyticsClient, func(_cache cache.Cache, err error) { From 36dfe777239079dfcf33aaacb2aff9bd41414ae3 Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Thu, 29 Sep 2022 14:57:09 -0700 Subject: [PATCH 08/11] Simplify logInfo setup to always log Move log message so it is not invoked for dry runs --- cli/internal/cmd/auth/logout.go | 2 +- cli/internal/cmd/auth/unlink.go | 2 +- cli/internal/cmd/info/bin.go | 2 +- cli/internal/cmdutil/cmdutil.go | 19 +++++--------- cli/internal/login/login.go | 4 +-- cli/internal/prune/prune.go | 2 +- cli/internal/run/run.go | 45 ++++++++++----------------------- 7 files changed, 25 insertions(+), 51 deletions(-) diff --git a/cli/internal/cmd/auth/logout.go b/cli/internal/cmd/auth/logout.go index f2465f1d89800..6bae51d21ac54 100644 --- a/cli/internal/cmd/auth/logout.go +++ b/cli/internal/cmd/auth/logout.go @@ -20,7 +20,7 @@ func LogoutCmd(helper *cmdutil.Helper) *cobra.Command { return err } if err := base.UserConfig.Delete(); err != nil && !os.IsNotExist(err) { - base.LogError("could not logout. Something went wrong: %w", true, err) + base.LogError("could not logout. Something went wrong: %w", err) return err } diff --git a/cli/internal/cmd/auth/unlink.go b/cli/internal/cmd/auth/unlink.go index 167578f86ca02..d48e26e291e3e 100644 --- a/cli/internal/cmd/auth/unlink.go +++ b/cli/internal/cmd/auth/unlink.go @@ -18,7 +18,7 @@ func UnlinkCmd(helper *cmdutil.Helper) *cobra.Command { return err } if err := base.RepoConfig.Delete(); err != nil { - base.LogError("could not unlink. Something went wrong: %w", true, err) + base.LogError("could not unlink. Something went wrong: %w", err) return err } diff --git a/cli/internal/cmd/info/bin.go b/cli/internal/cmd/info/bin.go index fa91d650a80cd..5b83ce3d06638 100644 --- a/cli/internal/cmd/info/bin.go +++ b/cli/internal/cmd/info/bin.go @@ -20,7 +20,7 @@ func BinCmd(helper *cmdutil.Helper) *cobra.Command { } path, err := os.Executable() if err != nil { - base.LogError("could not get path to turbo binary: %w", true, err) + base.LogError("could not get path to turbo binary: %w", err) return err } diff --git a/cli/internal/cmdutil/cmdutil.go b/cli/internal/cmdutil/cmdutil.go index 5635d95a1c943..597a2a770e73e 100644 --- a/cli/internal/cmdutil/cmdutil.go +++ b/cli/internal/cmdutil/cmdutil.go @@ -216,32 +216,25 @@ type CmdBase struct { } // LogError prints an error to the UI -func (b *CmdBase) LogError(format string, shouldPrintToTerminal bool, args ...interface{}) { +func (b *CmdBase) LogError(format string, args ...interface{}) { err := fmt.Errorf(format, args...) b.Logger.Error("error", err) - - if shouldPrintToTerminal { - b.UI.Error(fmt.Sprintf("%s%s", ui.ERROR_PREFIX, color.RedString(" %v", err))) - } + b.UI.Error(fmt.Sprintf("%s%s", ui.ERROR_PREFIX, color.RedString(" %v", err))) } // LogWarning logs an error and outputs it to the UI. -func (b *CmdBase) LogWarning(prefix string, err error, shouldPrintToTerminal bool) { +func (b *CmdBase) LogWarning(prefix string, err error) { b.Logger.Warn(prefix, "warning", err) if prefix != "" { prefix = " " + prefix + ": " } - if shouldPrintToTerminal { - b.UI.Error(fmt.Sprintf("%s%s%s", ui.WARNING_PREFIX, prefix, color.YellowString(" %v", err))) - } + b.UI.Error(fmt.Sprintf("%s%s%s", ui.WARNING_PREFIX, prefix, color.YellowString(" %v", err))) } // LogInfo logs an message and outputs it to the UI. -func (b *CmdBase) LogInfo(msg string, shouldPrintToTerminal bool) { +func (b *CmdBase) LogInfo(msg string) { b.Logger.Info(msg) - if shouldPrintToTerminal { - b.UI.Info(fmt.Sprintf("%s%s", ui.INFO_PREFIX, color.WhiteString(" %v", msg))) - } + b.UI.Info(fmt.Sprintf("%s%s", ui.INFO_PREFIX, color.WhiteString(" %v", msg))) } diff --git a/cli/internal/login/login.go b/cli/internal/login/login.go index b03b56987ee40..e66d08dd09fbe 100644 --- a/cli/internal/login/login.go +++ b/cli/internal/login/login.go @@ -51,7 +51,7 @@ func NewLoginCommand(helper *cmdutil.Helper) *cobra.Command { } else if errors.Is(err, errTryAfterEnable) || errors.Is(err, errNeedCachingEnabled) || errors.Is(err, errOverage) { base.UI.Info("Remote Caching not enabled. Please run 'turbo login' again after Remote Caching has been enabled") } else { - base.LogError("SSO login failed: %v", true, err) + base.LogError("SSO login failed: %v", err) } return err } @@ -61,7 +61,7 @@ func NewLoginCommand(helper *cmdutil.Helper) *cobra.Command { if errors.Is(err, context.Canceled) { base.UI.Info("Canceled. Turborepo not set up.") } else { - base.LogError("login failed: %v", true, err) + base.LogError("login failed: %v", err) } return err } diff --git a/cli/internal/prune/prune.go b/cli/internal/prune/prune.go index 599cac1df07b3..1fca461d66fe8 100644 --- a/cli/internal/prune/prune.go +++ b/cli/internal/prune/prune.go @@ -53,7 +53,7 @@ func GetCmd(helper *cmdutil.Helper) *cobra.Command { } if opts.scope == "" { err := errors.New("at least one target must be specified") - base.LogError(err.Error(), true) + base.LogError(err.Error()) return err } p := &prune{ diff --git a/cli/internal/run/run.go b/cli/internal/run/run.go index a0653fbe049e1..c2caba7475d70 100644 --- a/cli/internal/run/run.go +++ b/cli/internal/run/run.go @@ -114,7 +114,7 @@ func GetCmd(helper *cmdutil.Helper, signalWatcher *signals.Watcher) *cobra.Comma run := configureRun(base, opts, signalWatcher) ctx := cmd.Context() if err := run.run(ctx, tasks); err != nil { - base.LogError("run failed: %v", true, err) + base.LogError("run failed: %v", err) return err } return nil @@ -173,24 +173,6 @@ type run struct { processes *process.Manager } -// logWarning logs an error and outputs it to the UI. -func (r *run) logError(prefix string, err error) { - shouldPrintToTerminal := !r.opts.runOpts.dryRun - r.base.LogError(prefix, shouldPrintToTerminal, err) -} - -// logWarning logs an error and outputs it to the UI. -func (r *run) logWarning(prefix string, err error) { - shouldPrintToTerminal := !r.opts.runOpts.dryRun - r.base.LogWarning(prefix, err, shouldPrintToTerminal) -} - -// logWarning logs an error and outputs it to the UI. -func (r *run) logInfo(msg string) { - shouldPrintToTerminal := !r.opts.runOpts.dryRun - r.base.LogInfo(msg, shouldPrintToTerminal) -} - func (r *run) run(ctx gocontext.Context, targets []string) error { startAt := time.Now() packageJSONPath := r.base.RepoRoot.UntypedJoin("package.json") @@ -220,7 +202,7 @@ func (r *run) run(ctx gocontext.Context, targets []string) error { } else if !r.opts.runOpts.noDaemon { turbodClient, err := daemon.GetClient(ctx, r.base.RepoRoot, r.base.Logger, r.base.TurboVersion, daemon.ClientOpts{}) if err != nil { - r.logWarning("", errors.Wrap(err, "failed to contact turbod. Continuing in standalone mode")) + r.base.LogWarning("", errors.Wrap(err, "failed to contact turbod. Continuing in standalone mode")) } else { defer func() { _ = turbodClient.Close() }() r.base.Logger.Debug("running in daemon mode") @@ -241,7 +223,7 @@ func (r *run) run(ctx gocontext.Context, targets []string) error { scmInstance, err := scm.FromInRepo(r.base.RepoRoot.ToStringDuringMigration()) if err != nil { if errors.Is(err, scm.ErrFallback) { - r.logWarning("", err) + r.base.LogWarning("", err) } else { return errors.Wrap(err, "failed to create SCM") } @@ -736,21 +718,13 @@ func (r *run) initCache(ctx gocontext.Context, rs *runSpec, analyticsClient anal apiClient := r.base.APIClient // Theoretically this is overkill, but bias towards not spamming the console once := &sync.Once{} - // rs.Opts.runOpts - - useHTTPCache := !rs.Opts.cacheOpts.SkipRemote - if useHTTPCache { - r.logInfo("• Remote caching enabled") - } else { - r.logInfo("• Remote caching disabled") - } return cache.New(rs.Opts.cacheOpts, r.base.RepoRoot, apiClient, analyticsClient, func(_cache cache.Cache, err error) { // Currently the HTTP Cache is the only one that can be disabled. // With a cache system refactor, we might consider giving names to the caches so // we can accurately report them here. once.Do(func() { - r.logWarning("Remote Caching is unavailable", err) + r.base.LogWarning("Remote Caching is unavailable", err) }) }) } @@ -759,10 +733,17 @@ func (r *run) executeTasks(ctx gocontext.Context, g *completeGraph, rs *runSpec, analyticsClient := r.initAnalyticsClient(ctx) defer analyticsClient.CloseWithTimeout(50 * time.Millisecond) + useHTTPCache := !rs.Opts.cacheOpts.SkipRemote + if useHTTPCache { + r.base.LogInfo("• Remote caching enabled") + } else { + r.base.LogInfo("• Remote caching disabled") + } + turboCache, err := r.initCache(ctx, rs, analyticsClient) if err != nil { if errors.Is(err, cache.ErrNoCachesEnabled) { - r.logWarning("No caches are enabled. You can try \"turbo login\", \"turbo link\", or ensuring you are not passing --remote-only to enable caching", nil) + r.base.LogWarning("No caches are enabled. You can try \"turbo login\", \"turbo link\", or ensuring you are not passing --remote-only to enable caching", nil) } else { return errors.Wrap(err, "failed to set up caching") } @@ -874,7 +855,7 @@ func (r *run) executeDryRun(ctx gocontext.Context, engine *core.Scheduler, g *co if err != nil { if errors.Is(err, cache.ErrNoCachesEnabled) { - r.logWarning("No caches are enabled. You can try \"turbo login\", \"turbo link\", or ensuring you are not passing --remote-only to enable caching", nil) + r.base.LogWarning("No caches are enabled. You can try \"turbo login\", \"turbo link\", or ensuring you are not passing --remote-only to enable caching", nil) } else { return nil, errors.Wrap(err, "failed to set up caching") } From a3130f00276034073eeb35da3690912f8810baa1 Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Thu, 29 Sep 2022 15:10:22 -0700 Subject: [PATCH 09/11] Fix up lint error --- cli/internal/cmdutil/cmdutil.go | 2 +- cli/internal/ui/ui.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/cli/internal/cmdutil/cmdutil.go b/cli/internal/cmdutil/cmdutil.go index 597a2a770e73e..bc01c6ae94dcc 100644 --- a/cli/internal/cmdutil/cmdutil.go +++ b/cli/internal/cmdutil/cmdutil.go @@ -236,5 +236,5 @@ func (b *CmdBase) LogWarning(prefix string, err error) { // LogInfo logs an message and outputs it to the UI. func (b *CmdBase) LogInfo(msg string) { b.Logger.Info(msg) - b.UI.Info(fmt.Sprintf("%s%s", ui.INFO_PREFIX, color.WhiteString(" %v", msg))) + b.UI.Info(fmt.Sprintf("%s%s", ui.InfoPrefix, color.WhiteString(" %v", msg))) } diff --git a/cli/internal/ui/ui.go b/cli/internal/ui/ui.go index 78949d512dd60..8538754a7a5ab 100644 --- a/cli/internal/ui/ui.go +++ b/cli/internal/ui/ui.go @@ -24,7 +24,9 @@ var gray = color.New(color.Faint) var bold = color.New(color.Bold) var ERROR_PREFIX = color.New(color.Bold, color.FgRed, color.ReverseVideo).Sprint(" ERROR ") var WARNING_PREFIX = color.New(color.Bold, color.FgYellow, color.ReverseVideo).Sprint(" WARNING ") -var INFO_PREFIX = color.New(color.Bold, color.FgWhite, color.ReverseVideo).Sprint(" INFO ") + +// InfoPrefix is a colored string for warning level log messages +var InfoPrefix = color.New(color.Bold, color.FgWhite, color.ReverseVideo).Sprint(" INFO ") var ansiRegex = regexp.MustCompile(ansiEscapeStr) From 6ed692079f4352da577d51b7fc1907fc256256fc Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Thu, 29 Sep 2022 15:13:05 -0700 Subject: [PATCH 10/11] Ignore err output files from integration tests --- cli/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/cli/.gitignore b/cli/.gitignore index bf77320b1a0ff..f2929414b9bc2 100644 --- a/cli/.gitignore +++ b/cli/.gitignore @@ -12,3 +12,4 @@ /scripts/turbo-* /.cram_env testbed +integration_tests/**/*.t.err From 58cdc07c0a507e4f258cb3526c613ce035148b92 Mon Sep 17 00:00:00 2001 From: Mehul Kar Date: Thu, 29 Sep 2022 15:22:48 -0700 Subject: [PATCH 11/11] Fix integration tests --- cli/integration_tests/single_package/run.t | 4 +++- cli/integration_tests/single_package_deps/run.t | 4 +++- cli/integration_tests/single_package_no_config/run.t | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cli/integration_tests/single_package/run.t b/cli/integration_tests/single_package/run.t index 644556a279ab0..d496e69abbbda 100644 --- a/cli/integration_tests/single_package/run.t +++ b/cli/integration_tests/single_package/run.t @@ -5,6 +5,7 @@ Setup Check $ ${TURBO} run build --single-package \xe2\x80\xa2 Running build (esc) + INFO \xe2\x80\xa2 Remote caching disabled (esc) build: cache miss, executing e491d0044f4b9b90 build: build: > build @@ -18,6 +19,7 @@ Check Run a second time, verify caching works because there is a config $ ${TURBO} run build --single-package \xe2\x80\xa2 Running build (esc) + INFO \xe2\x80\xa2 Remote caching disabled (esc) build: cache hit, replaying output e491d0044f4b9b90 build: build: > build @@ -27,4 +29,4 @@ Run a second time, verify caching works because there is a config Tasks: 1 successful, 1 total Cached: 1 cached, 1 total Time:\s*[\.0-9]+m?s >>> FULL TURBO (re) - + \ No newline at end of file diff --git a/cli/integration_tests/single_package_deps/run.t b/cli/integration_tests/single_package_deps/run.t index 461b49ca54f8e..a1cf1fd7f5a0b 100644 --- a/cli/integration_tests/single_package_deps/run.t +++ b/cli/integration_tests/single_package_deps/run.t @@ -5,6 +5,7 @@ Setup Check $ ${TURBO} run test --single-package \xe2\x80\xa2 Running test (esc) + INFO \xe2\x80\xa2 Remote caching disabled (esc) build: cache miss, executing 6218abb18f5176f5 build: build: > build @@ -23,6 +24,7 @@ Check Run a second time, verify caching works because there is a config $ ${TURBO} run test --single-package \xe2\x80\xa2 Running test (esc) + INFO \xe2\x80\xa2 Remote caching disabled (esc) build: cache hit, replaying output 6218abb18f5176f5 build: build: > build @@ -37,4 +39,4 @@ Run a second time, verify caching works because there is a config Tasks: 2 successful, 2 total Cached: 2 cached, 2 total Time:\s*[\.0-9]+m?s >>> FULL TURBO (re) - + \ No newline at end of file diff --git a/cli/integration_tests/single_package_no_config/run.t b/cli/integration_tests/single_package_no_config/run.t index 1d12cc404996f..b0abe5a03e547 100644 --- a/cli/integration_tests/single_package_no_config/run.t +++ b/cli/integration_tests/single_package_no_config/run.t @@ -5,6 +5,7 @@ Setup Check $ ${TURBO} run build --single-package \xe2\x80\xa2 Running build (esc) + INFO \xe2\x80\xa2 Remote caching disabled (esc) build: cache bypass, force executing c207d64157b1635a build: build: > build @@ -19,6 +20,7 @@ Check Run a second time, verify no caching because there is no config $ ${TURBO} run build --single-package \xe2\x80\xa2 Running build (esc) + INFO \xe2\x80\xa2 Remote caching disabled (esc) build: cache bypass, force executing c207d64157b1635a build: build: > build @@ -29,4 +31,4 @@ Run a second time, verify no caching because there is no config Tasks: 1 successful, 1 total Cached: 0 cached, 1 total Time:\s*[\.0-9]+m?s (re) - + \ No newline at end of file