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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
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
14 changes: 14 additions & 0 deletions cli/schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,13 @@ func (r *RootCmd) scheduleStart() *serpent.Command {
return err
}

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

var schedStr *string
if inv.Args[1] != "manual" {
sched, err := parseCLISchedule(inv.Args[1:]...)
Expand Down Expand Up @@ -205,6 +212,13 @@ func (r *RootCmd) scheduleStop() *serpent.Command {
return err
}

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

var durMillis *int64
if inv.Args[1] != "manual" {
dur, err := parseDuration(inv.Args[1])
Expand Down
Loading