Skip to content

Commit f595f16

Browse files
committed
Merge branch 'main' into mafredri/example-digital-ocean-droplet
2 parents 2e98e1d + 1361c13 commit f595f16

File tree

158 files changed

+4211
-1317
lines changed

Some content is hidden

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

158 files changed

+4211
-1317
lines changed

.github/dependabot.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ updates:
5555
- version-update:semver-major
5656

5757
- package-ecosystem: "terraform"
58-
directory: "/examples"
58+
directory: "/examples/templates"
5959
schedule:
6060
interval: "weekly"
6161
time: "06:00"

.github/workflows/chromatic.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
# storybook snapshots will require manual approval/review in order for
4343
# the check to pass. This is desired in PRs, but not in mainline.
4444
- name: Publish to Chromatic (non-mainline)
45-
if: github.ref != 'refs/heads/main'
45+
if: github.ref != 'refs/heads/main' && github.repository_owner == 'coder'
4646
uses: chromaui/action@v1
4747
with:
4848
buildScriptName: "storybook:build"
@@ -59,7 +59,7 @@ jobs:
5959
# commits, but it's good to be defensive in case, otherwise CI remains
6060
# infinitely "in progress" in mainline unless we re-review each build.
6161
- name: Publish to Chromatic (mainline)
62-
if: github.ref == 'refs/heads/main'
62+
if: github.ref == 'refs/heads/main' && github.repository_owner == 'coder'
6363
uses: chromaui/action@v1
6464
with:
6565
autoAcceptChanges: true

.github/workflows/coder.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ jobs:
208208
token: ${{ secrets.CODECOV_TOKEN }}
209209
files: ./gotests.coverage
210210
flags: unittest-go-${{ matrix.os }}
211-
fail_ci_if_error: true
211+
# this flakes and sometimes fails the build
212+
fail_ci_if_error: false
212213

213214
test-go-postgres:
214215
name: "test/go/postgres"
@@ -291,7 +292,8 @@ jobs:
291292
token: ${{ secrets.CODECOV_TOKEN }}
292293
files: ./gotests.coverage
293294
flags: unittest-go-postgres-${{ matrix.os }}
294-
fail_ci_if_error: true
295+
# this flakes and sometimes fails the build
296+
fail_ci_if_error: false
295297

296298
deploy:
297299
name: "deploy"
@@ -421,7 +423,8 @@ jobs:
421423
token: ${{ secrets.CODECOV_TOKEN }}
422424
files: ./site/coverage/lcov.info
423425
flags: unittest-js
424-
fail_ci_if_error: true
426+
# this flakes and sometimes fails the build
427+
fail_ci_if_error: false
425428

