Skip to content

Commit 2f899f2

Browse files
committed
Merge branch 'main' into tailnet
2 parents e82c076 + c4a9be9 commit 2f899f2

File tree

156 files changed

+5429
-1594
lines changed

Some content is hidden

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

156 files changed

+5429
-1594
lines changed

.github/workflows/coder.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,14 @@ jobs:
661661
DEBUG: pw:api
662662
working-directory: site
663663

664+
- name: Upload Playwright Failed Tests
665+
if: always() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
666+
uses: actions/upload-artifact@v3
667+
with:
668+
name: failed-test-videos
669+
path: ./site/test-results/**/*.webm
670+
retention:days: 7
671+
664672
- name: Upload DataDog Trace
665673
if: always() && github.actor != 'dependabot[bot]' && runner.os == 'Linux' && !github.event.pull_request.head.repo.fork
666674
env:

.github/workflows/dogfood.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ jobs:
2121
id: branch-name
2222
uses: tj-actions/branch-names@v5.4
2323

24+
- name: "Branch name to Docker tag name"
25+
id: docker-tag-name
26+
run: |
27+
tag=${{ steps.branch-name.outputs.current_branch }}
28+
# Replace / with --, e.g. user/feature => user--feature.
29+
tag=${tag//\//--}
30+
echo "::set-output name=tag::${tag}"
31+
2432
- name: Set up QEMU
2533
uses: docker/setup-qemu-action@v2
2634

@@ -38,6 +46,6 @@ jobs:
3846
with:
3947
context: "{{defaultContext}}:dogfood"
4048
push: true
41-
tags: "codercom/oss-dogfood:${{ steps.branch-name.outputs.current_branch }},codercom/oss-dogfood:latest"
49+
tags: "codercom/oss-dogfood:${{ steps.docker-tag-name.outputs.tag }},codercom/oss-dogfood:latest"
4250
cache-from: type=registry,ref=codercom/oss-dogfood:latest
4351
cache-to: type=inline

.github/workflows/stale.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,5 @@ jobs:
3131
isn't more activity.
3232
# Upped from 30 since we have a big tracker and was hitting the limit.
3333
operations-per-run: 60
34-
close-issue-reason: not_planned
3534
# Start with the oldest issues, always.
3635
ascending: true

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ dist/
3434
site/out/
3535

3636
*.tfstate
37+
*.tfstate.backup
3738
*.tfplan
3839
*.lock.hcl
3940
.terraform/

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@ build: site/out/index.html $(shell find . -not -path './vendor/*' -type f -name
5656
.PHONY: build
5757

5858
# Runs migrations to output a dump of the database.
59-
coderd/database/dump.sql: $(wildcard coderd/database/migrations/*.sql)
60-
go run coderd/database/dump/main.go
59+
coderd/database/dump.sql: coderd/database/gen/dump/main.go $(wildcard coderd/database/migrations/*.sql)
60+
go run coderd/database/gen/dump/main.go
6161

6262
# Generates Go code for querying the database.
63-
coderd/database/querier.go: coderd/database/sqlc.yaml coderd/database/dump.sql $(wildcard coderd/database/queries/*.sql)
63+
coderd/database/querier.go: coderd/database/sqlc.yaml coderd/database/dump.sql $(wildcard coderd/database/queries/*.sql) coderd/database/gen/enum/main.go
6464
coderd/database/generate.sh
6565

6666
fmt/prettier:

cli/cliui/agent.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ func Agent(ctx context.Context, writer io.Writer, opts AgentOptions) error {
7979
defer resourceMutex.Unlock()
8080
message := "Don't panic, your workspace is booting up!"
8181
if agent.Status == codersdk.WorkspaceAgentDisconnected {
82-
message = "The workspace agent lost connection! Wait for it to reconnect or run: " + Styles.Code.Render("coder rebuild "+opts.WorkspaceName)
82+
message = "The workspace agent lost connection! Wait for it to reconnect or restart your workspace."
8383
}
8484
// This saves the cursor position, then defers clearing from the cursor
8585
// position to the end of the screen.

cli/configssh.go

Lines changed: 32 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ func configSSH() *cobra.Command {
137137
sshConfigFile string
138138
sshConfigOpts sshConfigOptions
139139
usePreviousOpts bool
140-
coderConfigFile string
141140
dryRun bool
142141
skipProxyCommand bool
143142
wireguard bool
@@ -198,15 +197,7 @@ func configSSH() *cobra.Command {
198197
// Parse the previous configuration only if config-ssh
199198
// has been run previously.
200199
var lastConfig *sshConfigOptions
201-
var ok bool
202-
var coderConfigRaw []byte
203-
if coderConfigFile, coderConfigRaw, ok = readDeprecatedCoderConfigFile(homedir, coderConfigFile); ok {
204-
// Deprecated: Remove after migration period.
205-
changes = append(changes, fmt.Sprintf("Remove old auto-generated coder config file at %s", coderConfigFile))
206-
// Backwards compate, restore old options.
207-
c := sshConfigParseLastOptions(bytes.NewReader(coderConfigRaw))
208-
lastConfig = &c
209-
} else if section, ok := sshConfigGetCoderSection(configRaw); ok {
200+
if section, ok := sshConfigGetCoderSection(configRaw); ok {
210201
c := sshConfigParseLastOptions(bytes.NewReader(section))
211202
lastConfig = &c
212203
}
@@ -237,6 +228,8 @@ func configSSH() *cobra.Command {
237228
}
238229
// Selecting "no" will use the last config.
239230
sshConfigOpts = *lastConfig
231+
} else {
232+
changes = append(changes, "Use new SSH options")
240233
}
241234
// Only print when prompts are shown.
242235
if yes, _ := cmd.Flags().GetBool("yes"); !yes {
@@ -245,14 +238,6 @@ func configSSH() *cobra.Command {
245238
}
246239

247240
configModified := configRaw
248-
249-
// Check for the presence of the coder Include
250-
// statement is present and add if missing.
251-
// Deprecated: Remove after migration period.
252-
if configModified, ok = removeDeprecatedSSHIncludeStatement(configModified); ok {
253-
changes = append(changes, fmt.Sprintf("Remove %q from %s", "Include coder", sshConfigFile))
254-
}
255-
256241
root := createConfig(cmd)
257242

258243
buf := &bytes.Buffer{}
@@ -313,17 +298,34 @@ func configSSH() *cobra.Command {
313298
_, _ = buf.Write(after)
314299

315300
if !bytes.Equal(configModified, buf.Bytes()) {
316-
changes = append(changes, fmt.Sprintf("Update coder config section in %s", sshConfigFile))
301+
changes = append(changes, fmt.Sprintf("Update the coder section in %s", sshConfigFile))
317302
configModified = buf.Bytes()
318303
}
319304

320-
if len(changes) > 0 {
321-
dryRunDisclaimer := ""
322-
if dryRun {
323-
dryRunDisclaimer = " (dry-run, no changes will be made)"
305+
if len(changes) == 0 {
306+
_, _ = fmt.Fprintf(out, "No changes to make.\n")
307+
return nil
308+
}
309+
310+
if dryRun {
311+
_, _ = fmt.Fprintf(out, "Dry run, the following changes would be made to your SSH configuration:\n\n * %s\n\n", strings.Join(changes, "\n * "))
312+
313+
color := isTTYOut(cmd)
314+
diff, err := diffBytes(sshConfigFile, configRaw, configModified, color)
315+
if err != nil {
316+
return xerrors.Errorf("diff failed: %w", err)
317+
}
318+
if len(diff) > 0 {
319+
// Write diff to stdout.
320+
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "%s", diff)
324321
}
322+
323+
return nil
324+
}
325+
326+
if len(changes) > 0 {
325327
_, err = cliui.Prompt(cmd, cliui.PromptOptions{
326-
Text: fmt.Sprintf("The following changes will be made to your SSH configuration:\n\n * %s\n\n Continue?%s", strings.Join(changes, "\n * "), dryRunDisclaimer),
328+
Text: fmt.Sprintf("The following changes will be made to your SSH configuration:\n\n * %s\n\n Continue?", strings.Join(changes, "\n * ")),
327329
IsConfirm: true,
328330
})
329331
if err != nil {
@@ -335,47 +337,18 @@ func configSSH() *cobra.Command {
335337
}
336338
}
337339

338-
if dryRun {
339-
color := isTTYOut(cmd)
340-
diffFns := []func() ([]byte, error){
341-
func() ([]byte, error) { return diffBytes(sshConfigFile, configRaw, configModified, color) },
342-
}
343-
if len(coderConfigRaw) > 0 {
344-
// Deprecated: Remove after migration period.
345-
diffFns = append(diffFns, func() ([]byte, error) { return diffBytes(coderConfigFile, coderConfigRaw, nil, color) })
346-
}
347-
348-
for _, diffFn := range diffFns {
349-
diff, err := diffFn()
350-
if err != nil {
351-
return xerrors.Errorf("diff failed: %w", err)
352-
}
353-
if len(diff) > 0 {
354-
// Write diff to stdout.
355-
_, _ = fmt.Fprintf(cmd.OutOrStdout(), "\n%s", diff)
356-
}
357-
}
358-
} else {
359-
if !bytes.Equal(configRaw, configModified) {
360-
err = writeWithTempFileAndMove(sshConfigFile, bytes.NewReader(configModified))
361-
if err != nil {
362-
return xerrors.Errorf("write ssh config failed: %w", err)
363-
}
364-
}
365-
// Deprecated: Remove after migration period.
366-
if len(coderConfigRaw) > 0 {
367-
err = os.Remove(coderConfigFile)
368-
if err != nil {
369-
return xerrors.Errorf("remove coder config failed: %w", err)
370-
}
340+
if !bytes.Equal(configRaw, configModified) {
341+
err = writeWithTempFileAndMove(sshConfigFile, bytes.NewReader(configModified))
342+
if err != nil {
343+
return xerrors.Errorf("write ssh config failed: %w", err)
371344
}
372345
}
373346

374347
if len(workspaceConfigs) > 0 {
375348
_, _ = fmt.Fprintln(out, "You should now be able to ssh into your workspace.")
376-
_, _ = fmt.Fprintf(out, "For example, try running:\n\n\t$ ssh coder.%s\n\n", workspaceConfigs[0].Name)
349+
_, _ = fmt.Fprintf(out, "For example, try running:\n\n\t$ ssh coder.%s\n", workspaceConfigs[0].Name)
377350
} else {
378-
_, _ = fmt.Fprint(out, "You don't have any workspaces yet, try creating one with:\n\n\t$ coder create <workspace>\n\n")
351+
_, _ = fmt.Fprint(out, "You don't have any workspaces yet, try creating one with:\n\n\t$ coder create <workspace>\n")
379352
}
380353
return nil
381354
},
@@ -389,10 +362,6 @@ func configSSH() *cobra.Command {
389362
cliflag.BoolVarP(cmd.Flags(), &wireguard, "wireguard", "", "CODER_CONFIG_SSH_WIREGUARD", false, "Whether to use Wireguard for SSH tunneling.")
390363
_ = cmd.Flags().MarkHidden("wireguard")
391364

392-
// Deprecated: Remove after migration period.
393-
cmd.Flags().StringVar(&coderConfigFile, "test.ssh-coder-config-file", sshDefaultCoderConfigFileName, "Specifies the path to an Coder SSH config file. Useful for testing.")
394-
_ = cmd.Flags().MarkHidden("test.ssh-coder-config-file")
395-
396365
cliui.AllowSkipPrompt(cmd)
397366

398367
return cmd

cli/configssh_old.go

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

0 commit comments

Comments
 (0)