pushEmptyTemplateVersion pushes a new empty template version (no presets, no prebuilds) and makes it active. This stops the reconciler from spawning new prebuild workspaces for the template.
(ctx context.Context)
| 384 | // prebuilds) and makes it active. This stops the reconciler from spawning new |
| 385 | // prebuild workspaces for the template. |
| 386 | func (r *Runner) pushEmptyTemplateVersion(ctx context.Context) error { |
| 387 | emptyVersion, err := r.createTemplateVersion(ctx, r.template.ID, 0, 0) |
| 388 | if err != nil { |
| 389 | return xerrors.Errorf("create empty template version: %w", err) |
| 390 | } |
| 391 | if err = r.client.UpdateActiveTemplateVersion(ctx, r.template.ID, codersdk.UpdateActiveTemplateVersion{ |
| 392 | ID: emptyVersion.ID, |
| 393 | }); err != nil { |
| 394 | return xerrors.Errorf("update active template version: %w", err) |
| 395 | } |
| 396 | return nil |
| 397 | } |
| 398 | |
| 399 | func (r *Runner) Cleanup(ctx context.Context, _ string, logs io.Writer) error { |
| 400 | logs = loadtestutil.NewSyncWriter(logs) |
no test coverage detected