Skip to content

Commit f8566f3

Browse files
committed
Merge branch 'closeconn' into workspaceagent
2 parents ae36c63 + 94e03a2 commit f8566f3

File tree

11 files changed

+218
-139
lines changed

11 files changed

+218
-139
lines changed

.github/workflows/coder.yaml

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,11 @@ jobs:
150150
terraform_wrapper: false
151151

152152
- name: Test with Mock Database
153+
env:
154+
GOMAXPROCS: ${{ runner.os == 'Windows' && 1 || 2 }}
153155
run: gotestsum --junitfile="gotests.xml" --packages="./..." --
154-
-covermode=atomic -coverprofile="gotests.coverage"
155-
-timeout=3m -count=5 -race -short -parallel=2
156+
-covermode=atomic -coverprofile="gotests.coverage" -failfast
157+
-timeout=3m -count=5 -race -short
156158

157159
- name: Upload DataDog Trace
158160
if: (success() || failure()) && github.actor != 'dependabot[bot]'
@@ -166,7 +168,7 @@ jobs:
166168
if: runner.os == 'Linux'
167169
run: DB=true gotestsum --junitfile="gotests.xml" --packages="./..." --
168170
-covermode=atomic -coverprofile="gotests.coverage" -timeout=3m
169-
-count=1 -race -parallel=2
171+
-count=1 -race -parallel=2 -failfast
170172

171173
- name: Upload DataDog Trace
172174
if: (success() || failure()) && github.actor != 'dependabot[bot]'
@@ -187,12 +189,7 @@ jobs:
187189
deploy:
188190
name: "deploy"
189191
runs-on: ubuntu-latest
190-
# Temporarily disable the 'deploy' job until issue is fixed:
191-
# https://github.com/coder/coder/issues/287
192-
# As a part of a fix for that, uncomment the below line
193-
# and delete the 'if' after:
194-
# if: github.event_name != 'pull_request'
195-
if: false
192+
if: github.event_name != 'pull_request'
196193
permissions:
197194
contents: read
198195
id-token: write

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ This repository contains source code for Coder V2. Additional documentation:
1010
## Directory Structure
1111

1212
- `.github/`: Settings for [Dependabot for updating dependencies](https://docs.github.com/en/code-security/supply-chain-security/customizing-dependency-updates) and [build/deploy pipelines with GitHub Actions](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions).
13-
- [`semantic.yaml`](./github/semantic.yaml): Configuration for [semantic pull requests](https://github.com/apps/semantic-pull-requests)
13+
- [`semantic.yaml`](./github/semantic.yaml): Configuration for [semantic pull requests](https://github.com/apps/semantic-pull-requests)\
14+
- `examples`: Example terraform project templates.
1415
- `site`: Front-end UI code.
1516

1617
## Development

coderd/coderdtest/coderdtest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func AwaitProjectImportJob(t *testing.T, client *codersdk.Client, organization s
157157
provisionerJob, err = client.ProjectImportJob(context.Background(), organization, job)
158158
require.NoError(t, err)
159159
return provisionerJob.Status.Completed()
160-
}, 3*time.Second, 25*time.Millisecond)
160+
}, 5*time.Second, 25*time.Millisecond)
161161
return provisionerJob
162162
}
163163

@@ -169,7 +169,7 @@ func AwaitWorkspaceProvisionJob(t *testing.T, client *codersdk.Client, organizat
169169
provisionerJob, err = client.WorkspaceProvisionJob(context.Background(), organization, job)
170170
require.NoError(t, err)
171171
return provisionerJob.Status.Completed()
172-
}, 3*time.Second, 25*time.Millisecond)
172+
}, 5*time.Second, 25*time.Millisecond)
173173
return provisionerJob
174174
}
175175

