Skip to content

feat(cli): prevent coder schedule command on prebuilt workspaces #19259

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 13, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: update 'schedule extend' command to error in case of prebuild
  • Loading branch information
ssncferreira committed Aug 12, 2025
commit c5853a0bb96eb09d1f5ddfa5447476d4559d4648
9 changes: 8 additions & 1 deletion cli/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ When enabling scheduled stop, enter a duration in one of the following formats:
* 2m (2 minutes)
* 2 (2 minutes)
`
scheduleExtendDescriptionLong = `
scheduleExtendDescriptionLong = `Extends the workspace deadline.
* The new stop time is calculated from *now*.
* The new stop time must be at least 30 minutes in the future.
* The workspace template may restrict the maximum workspace runtime.
Expand Down Expand Up @@ -269,6 +269,13 @@ func (r *RootCmd) scheduleExtend() *serpent.Command {
return xerrors.Errorf("get workspace: %w", err)
}

// Deadline extensions are not supported for prebuilt workspaces.
// Prebuild lifecycle is managed by the reconciliation loop, with TTL behavior
// defined per preset at the template level, not per workspace.
if workspace.IsPrebuild {
return xerrors.Errorf("extend configuration is not supported for prebuilt workspaces")
}

loc, err := tz.TimezoneIANA()
if err != nil {
loc = time.UTC // best effort
Expand Down