Cleanup implements Cleanable.
(ctx context.Context, id string, logs io.Writer)
| 159 | |
| 160 | // Cleanup implements Cleanable. |
| 161 | func (r *Runner) Cleanup(ctx context.Context, id string, logs io.Writer) error { |
| 162 | if r.cfg.NoCleanup { |
| 163 | _, _ = fmt.Fprintln(logs, "skipping cleanup") |
| 164 | return nil |
| 165 | } |
| 166 | |
| 167 | if r.workspacebuildRunner != nil { |
| 168 | err := r.workspacebuildRunner.Cleanup(ctx, id, logs) |
| 169 | if err != nil { |
| 170 | return xerrors.Errorf("cleanup workspace: %w", err) |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | if r.createUserRunner != nil { |
| 175 | err := r.createUserRunner.Cleanup(ctx, id, logs) |
| 176 | if err != nil { |
| 177 | return xerrors.Errorf("cleanup user: %w", err) |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | return nil |
| 182 | } |