Skip to content

Commit 7240300

Browse files
committed
Merge branch 'main' of github.com:coder/coder into spike/1375_in_proc_provisionerd_comms
2 parents 7b2e5df + 3be3560 commit 7240300

File tree

62 files changed

+2030
-892
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+2030
-892
lines changed

.vscode/settings.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"cSpell.words": [
3+
"buildname",
34
"circbuf",
45
"cliflag",
56
"cliui",
@@ -55,6 +56,7 @@
5556
"TCGETS",
5657
"tcpip",
5758
"TCSETS",
59+
"testid",
5860
"tfexec",
5961
"tfjson",
6062
"tfstate",
@@ -76,7 +78,7 @@
7678
},
7779
{
7880
"match": "provisionerd/proto/provisionerd.proto",
79-
"cmd": "make provisionerd/proto/provisionerd.pb.go",
81+
"cmd": "make provisionerd/proto/provisionerd.pb.go"
8082
}
8183
]
8284
},
@@ -104,5 +106,5 @@
104106
},
105107
// We often use a version of TypeScript that's ahead of the version shipped
106108
// with VS Code.
107-
"typescript.tsdk": "./site/node_modules/typescript/lib",
109+
"typescript.tsdk": "./site/node_modules/typescript/lib"
108110
}

agent/usershell/usershell_darwin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ package usershell
33
import "os"
44

55
// Get returns the $SHELL environment variable.
6-
func Get(username string) (string, error) {
6+
func Get(_ string) (string, error) {
77
return os.Getenv("SHELL"), nil
88
}

cli/autostop.go

Lines changed: 0 additions & 167 deletions
This file was deleted.

cli/list.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func list() *cobra.Command {
4949
}
5050

5151
tableWriter := cliui.Table()
52-
header := table.Row{"workspace", "template", "status", "last built", "outdated", "autostart", "autostop"}
52+
header := table.Row{"workspace", "template", "status", "last built", "outdated", "autostart", "ttl"}
5353
tableWriter.AppendHeader(header)
5454
tableWriter.SortBy([]table.SortBy{{
5555
Name: "workspace",
@@ -116,10 +116,8 @@ func list() *cobra.Command {
116116
}
117117

118118
autostopDisplay := "-"
119-
if workspace.AutostopSchedule != "" {
120-
if sched, err := schedule.Weekly(workspace.AutostopSchedule); err == nil {
121-
autostopDisplay = sched.Cron()
122-
}
119+
if workspace.TTL != nil {
120+
autostopDisplay = workspace.TTL.String()
123121
}
124122

125123
user := usersByID[workspace.OwnerID]

cli/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ func Root() *cobra.Command {
6262

6363
cmd.AddCommand(
6464
autostart(),
65-
autostop(),
6665
configSSH(),
6766
create(),
6867
delete(),
@@ -78,6 +77,7 @@ func Root() *cobra.Command {
7877
stop(),
7978
ssh(),
8079
templates(),
80+
ttl(),
8181
update(),
8282
users(),
8383
portForward(),

cli/ssh.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"github.com/coder/coder/cli/cliflag"
2222
"github.com/coder/coder/cli/cliui"
2323
"github.com/coder/coder/coderd/autobuild/notify"
24-
"github.com/coder/coder/coderd/autobuild/schedule"
2524
"github.com/coder/coder/codersdk"
2625
"github.com/coder/coder/cryptorand"
2726
)
@@ -270,16 +269,11 @@ func notifyCondition(ctx context.Context, client *codersdk.Client, workspaceID u
270269
return time.Time{}, nil
271270
}
272271

273-
if ws.AutostopSchedule == "" {
272+
if ws.TTL == nil || *ws.TTL == 0 {
274273
return time.Time{}, nil
275274
}
276275

277-
sched, err := schedule.Weekly(ws.AutostopSchedule)
278-
if err != nil {
279-
return time.Time{}, nil
280-
}
281-
282-
deadline = sched.Next(now)
276+
deadline = ws.LatestBuild.UpdatedAt.Add(*ws.TTL)
283277
callback = func() {
284278
ttl := deadline.Sub(now)
285279
var title, body string

0 commit comments

Comments
 (0)