- Notifications
You must be signed in to change notification settings - Fork1k
Commitb975d6d
authored
feat(cli): add CLI support for creating a workspace with preset (#18912)
## Description This PR introduces a `--preset` flag for the `create` command to allowusers to apply a predefined preset to their workspace build.## Changes- The `--preset` flag on the `create` command integrates with theparameter resolution logic and takes precedence over other sources(e.g., CLI/env vars, last build, etc.).- Added internal logic to ensure that preset parameters overrideparameters values during resolution.- Updated tests and added new ones to cover these flows.## Implementation logic* If a template has presets and includes a default, the CLI willautomatically use the default when `--preset` is not specified.* If a template has presets but no default, the CLI will prompt the userto select one when `--preset` is not specified.* If a template does not have presets, the CLI will not prompt the userfor a preset.* If the user specifies a preset using the `--preset` flag, that presetwill be used.* If the user passes `--preset None`, no preset will be applied.This logic aligns with the behavior in the UI for consistency.```> coder create --helpUSAGE: coder create [flags] [workspace] Create a workspace - Create a workspace for another user (if you have permission): $ coder create <username>/<workspace_name>OPTIONS: (...) --preset string, $CODER_PRESET_NAME Specify the name of a template version preset. Use 'none' to explicitly indicate that no preset should be used. (...) -y, --yes bool Bypass prompts.```## Breaking change**Note:** This is a breaking change to the create CLI command. If atemplate includes presets and the user does not provide a `--preset`flag, the CLI will now prompt the user to select one. This behavior maybreak non-interactive scripts or automated workflows.Relates to PR:#18910 - pleaseconsider both PRs together as they’re part of the same workflowRelates to issue:#165941 parent66cf90c commitb975d6d
File tree
7 files changed
+1197
-3
lines changed- cli
- testdata
- docs/reference/cli
- enterprise/cli
7 files changed
+1197
-3
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2 | 2 |
| |
3 | 3 |
| |
4 | 4 |
| |
| 5 | + | |
5 | 6 |
| |
6 | 7 |
| |
7 | 8 |
| |
| |||
21 | 22 |
| |
22 | 23 |
| |
23 | 24 |
| |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
24 | 32 |
| |
25 | 33 |
| |
26 | 34 |
| |
27 | 35 |
| |
| 36 | + | |
28 | 37 |
| |
29 | 38 |
| |
30 | 39 |
| |
| |||
263 | 272 |
| |
264 | 273 |
| |
265 | 274 |
| |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
266 | 308 |
| |
267 | 309 |
| |
268 | 310 |
| |
269 | 311 |
| |
270 | 312 |
| |
| 313 | + | |
271 | 314 |
| |
272 | 315 |
| |
273 | 316 |
| |
| |||
291 | 334 |
| |
292 | 335 |
| |
293 | 336 |
| |
294 |
| - | |
| 337 | + | |
295 | 338 |
| |
296 | 339 |
| |
297 | 340 |
| |
298 | 341 |
| |
299 | 342 |
| |
300 | 343 |
| |
301 |
| - | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
302 | 352 |
| |
303 | 353 |
| |
304 | 354 |
| |
| |||
333 | 383 |
| |
334 | 384 |
| |
335 | 385 |
| |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
336 | 392 |
| |
337 | 393 |
| |
338 | 394 |
| |
| |||
377 | 433 |
| |
378 | 434 |
| |
379 | 435 |
| |
| 436 | + | |
380 | 437 |
| |
381 | 438 |
| |
382 | 439 |
| |
383 | 440 |
| |
384 | 441 |
| |
385 | 442 |
| |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
386 | 506 |
| |
387 | 507 |
| |
388 | 508 |
| |
| |||
411 | 531 |
| |
412 | 532 |
| |
413 | 533 |
| |
| 534 | + | |
414 | 535 |
| |
415 | 536 |
| |
416 | 537 |
| |
|
0 commit comments
Comments
(0)