diff --git a/internal/runbits/runtime/runtime.go b/internal/runbits/runtime/runtime.go index ef29af90e8..4a49408794 100644 --- a/internal/runbits/runtime/runtime.go +++ b/internal/runbits/runtime/runtime.go @@ -44,6 +44,7 @@ type Opts struct { CommitID strfmt.UUID Commit *bpModel.Commit ValidateBuildscript bool + NoAsync bool } type SetOpt func(*Opts) @@ -80,6 +81,12 @@ func WithoutBuildscriptValidation() SetOpt { } } +func WithoutAsync() SetOpt { + return func(opts *Opts) { + opts.NoAsync = true + } +} + type primeable interface { primer.Projecter primer.Auther @@ -204,7 +211,7 @@ func Update( // Async runtimes should still do everything up to the actual update itself, because we still want to raise // any errors regarding solves, buildscripts, etc. - if prime.Config().GetBool(constants.AsyncRuntimeConfig) { + if prime.Config().GetBool(constants.AsyncRuntimeConfig) && !opts.NoAsync { logging.Debug("Skipping runtime update due to async runtime") return rt, nil } diff --git a/internal/runners/activate/activate.go b/internal/runners/activate/activate.go index cae617162d..d38751ceba 100644 --- a/internal/runners/activate/activate.go +++ b/internal/runners/activate/activate.go @@ -176,7 +176,7 @@ func (r *Activate) Run(params *ActivateParams) (rerr error) { } } - rt, err := runtime_runbit.Update(r.prime, trigger.TriggerActivate, runtime_runbit.WithoutHeaders()) + rt, err := runtime_runbit.Update(r.prime, trigger.TriggerActivate, runtime_runbit.WithoutHeaders(), runtime_runbit.WithoutAsync()) if err != nil { return locale.WrapError(err, "err_could_not_activate_venv", "Could not activate project") } diff --git a/internal/runners/deploy/deploy.go b/internal/runners/deploy/deploy.go index 69613845ae..dea3b67ff8 100644 --- a/internal/runners/deploy/deploy.go +++ b/internal/runners/deploy/deploy.go @@ -182,7 +182,7 @@ func (d *Deploy) install(params *Params, commitID strfmt.UUID) (rerr error) { pg := progress.NewRuntimeProgressIndicator(d.output) defer rtutils.Closer(pg.Close, &rerr) - if _, err := runtime_runbit.Update(d.prime, trigger.TriggerDeploy, runtime_runbit.WithTargetDir(params.Path)); err != nil { + if _, err := runtime_runbit.Update(d.prime, trigger.TriggerDeploy, runtime_runbit.WithTargetDir(params.Path), runtime_runbit.WithoutAsync()); err != nil { return locale.WrapError(err, "err_deploy_runtime_err", "Could not initialize runtime") } diff --git a/internal/runners/exec/exec.go b/internal/runners/exec/exec.go index 6a307f232d..bfca96a1cb 100644 --- a/internal/runners/exec/exec.go +++ b/internal/runners/exec/exec.go @@ -125,7 +125,7 @@ func (s *Exec) Run(params *Params, args ...string) (rerr error) { s.out.Notice(locale.Tr("operating_message", projectNamespace, projectDir)) - rt, err := runtime_runbit.Update(s.prime, trigger, runtime_runbit.WithoutHeaders()) + rt, err := runtime_runbit.Update(s.prime, trigger, runtime_runbit.WithoutHeaders(), runtime_runbit.WithoutAsync()) if err != nil { return errs.Wrap(err, "Could not initialize runtime") } diff --git a/internal/runners/refresh/refresh.go b/internal/runners/refresh/refresh.go index f57c3e9275..4de7699c58 100644 --- a/internal/runners/refresh/refresh.go +++ b/internal/runners/refresh/refresh.go @@ -83,7 +83,7 @@ func (r *Refresh) Run(params *Params) error { return locale.NewInputError("refresh_runtime_uptodate") } - rti, err := runtime_runbit.Update(r.prime, trigger.TriggerRefresh, runtime_runbit.WithoutHeaders()) + rti, err := runtime_runbit.Update(r.prime, trigger.TriggerRefresh, runtime_runbit.WithoutHeaders(), runtime_runbit.WithoutAsync()) if err != nil { return locale.WrapError(err, "err_refresh_runtime_new", "Could not update runtime for this project.") } diff --git a/internal/runners/shell/shell.go b/internal/runners/shell/shell.go index 4a8cbe7d85..53978498da 100644 --- a/internal/runners/shell/shell.go +++ b/internal/runners/shell/shell.go @@ -91,7 +91,7 @@ func (u *Shell) Run(params *Params) error { return locale.NewInputError("err_shell_commit_id_mismatch") } - rti, err := runtime_runbit.Update(u.prime, trigger.TriggerShell, runtime_runbit.WithoutHeaders()) + rti, err := runtime_runbit.Update(u.prime, trigger.TriggerShell, runtime_runbit.WithoutHeaders(), runtime_runbit.WithoutAsync()) if err != nil { return locale.WrapExternalError(err, "err_shell_runtime_new", "Could not start a shell/prompt for this project.") } diff --git a/internal/runners/use/use.go b/internal/runners/use/use.go index 1169a16deb..c005bb7bfc 100644 --- a/internal/runners/use/use.go +++ b/internal/runners/use/use.go @@ -90,7 +90,7 @@ func (u *Use) Run(params *Params) error { return locale.NewInputError("err_use_commit_id_mismatch") } - rti, err := runtime_runbit.Update(u.prime, trigger.TriggerUse, runtime_runbit.WithoutHeaders()) + rti, err := runtime_runbit.Update(u.prime, trigger.TriggerUse, runtime_runbit.WithoutHeaders(), runtime_runbit.WithoutAsync()) if err != nil { return locale.WrapError(err, "err_use_runtime_new", "Cannot use this project.") } diff --git a/internal/scriptrun/scriptrun.go b/internal/scriptrun/scriptrun.go index 12f94c17c9..129bedbd84 100644 --- a/internal/scriptrun/scriptrun.go +++ b/internal/scriptrun/scriptrun.go @@ -82,7 +82,7 @@ func (s *ScriptRun) NeedsActivation() bool { // PrepareVirtualEnv sets up the relevant runtime and prepares the environment. func (s *ScriptRun) PrepareVirtualEnv() (rerr error) { - rt, err := runtime_runbit.Update(s.prime, trigger.TriggerScript, runtime_runbit.WithoutHeaders()) + rt, err := runtime_runbit.Update(s.prime, trigger.TriggerScript, runtime_runbit.WithoutHeaders(), runtime_runbit.WithoutAsync()) if err != nil { return locale.WrapError(err, "err_activate_runtime", "Could not initialize a runtime for this project.") }