Skip to content

Commit d2a3519

Browse files
authored
Merge pull request ActiveState#3495 from ActiveState/mitchell/dx-3054
Add ability for runners to ignore async runtimes.
2 parents 56a1cb4 + 6c14a81 commit d2a3519

File tree

9 files changed

+16
-9
lines changed

9 files changed

+16
-9
lines changed

internal/runbits/runtime/runtime.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ type Opts struct {
4949
Archive *checkout.Archive
5050

5151
ValidateBuildscript bool
52+
IgnoreAsync bool
5253
}
5354

5455
type SetOpt func(*Opts)
@@ -91,6 +92,12 @@ func WithArchive(archive *checkout.Archive) SetOpt {
9192
}
9293
}
9394

95+
func WithIgnoreAsync() SetOpt {
96+
return func(opts *Opts) {
97+
opts.IgnoreAsync = true
98+
}
99+
}
100+
94101
type primeable interface {
95102
primer.Projecter
96103
primer.Auther
@@ -216,7 +223,7 @@ func Update(
216223

217224
// Async runtimes should still do everything up to the actual update itself, because we still want to raise
218225
// any errors regarding solves, buildscripts, etc.
219-
if prime.Config().GetBool(constants.AsyncRuntimeConfig) {
226+
if prime.Config().GetBool(constants.AsyncRuntimeConfig) && !opts.IgnoreAsync {
220227
logging.Debug("Skipping runtime update due to async runtime")
221228
return rt, nil
222229
}

internal/runners/activate/activate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ func (r *Activate) Run(params *ActivateParams) (rerr error) {
176176
}
177177
}
178178

179-
rt, err := runtime_runbit.Update(r.prime, trigger.TriggerActivate, runtime_runbit.WithoutHeaders())
179+
rt, err := runtime_runbit.Update(r.prime, trigger.TriggerActivate, runtime_runbit.WithoutHeaders(), runtime_runbit.WithIgnoreAsync())
180180
if err != nil {
181181
return locale.WrapError(err, "err_could_not_activate_venv", "Could not activate project")
182182
}

internal/runners/deploy/deploy.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func (d *Deploy) install(params *Params, commitID strfmt.UUID) (rerr error) {
182182
pg := progress.NewRuntimeProgressIndicator(d.output)
183183
defer rtutils.Closer(pg.Close, &rerr)
184184

185-
if _, err := runtime_runbit.Update(d.prime, trigger.TriggerDeploy, runtime_runbit.WithTargetDir(params.Path)); err != nil {
185+
if _, err := runtime_runbit.Update(d.prime, trigger.TriggerDeploy, runtime_runbit.WithTargetDir(params.Path), runtime_runbit.WithIgnoreAsync()); err != nil {
186186
return locale.WrapError(err, "err_deploy_runtime_err", "Could not initialize runtime")
187187
}
188188

internal/runners/export/env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (e *Env) Run() error {
4747
e.project.Dir()),
4848
)
4949

50-
rt, err := runtime_runbit.Update(e.prime, trigger.TriggerActivate, runtime_runbit.WithoutHeaders())
50+
rt, err := runtime_runbit.Update(e.prime, trigger.TriggerActivate, runtime_runbit.WithoutHeaders(), runtime_runbit.WithIgnoreAsync())
5151
if err != nil {
5252
return locale.WrapError(err, "err_export_new_runtime", "Could not initialize runtime")
5353
}

internal/runners/refresh/refresh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (r *Refresh) Run(params *Params) error {
8686
return locale.NewInputError("refresh_runtime_uptodate")
8787
}
8888

89-
rti, err := runtime_runbit.Update(r.prime, trigger.TriggerRefresh, runtime_runbit.WithoutHeaders())
89+
rti, err := runtime_runbit.Update(r.prime, trigger.TriggerRefresh, runtime_runbit.WithoutHeaders(), runtime_runbit.WithIgnoreAsync())
9090
if err != nil {
9191
return locale.WrapError(err, "err_refresh_runtime_new", "Could not update runtime for this project.")
9292
}

internal/runners/shell/shell.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func (u *Shell) Run(params *Params) error {
9393
return locale.NewInputError("err_shell_commit_id_mismatch")
9494
}
9595

96-
rti, err := runtime_runbit.Update(u.prime, trigger.TriggerShell, runtime_runbit.WithoutHeaders())
96+
rti, err := runtime_runbit.Update(u.prime, trigger.TriggerShell, runtime_runbit.WithoutHeaders(), runtime_runbit.WithIgnoreAsync())
9797
if err != nil {
9898
return locale.WrapExternalError(err, "err_shell_runtime_new", "Could not start a shell/prompt for this project.")
9999
}

internal/runners/use/use.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (u *Use) Run(params *Params) error {
9090
return locale.NewInputError("err_use_commit_id_mismatch")
9191
}
9292

93-
rti, err := runtime_runbit.Update(u.prime, trigger.TriggerUse, runtime_runbit.WithoutHeaders())
93+
rti, err := runtime_runbit.Update(u.prime, trigger.TriggerUse, runtime_runbit.WithoutHeaders(), runtime_runbit.WithIgnoreAsync())
9494
if err != nil {
9595
return locale.WrapError(err, "err_use_runtime_new", "Cannot use this project.")
9696
}

internal/scriptrun/scriptrun.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (s *ScriptRun) NeedsActivation() bool {
8282

8383
// PrepareVirtualEnv sets up the relevant runtime and prepares the environment.
8484
func (s *ScriptRun) PrepareVirtualEnv() (rerr error) {
85-
rt, err := runtime_runbit.Update(s.prime, trigger.TriggerScript, runtime_runbit.WithoutHeaders())
85+
rt, err := runtime_runbit.Update(s.prime, trigger.TriggerScript, runtime_runbit.WithoutHeaders(), runtime_runbit.WithIgnoreAsync())
8686
if err != nil {
8787
return locale.WrapError(err, "err_activate_runtime", "Could not initialize a runtime for this project.")
8888
}

test/integration/shell_int_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ func (suite *ShellIntegrationTestSuite) TestScriptAlias() {
441441
defer ts.Close()
442442

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

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

0 commit comments

Comments
 (0)