Skip to content

Commit 9903c96

Browse files
committed
Merge branch 'main' into statusbar/presleyp/1032
2 parents 992ee0c + 56076a0 commit 9903c96

File tree

72 files changed

+1233
-134
lines changed

Some content is hidden

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

72 files changed

+1233
-134
lines changed

.github/ISSUE_TEMPLATE/bug-report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Bug report
33
about: Report a bug
44
title: "Bug: "
5-
labels: "bug :bug:"
5+
labels: ["bug :bug:", "needs grooming :razor:"]
66
---
77

88
## OS Information

.github/ISSUE_TEMPLATE/doc.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Documentation improvement
33
about: Suggest a documentation improvement
44
title: "Docs: "
5-
labels: "documentation :memo:"
5+
labels: ["documentation :memo:", "needs grooming :razor:"]
66
---
77

88
## What is your suggestion?

.github/ISSUE_TEMPLATE/feature.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Feature request
33
about: Suggest an idea to improve coder
44
title: "Feat: "
5-
labels: "new feature :sparkles:"
5+
labels: ["new feature :sparkles:", "needs grooming :razor:"]
66
---
77

88
## What is your suggestion?

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ site/out/
3737
.terraform/
3838

3939
.vscode/*.log
40+
**/*.swp

.goreleaser.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,18 @@ builds:
3232
["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
3333
env: [CGO_ENABLED=0]
3434
goos: [darwin, linux, windows]
35-
goarch: [amd64]
35+
goarch: [amd64, arm, arm64]
36+
goarm: ["7"]
37+
# Only build arm 7 for Linux
38+
ignore:
39+
- goos: windows
40+
goarm: '7'
41+
- goos: darwin
42+
goarm: '7'
3643
hooks:
3744
# The "trimprefix" appends ".exe" on Windows.
3845
post: |
39-
cp {{.Path}} site/out/bin/coder-{{ .Os }}-{{ .Arch }}{{ trimprefix .Name "coder" }}
46+
cp {{.Path}} site/out/bin/coder-{{ .Os }}-{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}{{ trimprefix .Name "coder" }}
4047
4148
- id: coder-linux
4249
dir: cmd/coder
@@ -45,7 +52,8 @@ builds:
4552
["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
4653
env: [CGO_ENABLED=0]
4754
goos: [linux]
48-
goarch: [amd64, arm64]
55+
goarch: [amd64, arm, arm64]
56+
goarm: ["7"]
4957

5058
- id: coder-windows
5159
dir: cmd/coder

.vscode/extensions.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"emeraldwalk.runonsave",
88
"zxh404.vscode-proto3",
99
"redhat.vscode-yaml",
10-
"streetsidesoftware.code-spell-checker"
10+
"streetsidesoftware.code-spell-checker",
11+
"dbaeumer.vscode-eslint"
1112
]
1213
}

cli/autostart.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/spf13/cobra"
99

10-
"github.com/coder/coder/coderd/autostart/schedule"
10+
"github.com/coder/coder/coderd/autobuild/schedule"
1111
"github.com/coder/coder/codersdk"
1212
)
1313

cli/autostop.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/spf13/cobra"
99

10-
"github.com/coder/coder/coderd/autostart/schedule"
10+
"github.com/coder/coder/coderd/autobuild/schedule"
1111
"github.com/coder/coder/codersdk"
1212
)
1313

cli/server.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"github.com/coder/coder/cli/cliui"
4040
"github.com/coder/coder/cli/config"
4141
"github.com/coder/coder/coderd"
42+
"github.com/coder/coder/coderd/autobuild/executor"
4243
"github.com/coder/coder/coderd/database"
4344
"github.com/coder/coder/coderd/database/databasefake"
4445
"github.com/coder/coder/coderd/devtunnel"
@@ -343,6 +344,11 @@ func server() *cobra.Command {
343344
return xerrors.Errorf("notify systemd: %w", err)
344345
}
345346

