mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat: allow bumping workspace deadline (#1828)
* Adds a `bump` command to extend workspace build deadline
* Reduces WARN-level logging spam from autobuild executor
* Modifies `cli/ssh` notifications to read from workspace build deadline and to notify relative time instead (sidestepping the problem of figuring out a user's timezone across multiple OSes)
* Shows workspace extension time in `coder list` output e.g.
```
WORKSPACE TEMPLATE STATUS LAST BUILT OUTDATED AUTOSTART TTL
developer/test1 docker Running 4m false 0 9 * * MON-FRI 15m (+5m)
```
This commit is contained in:
@@ -88,7 +88,7 @@ func (e *Executor) runOnce(t time.Time) error {
|
||||
}
|
||||
|
||||
if !priorJob.CompletedAt.Valid || priorJob.Error.String != "" {
|
||||
e.log.Warn(e.ctx, "last workspace build did not complete successfully, skipping",
|
||||
e.log.Debug(e.ctx, "last workspace build did not complete successfully, skipping",
|
||||
slog.F("workspace_id", ws.ID),
|
||||
slog.F("error", priorJob.Error.String),
|
||||
)
|
||||
@@ -107,13 +107,14 @@ func (e *Executor) runOnce(t time.Time) error {
|
||||
)
|
||||
continue
|
||||
}
|
||||
// Truncate to nearest minute for consistency with autostart behavior
|
||||
nextTransition = priorHistory.Deadline.Truncate(time.Minute)
|
||||
// For stopping, do not truncate. This is inconsistent with autostart, but
|
||||
// it ensures we will not stop too early.
|
||||
nextTransition = priorHistory.Deadline
|
||||
case database.WorkspaceTransitionStop:
|
||||
validTransition = database.WorkspaceTransitionStart
|
||||
sched, err := schedule.Weekly(ws.AutostartSchedule.String)
|
||||
if err != nil {
|
||||
e.log.Warn(e.ctx, "workspace has invalid autostart schedule, skipping",
|
||||
e.log.Debug(e.ctx, "workspace has invalid autostart schedule, skipping",
|
||||
slog.F("workspace_id", ws.ID),
|
||||
slog.F("autostart_schedule", ws.AutostartSchedule.String),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user