426429
- name: Upload DataDog Trace
427430
if: always() && github.actor != 'dependabot[bot]' && !github.event.pull_request.head.repo.fork

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
"TCGETS",
6161
"tcpip",
6262
"TCSETS",
63+
"templateversions",
6364
"testid",
6465
"tfexec",
6566
"tfjson",

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Discord"](https://img.shields.io/badge/join-us%20on%20Discord-gray.svg?longCache
88
Follow](https://img.shields.io/twitter/follow/CoderHQ?label=%40CoderHQ&style=social)](https://twitter.com/coderhq)
99
[![codecov](https://codecov.io/gh/coder/coder/branch/main/graph/badge.svg?token=TNLW3OAP6G)](https://codecov.io/gh/coder/coder)
1010

11-
Coder turns your cloud into a fleet of remote development servers.
11+
Coder creates remote development machines so you can develop your code from anywhere
1212

1313
<p align="center">
1414
<img src="./docs/images/hero-image.png">
@@ -57,7 +57,7 @@ We recommend installing [the latest
5757
release](https://github.com/coder/coder/releases) on a system with at least 1
5858
CPU core and 2 GB RAM:
5959

60-
1. Download the release appropriate for your operating system
60+
1. Download the [release asset](https://github.com/coder/coder/releases) appropriate for your operating system
6161
1. Unzip the folder you just downloaded, and move the `coder` executable to a
6262
location that's on your `PATH`
6363

agent/agent.go

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,10 +359,12 @@ func (a *agent) createCommand(ctx context.Context, rawCommand string, env []stri
359359
if err != nil {
360360
return nil, xerrors.Errorf("getting os executable: %w", err)
361361
}
362+
cmd.Env = append(cmd.Env, fmt.Sprintf("USER=%s", username))
363+
cmd.Env = append(cmd.Env, fmt.Sprintf(`PATH=%s%c%s`, os.Getenv("PATH"), filepath.ListSeparator, filepath.Dir(executablePath)))
362364
// Git on Windows resolves with UNIX-style paths.
363365
// If using backslashes, it's unable to find the executable.
364-
executablePath = strings.ReplaceAll(executablePath, "\\", "/")
365-
cmd.Env = append(cmd.Env, fmt.Sprintf(`GIT_SSH_COMMAND=%s gitssh --`, executablePath))
366+
unixExecutablePath := strings.ReplaceAll(executablePath, "\\", "/")
367+
cmd.Env = append(cmd.Env, fmt.Sprintf(`GIT_SSH_COMMAND=%s gitssh --`, unixExecutablePath))
366368
// These prevent the user from having to specify _anything_ to successfully commit.
367369
// Both author and committer must be set!
368370
cmd.Env = append(cmd.Env, fmt.Sprintf(`GIT_AUTHOR_EMAIL=%s`, metadata.OwnerEmail))
@@ -391,6 +393,16 @@ func (a *agent) handleSSHSession(session ssh.Session) error {
391393
return err
392394
}
393395

396+
if ssh.AgentRequested(session) {
397+
l, err := ssh.NewAgentListener()
398+
if err != nil {
399+
return xerrors.Errorf("new agent listener: %w", err)
400+
}
401+
defer l.Close()
402+
go ssh.ForwardAgentConnections(l, session)
403+
cmd.Env = append(cmd.Env, fmt.Sprintf("%s=%s", "SSH_AUTH_SOCK", l.Addr().String()))
404+
}
405+
394406
sshPty, windowSize, isPty := session.Pty()
395407
if isPty {
396408
cmd.Env = append(cmd.Env, fmt.Sprintf("TERM=%s", sshPty.Term))

agent/agent_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ func TestAgent(t *testing.T) {
6868
require.True(t, strings.HasSuffix(strings.TrimSpace(string(output)), "gitssh --"))
6969
})
7070

71+
t.Run("PATHHasCoder", func(t *testing.T) {
72+
t.Parallel()
73+
session := setupSSHSession(t, agent.Metadata{})
74+
command := "sh -c 'echo $PATH'"
75+
if runtime.GOOS == "windows" {
76+
command = "cmd.exe /c echo %PATH%"
77+
}
78+
output, err := session.Output(command)
79+
require.NoError(t, err)
80+
ex, err := os.Executable()
81+
t.Log(ex)
82+
require.NoError(t, err)
83+
require.True(t, strings.Contains(strings.TrimSpace(string(output)), filepath.Dir(ex)))
84+
})
85+
7186
t.Run("SessionTTY", func(t *testing.T) {
7287
t.Parallel()
7388
if runtime.GOOS == "windows" {

cli/config/file.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ func (r Root) Organization() File {
2121
return File(filepath.Join(string(r), "organization"))
2222
}
2323

24+
func (r Root) DotfilesURL() File {
25+
return File(filepath.Join(string(r), "dotfilesurl"))
26+
}
27+
2428
// File provides convenience methods for interacting with *os.File.
2529
type File string
2630

cli/configssh.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ func configSSH() *cobra.Command {
3838
Annotations: workspaceCommand,
3939
Use: "config-ssh",
4040
Short: "Populate your SSH config with Host entries for all of your workspaces",
41+
Example: `
42+
- You can use -o (or --ssh-option) so set SSH options to be used for all your
43+
workspaces.
44+
45+
` + cliui.Styles.Code.Render("$ coder config-ssh -o ForwardAgent=yes"),
4146
RunE: func(cmd *cobra.Command, args []string) error {
4247
client, err := createClient(cmd)
4348
if err != nil {

0 commit comments

Comments
 (0)