Skip to content

Commit

Permalink
Merge branch version/0-46-0-RC1 to adopt changes from PR #3495
Browse files Browse the repository at this point in the history
  • Loading branch information
as-builds committed Sep 18, 2024
2 parents 42309b3 + d2a3519 commit a350786
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 9 deletions.
9 changes: 8 additions & 1 deletion internal/runbits/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type Opts struct {
Archive *checkout.Archive

ValidateBuildscript bool
IgnoreAsync bool
}

type SetOpt func(*Opts)
Expand Down Expand Up @@ -91,6 +92,12 @@ func WithArchive(archive *checkout.Archive) SetOpt {
}
}

func WithIgnoreAsync() SetOpt {
return func(opts *Opts) {
opts.IgnoreAsync = true
}
}

type primeable interface {
primer.Projecter
primer.Auther
Expand Down Expand Up @@ -216,7 +223,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.IgnoreAsync {
logging.Debug("Skipping runtime update due to async runtime")
return rt, nil
}
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/activate/activate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.WithIgnoreAsync())
if err != nil {
return locale.WrapError(err, "err_could_not_activate_venv", "Could not activate project")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/deploy/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.WithIgnoreAsync()); err != nil {
return locale.WrapError(err, "err_deploy_runtime_err", "Could not initialize runtime")
}

Expand Down
2 changes: 1 addition & 1 deletion internal/runners/export/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (e *Env) Run() error {
e.project.Dir()),
)

rt, err := runtime_runbit.Update(e.prime, trigger.TriggerActivate, runtime_runbit.WithoutHeaders())
rt, err := runtime_runbit.Update(e.prime, trigger.TriggerActivate, runtime_runbit.WithoutHeaders(), runtime_runbit.WithIgnoreAsync())
if err != nil {
return locale.WrapError(err, "err_export_new_runtime", "Could not initialize runtime")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/refresh/refresh.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,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.WithIgnoreAsync())
if err != nil {
return locale.WrapError(err, "err_refresh_runtime_new", "Could not update runtime for this project.")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/shell/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,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.WithIgnoreAsync())
if err != nil {
return locale.WrapExternalError(err, "err_shell_runtime_new", "Could not start a shell/prompt for this project.")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/runners/use/use.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.WithIgnoreAsync())
if err != nil {
return locale.WrapError(err, "err_use_runtime_new", "Cannot use this project.")
}
Expand Down
2 changes: 1 addition & 1 deletion internal/scriptrun/scriptrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.WithIgnoreAsync())
if err != nil {
return locale.WrapError(err, "err_activate_runtime", "Could not initialize a runtime for this project.")
}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/shell_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ func (suite *ShellIntegrationTestSuite) TestScriptAlias() {
defer ts.Close()

cp := ts.Spawn("checkout", "ActiveState-CLI/Perl-5.32", ".")
cp.Expect("Checked out project")
cp.Expect("Checked out project", e2e.RuntimeSourcingTimeoutOpt)
cp.ExpectExitCode(0)

suite.NoError(fileutils.WriteFile(filepath.Join(ts.Dirs.Work, "testargs.pl"), []byte(`
Expand Down

0 comments on commit a350786

Please sign in to comment.