347+
lifecyclePoller := time.NewTicker(time.Minute)
348+
defer lifecyclePoller.Stop()
349+
lifecycleExecutor := executor.New(cmd.Context(), options.Database, logger, lifecyclePoller.C)
350+
lifecycleExecutor.Run()
351+
346352
// Because the graceful shutdown includes cleaning up workspaces in dev mode, we're
347353
// going to make it harder to accidentally skip the graceful shutdown by hitting ctrl+c
348354
// two or more times. So the stopChan is unlimited in size and we don't call

cli/templatecreate.go

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ func templateCreate() *cobra.Command {
2727
)
2828
cmd := &cobra.Command{
2929
Use: "create [name]",
30-
Short: "Create a template from the current directory",
30+
Short: "Create a template from the current directory or as specified by flag",
31+
Args: cobra.MaximumNArgs(1),
3132
RunE: func(cmd *cobra.Command, args []string) error {
3233
client, err := createClient(cmd)
3334
if err != nil {
@@ -51,19 +52,10 @@ func templateCreate() *cobra.Command {
5152
return xerrors.Errorf("A template already exists named %q!", templateName)
5253
}
5354

54-
// Confirm upload of the users current directory.
55-
// Truncate if in the home directory, because a shorter path looks nicer.
56-
displayDirectory := directory
57-
userHomeDir, err := os.UserHomeDir()
58-
if err != nil {
59-
return xerrors.Errorf("get home dir: %w", err)
60-
}
61-
if strings.HasPrefix(displayDirectory, userHomeDir) {
62-
displayDirectory = strings.TrimPrefix(displayDirectory, userHomeDir)
63-
displayDirectory = "~" + displayDirectory
64-
}
55+
// Confirm upload of the directory.
56+
prettyDir := prettyDirectoryPath(directory)
6557
_, err = cliui.Prompt(cmd, cliui.PromptOptions{
66-
Text: fmt.Sprintf("Create and upload %q?", displayDirectory),
58+
Text: fmt.Sprintf("Create and upload %q?", prettyDir),
6759
IsConfirm: true,
6860
Default: "yes",
6961
})
@@ -73,7 +65,7 @@ func templateCreate() *cobra.Command {
7365

7466
spin := spinner.New(spinner.CharSets[5], 100*time.Millisecond)
7567
spin.Writer = cmd.OutOrStdout()
76-
spin.Suffix = cliui.Styles.Keyword.Render(" Uploading current directory...")
68+
spin.Suffix = cliui.Styles.Keyword.Render(" Uploading directory...")
7769
spin.Start()
7870
defer spin.Stop()
7971
archive, err := provisionersdk.Tar(directory, provisionersdk.TemplateArchiveLimit)
@@ -123,9 +115,9 @@ func templateCreate() *cobra.Command {
123115
}
124116
currentDirectory, _ := os.Getwd()
125117
cmd.Flags().StringVarP(&directory, "directory", "d", currentDirectory, "Specify the directory to create from")
126-
cmd.Flags().StringVarP(&provisioner, "provisioner", "p", "terraform", "Customize the provisioner backend")
118+
cmd.Flags().StringVarP(&provisioner, "test.provisioner", "", "terraform", "Customize the provisioner backend")
127119
// This is for testing!
128-
err := cmd.Flags().MarkHidden("provisioner")
120+
err := cmd.Flags().MarkHidden("test.provisioner")
129121
if err != nil {
130122
panic(err)
131123
}
@@ -228,3 +220,20 @@ func createValidTemplateVersion(cmd *cobra.Command, client *codersdk.Client, org
228220

229221
return &version, parameters, nil
230222
}
223+
224+
// prettyDirectoryPath returns a prettified path when inside the users
225+
// home directory. Falls back to dir if the users home directory cannot
226+
// discerned. This function calls filepath.Clean on the result.
227+
func prettyDirectoryPath(dir string) string {
228+
dir = filepath.Clean(dir)
229+
homeDir, err := os.UserHomeDir()
230+
if err != nil {
231+
return dir
232+
}
233+
pretty := dir
234+
if strings.HasPrefix(pretty, homeDir) {
235+
pretty = strings.TrimPrefix(pretty, homeDir)
236+
pretty = "~" + pretty
237+
}
238+
return pretty
239+
}

0 commit comments

Comments
 (0)