Do generates all the resources associated with a workspace build. Template and TemplateVersion will be optionally populated if no TemplateID is set on the provided workspace. Workspace will be optionally populated if no ID is set on the provided workspace.
()
| 279 | // Workspace will be optionally populated if no ID is set on the provided |
| 280 | // workspace. |
| 281 | func (b WorkspaceBuildBuilder) Do() WorkspaceResponse { |
| 282 | var resp WorkspaceResponse |
| 283 | // Use transaction, like real wsbuilder. |
| 284 | err := b.db.InTx(func(tx database.Store) error { |
| 285 | //nolint:revive // calls do on modified struct |
| 286 | b.db = tx |
| 287 | resp = b.doInTX() // intxcheck:ignore // b.db is reassigned to tx on the line above |
| 288 | return nil |
| 289 | }, nil) |
| 290 | require.NoError(b.t, err) |
| 291 | return resp |
| 292 | } |
| 293 | |
| 294 | func (b WorkspaceBuildBuilder) doInTX() WorkspaceResponse { |
| 295 | b.t.Helper() |