coderd/provisionerdaemons.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ func (api *api) provisionerDaemonsServe(rw http.ResponseWriter, r *http.Request)
8484
_ = conn.Close(websocket.StatusInternalError, fmt.Sprintf("multiplex server: %s", err))
8585
return
8686
}
87+
go func() {
88+
<-r.Context().Done()
89+
_, _ = fmt.Printf("\n\n\n\nDONE\n\n\n\n")
90+
}()
8791
mux := drpcmux.New()
8892
err = proto.DRPCRegisterProvisionerDaemon(mux, &provisionerdServer{
8993
ID: daemon.ID,

examples/minimal-project/main.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# The simplest possible Terraform module: it just outputs "Hello, World!"
2+
output "hello_world" {
3+
value = "Hello, World!"
4+
}

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ require (
2020
github.com/coder/retry v1.3.0
2121
github.com/creack/pty v1.1.17
2222
github.com/fatih/color v1.13.0
23-
github.com/gliderlabs/ssh v0.3.3
23+
github.com/gliderlabs/ssh v0.2.2
2424
github.com/go-chi/chi/v5 v5.0.7
2525
github.com/go-chi/render v1.0.1
2626
github.com/go-playground/validator/v10 v10.10.0
@@ -42,7 +42,6 @@ require (
4242
github.com/pion/transport v0.13.0
4343
github.com/pion/webrtc/v3 v3.1.23
4444
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
45-
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef
4645
github.com/quasilyte/go-ruleguard/dsl v0.3.17
4746
github.com/spf13/cobra v1.3.0
4847
github.com/stretchr/testify v1.7.0
@@ -66,7 +65,7 @@ require (
6665
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
6766
github.com/agext/levenshtein v1.2.3 // indirect
6867
github.com/alecthomas/chroma v0.10.0 // indirect
69-
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be // indirect
68+
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 // indirect
7069
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
7170
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
7271
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect
@@ -75,6 +74,7 @@ require (
7574
github.com/dhui/dktest v0.3.9 // indirect
7675
github.com/dlclark/regexp2 v1.4.0 // indirect
7776
github.com/docker/cli v20.10.12+incompatible // indirect
77+
github.com/docker/distribution v2.8.0+incompatible // indirect
7878
github.com/docker/docker v20.10.12+incompatible // indirect
7979
github.com/docker/go-connections v0.4.0 // indirect
8080
github.com/docker/go-units v0.4.0 // indirect

go.sum

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRF
131131
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
132132
github.com/alexflint/go-filemutex v0.0.0-20171022225611-72bdc8eae2ae/go.mod h1:CgnQgUtFrFz9mxFNtED3jI5tLDjKlOM+oUF/sTk6ps0=
133133
github.com/andybalholm/crlf v0.0.0-20171020200849-670099aa064f/go.mod h1:k8feO4+kXDxro6ErPXBRTJ/ro2mf0SsFG8s7doP9kJE=
134+
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
134135
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
135-
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8=
136-
github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4=
137136
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
138137
github.com/apache/arrow/go/arrow v0.0.0-20210818145353-234c94e4ce64/go.mod h1:2qMFB56yOP3KzkB3PbYZ4AlUFg3a88F67TIx5lB/WwY=
139138
github.com/apache/arrow/go/arrow v0.0.0-20211013220434-5962184e7a30/go.mod h1:Q7yQnSMnLvcXlZ8RV+jwz/6y1rQTqbX6C82SndT52Zs=
@@ -380,8 +379,9 @@ github.com/docker/cli v20.10.12+incompatible h1:lZlz0uzG+GH+c0plStMUdF/qk3ppmgns
380379
github.com/docker/cli v20.10.12+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8=
381380
github.com/docker/distribution v0.0.0-20190905152932-14b96e55d84c/go.mod h1:0+TTO4EOBfRPhZXAeF1Vu+W3hHZ8eLp8PgKVZlcvtFY=
382381
github.com/docker/distribution v2.7.1-0.20190205005809-0d3efadf0154+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
383-
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
384382
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
383+
github.com/docker/distribution v2.8.0+incompatible h1:l9EaZDICImO1ngI+uTifW+ZYvvz7fKISBAKpg+MbWbY=
384+
github.com/docker/distribution v2.8.0+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
385385
github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
386386
github.com/docker/docker v20.10.9+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
387387
github.com/docker/docker v20.10.12+incompatible h1:CEeNmFM0QZIsJCZKMkZx0ZcahTiewkrgiwfYD+dfl1U=
@@ -422,6 +422,7 @@ github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL
422422
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
423423
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
424424
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
425+
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568 h1:BHsljHzVlRcyQhjrss6TZTdY2VfCqZPbv5k3iBFa2ZQ=
425426
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
426427
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
427428
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
@@ -442,9 +443,8 @@ github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE
442443
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
443444
github.com/gin-gonic/gin v1.6.3 h1:ahKqKTFpO5KTPHxWZjEdPScmYaGtLo8Y4DMHoEsnp14=
444445
github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M=
446+
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
445447
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
446-
github.com/gliderlabs/ssh v0.3.3 h1:mBQ8NiOgDkINJrZtoizkC3nDNYgSaWtxyem6S2XHBtA=
447-
github.com/gliderlabs/ssh v0.3.3/go.mod h1:ZSS+CUoKHDrqVakTfTWUlKSr9MtMFkC4UvtQKD7O914=
448448
github.com/go-chi/chi/v5 v5.0.7 h1:rDTPXLDHGATaeHvVlLcR4Qe0zftYethFucbjVQ1PxU8=
449449
github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8=
450450
github.com/go-chi/render v1.0.1 h1:4/5tis2cKaNdnv9zFLfXzcquC9HbeZgCnxGnKrltBS8=
@@ -1107,8 +1107,6 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
11071107
github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
11081108
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
11091109
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
1110-
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef h1:NKxTG6GVGbfMXc2mIk+KphcH6hagbVXhcFkbTgYleTI=
1111-
github.com/psanford/memfs v0.0.0-20210214183328-a001468d78ef/go.mod h1:tcaRap0jS3eifrEEllL6ZMd9dg8IlDpi2S1oARrQ+NI=
11121110
github.com/quasilyte/go-ruleguard/dsl v0.3.17 h1:L5xf3nifnRIdYe9vyMuY2sDnZHIgQol/fDq74FQz7ZY=
11131111
github.com/quasilyte/go-ruleguard/dsl v0.3.17/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU=
11141112
github.com/remyoudompheng/bigfft v0.0.0-20190728182440-6a916e37a237/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=

images/coder/Dockerfile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
FROM registry.access.redhat.com/ubi8/ubi:latest
22

3+
RUN yum install -y yum-utils
4+
RUN yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
5+
RUN yum install -y terraform
6+
37
COPY coderd /coder/coderd
48
RUN chmod +x /coder/coderd
59

provisionerd/provisionerd_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@ func createProvisionerDaemonClient(t *testing.T, server provisionerDaemonTestSer
406406
err := proto.DRPCRegisterProvisionerDaemon(mux, &server)
407407
require.NoError(t, err)
408408
srv := drpcserver.New(mux)
409+
ctx, cancelFunc := context.WithCancel(context.Background())
410+
t.Cleanup(cancelFunc)
409411
go func() {
410-
ctx, cancelFunc := context.WithCancel(context.Background())
411-
t.Cleanup(cancelFunc)
412412
_ = srv.Serve(ctx, serverPipe)
413413
}()
414414
return proto.NewDRPCProvisionerDaemonClient(provisionersdk.Conn(clientPipe))
@@ -426,9 +426,9 @@ func createProvisionerClient(t *testing.T, server provisionerTestServer) sdkprot
426426
err := sdkproto.DRPCRegisterProvisioner(mux, &server)
427427
require.NoError(t, err)
428428
srv := drpcserver.New(mux)
429+
ctx, cancelFunc := context.WithCancel(context.Background())
430+
t.Cleanup(cancelFunc)
429431
go func() {
430-
ctx, cancelFunc := context.WithCancel(context.Background())
431-
t.Cleanup(cancelFunc)
432432
_ = srv.Serve(ctx, serverPipe)
433433
}()
434434
return sdkproto.NewDRPCProvisionerClient(provisionersdk.Conn(clientPipe))

scripts/datadog-cireport/main.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ func main() {
5959
}
6060
commitParts := strings.Split(string(commitData), ",")
6161

62+
branch := os.Getenv("GITHUB_HEAD_REF")
63+
if branch == "" {
64+
branch = os.Getenv("GITHUB_BASE_REF")
65+
}
66+
6267
tags := map[string]string{
6368
"service": "coder",
6469
"_dd.cireport_version": "2",
@@ -78,7 +83,7 @@ func main() {
7883
"ci.provider.name": "github",
7984
"ci.workspace_path": os.Getenv("GITHUB_WORKSPACE"),
8085

81-
"git.branch": os.Getenv("GITHUB_REF_NAME"),
86+
"git.branch": branch,
8287
"git.commit.sha": githubSHA,
8388
"git.repository_url": fmt.Sprintf("%s/%s.git", githubServerURL, githubRepository),
8489

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy