Skip to content

Commit 8e3bdc2

Browse files
committed
Merge branch 'main' into jon/cligroups
2 parents c542f2e + b217f2c commit 8e3bdc2

File tree

115 files changed

+4041
-953
lines changed

Some content is hidden

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

115 files changed

+4041
-953
lines changed

.github/workflows/release.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ jobs:
6565
restore-keys: |
6666
js-${{ runner.os }}-
6767
68+
- name: Install nsis and zstd
69+
run: sudo apt-get install -y nsis zstd
70+
6871
- name: Install nfpm
6972
run: |
7073
set -euo pipefail
7174
wget -O /tmp/nfpm.deb https://github.com/goreleaser/nfpm/releases/download/v2.18.1/nfpm_amd64.deb
7275
sudo dpkg -i /tmp/nfpm.deb
73-
- name: Install zstd
74-
run: sudo apt-get install -y zstd
7576
7677
- name: Install rcodesign
7778
run: |
@@ -107,6 +108,7 @@ jobs:
107108
make -j \
108109
build/coder_"$version"_linux_{amd64,armv7,arm64}.{tar.gz,apk,deb,rpm} \
109110
build/coder_"$version"_{darwin,windows}_{amd64,arm64}.zip \
111+
build/coder_"$version"_windows_amd64_installer.exe \
110112
build/coder_helm_"$version".tgz
111113
env:
112114
CODER_SIGN_DARWIN: "1"
@@ -155,6 +157,7 @@ jobs:
155157
run: |
156158
./scripts/publish_release.sh \
157159
${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && '--dry-run' }} \
160+
./build/*_installer.exe \
158161
./build/*.zip \
159162
./build/*.tar.gz \
160163
./build/*.tgz \

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{
22
"cSpell.words": [
3+
"afero",
34
"apps",
5+
"ASKPASS",
46
"awsidentity",
57
"bodyclose",
68
"buildinfo",
@@ -19,16 +21,20 @@
1921
"derphttp",
2022
"derpmap",
2123
"devel",
24+
"devtunnel",
2225
"dflags",
2326
"drpc",
2427
"drpcconn",
2528
"drpcmux",
2629
"drpcserver",
2730
"Dsts",
31+
"embeddedpostgres",
2832
"enablements",
33+
"errgroup",
2934
"eventsourcemock",
3035
"fatih",
3136
"Formik",
37+
"gitauth",
3238
"gitsshkey",
3339
"goarch",
3440
"gographviz",
@@ -78,6 +84,7 @@
7884
"parameterscopeid",
7985
"pqtype",
8086
"prometheusmetrics",
87+
"promhttp",
8188
"promptui",
8289
"protobuf",
8390
"provisionerd",

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,13 @@ $(CODER_ALL_PACKAGES): $(CODER_PACKAGE_DEPS)
252252
--output "$@" \
253253
"build/coder_$(VERSION)_$${os}_$${arch}"
254254

255+
# This task builds a Windows amd64 installer. Depends on makensis.
256+
build/coder_$(VERSION)_windows_amd64_installer.exe: build/coder_$(VERSION)_windows_amd64.exe
257+
./scripts/build_windows_installer.sh \
258+
--version "$(VERSION)" \
259+
--output "$@" \
260+
"$<"
261+
255262
# Redirect from version-less Docker image targets to the versioned ones.
256263
#
257264
# Called like this:

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ Coder creates remote development machines so your team can develop from anywhere
3232
> **Note**:
3333
> Coder is in a beta state. [Report issues here](https://github.com/coder/coder/issues/new).
3434
35-
The easiest way to install Coder is to use our [install script](https://github.com/coder/coder/blob/main/install.sh) for Linux and macOS.
35+
The easiest way to install Coder is to use our
36+
[install script](https://github.com/coder/coder/blob/main/install.sh) for Linux
37+
and macOS. For Windows, use the latest `..._installer.exe` file from GitHub
38+
Releases.
3639

3740
To install, run:
3841

agent/agent.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"github.com/gliderlabs/ssh"
2727
"github.com/google/uuid"
2828
"github.com/pkg/sftp"
29+
"github.com/spf13/afero"
2930
"go.uber.org/atomic"
3031
gossh "golang.org/x/crypto/ssh"
3132
"golang.org/x/xerrors"
@@ -35,6 +36,7 @@ import (
3536
"cdr.dev/slog"
3637
"github.com/coder/coder/agent/usershell"
3738
"github.com/coder/coder/buildinfo"
39+
"github.com/coder/coder/coderd/gitauth"
3840
"github.com/coder/coder/codersdk"
3941
"github.com/coder/coder/pty"
4042
"github.com/coder/coder/tailnet"
@@ -53,6 +55,7 @@ const (
5355
)
5456

5557
type Options struct {
58+
Filesystem afero.Fs
5659
ExchangeToken func(ctx context.Context) error
5760
Client Client
5861
ReconnectingPTYTimeout time.Duration
@@ -72,6 +75,9 @@ func New(options Options) io.Closer {
7275
if options.ReconnectingPTYTimeout == 0 {
7376
options.ReconnectingPTYTimeout = 5 * time.Minute
7477
}
78+
if options.Filesystem == nil {
79+
options.Filesystem = afero.NewOsFs()
80+
}
7581
ctx, cancelFunc := context.WithCancel(context.Background())
7682
server := &agent{
7783
reconnectingPTYTimeout: options.ReconnectingPTYTimeout,
@@ -81,6 +87,7 @@ func New(options Options) io.Closer {
8187
envVars: options.EnvironmentVariables,
8288
client: options.Client,
8389
exchangeToken: options.ExchangeToken,
90+
filesystem: options.Filesystem,
8491
stats: &Stats{},
8592
}
8693
server.init(ctx)
@@ -91,6 +98,7 @@ type agent struct {
9198
logger slog.Logger
9299
client Client
93100
exchangeToken func(ctx context.Context) error
101+
filesystem afero.Fs
94102

95103
reconnectingPTYs sync.Map
96104
reconnectingPTYTimeout time.Duration
@@ -171,6 +179,13 @@ func (a *agent) run(ctx context.Context) error {
171179
}()
172180
}
173181

182+
if metadata.GitAuthConfigs > 0 {
183+
err = gitauth.OverrideVSCodeConfigs(a.filesystem)
184+
if err != nil {
185+
return xerrors.Errorf("override vscode configuration for git auth: %w", err)
186+
}
187+
}
188+
174189
// This automatically closes when the context ends!
175190
appReporterCtx, appReporterCtxCancel := context.WithCancel(ctx)
176191
defer appReporterCtxCancel()

agent/agent_test.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"github.com/google/uuid"
2828
"github.com/pion/udp"
2929
"github.com/pkg/sftp"
30+
"github.com/spf13/afero"
3031
"github.com/stretchr/testify/assert"
3132
"github.com/stretchr/testify/require"
3233
"go.uber.org/goleak"
@@ -543,6 +544,38 @@ func TestAgent(t *testing.T) {
543544
return initialized.Load() == 2
544545
}, testutil.WaitShort, testutil.IntervalFast)
545546
})
547+
548+
t.Run("WriteVSCodeConfigs", func(t *testing.T) {
549+
t.Parallel()
550+
client := &client{
551+
t: t,
552+
agentID: uuid.New(),
553+
metadata: codersdk.WorkspaceAgentMetadata{
554+
GitAuthConfigs: 1,
555+
},
556+
statsChan: make(chan *codersdk.AgentStats),
557+
coordinator: tailnet.NewCoordinator(),
558+
}
559+
filesystem := afero.NewMemMapFs()
560+
closer := agent.New(agent.Options{
561+
ExchangeToken: func(ctx context.Context) error {
562+
return nil
563+
},
564+
Client: client,
565+
Logger: slogtest.Make(t, nil).Leveled(slog.LevelInfo),
566+
Filesystem: filesystem,
567+
})
568+
t.Cleanup(func() {
569+
_ = closer.Close()
570+
})
571+
home, err := os.UserHomeDir()
572+
require.NoError(t, err)
573+
path := filepath.Join(home, ".vscode-server", "data", "Machine", "settings.json")
574+
require.Eventually(t, func() bool {
575+
_, err := filesystem.Stat(path)
576+
return err == nil
577+
}, testutil.WaitShort, testutil.IntervalFast)
578+
})
546579
}
547580

548581
func setupSSHCommand(t *testing.T, beforeArgs []string, afterArgs []string) *exec.Cmd {

cli/agent.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,9 @@ func workspaceAgent() *cobra.Command {
169169
},
170170
EnvironmentVariables: map[string]string{
171171
// Override the "CODER_AGENT_TOKEN" variable in all
172-
// shells so "gitssh" works!
172+
// shells so "gitssh" and "gitaskpass" works!
173173
"CODER_AGENT_TOKEN": client.SessionToken,
174+
"GIT_ASKPASS": executablePath,
174175
},
175176
})
176177
<-cmd.Context().Done()

cli/cliui/provisionerjob.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ func ProvisionerJob(ctx context.Context, writer io.Writer, opts ProvisionerJobOp
103103
}
104104
updateStage("Running", *job.StartedAt)
105105
}
106-
updateJob()
107106

108107
if opts.Cancel != nil {
109108
// Handles ctrl+c to cancel a job.
@@ -131,6 +130,7 @@ func ProvisionerJob(ctx context.Context, writer io.Writer, opts ProvisionerJobOp
131130

132131
// The initial stage needs to print after the signal handler has been registered.
133132
printStage()
133+
updateJob()
134134

135135
logs, closer, err := opts.Logs()
136136
if err != nil {

cli/config/server.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Coder Server Configuration
2+
3+
# Automatically authenticate HTTP(s) Git requests.
4+
gitauth:
5+
# Supported: azure-devops, bitbucket, github, gitlab
6+
# - type: github
7+
# client_id: xxxxxx
8+
# client_secret: xxxxxx
9+
10+
# Multiple providers are an Enterprise feature.
11+
# Contact sales@coder.com for a license.
12+
#
13+
# If multiple providers are used, a unique "id"
14+
# must be provided for each one.
15+
# - id: example
16+
# type: azure-devops
17+
# client_id: xxxxxxx
18+
# client_secret: xxxxxxx
19+
# A custom regex can be used to match a specific
20+
# repository or organization to limit auth scope.
21+
# regex: github.com/coder
22+
# Custom authentication and token URLs should be
23+
# used for self-managed Git provider deployments.
24+
# auth_url: https://example.com/oauth/authorize
25+
# token_url: https://example.com/oauth/token

0 commit comments

Comments
 (0)