Skip to content

Commit 97558ea

Browse files
authored
Merge branch 'main' into jsjoeio/fix-dogfood
2 parents 6f79f9d + a071bfa commit 97558ea

File tree

100 files changed

+2593
-1342
lines changed

Some content is hidden

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

100 files changed

+2593
-1342
lines changed

.github/workflows/coder.yaml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,9 @@ jobs:
274274
export PATH=${PATH}:$(go env GOPATH)/bin
275275
make --output-sync -j -B fmt
276276
277+
- name: Check for unstaged files
278+
run: ./scripts/check_unstaged.sh
279+
277280
test-go:
278281
name: "test/go"
279282
runs-on: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || matrix.os == 'windows-2022' && github.repository_owner == 'coder' && 'windows-latest-8-cores'|| matrix.os }}
@@ -336,7 +339,14 @@ jobs:
336339
echo ::set-output name=cover::false
337340
fi
338341
set -x
339-
gotestsum --junitfile="gotests.xml" --packages="./..." --debug -- -parallel=8 -timeout=3m -short -failfast $COVERAGE_FLAGS
342+
gotestsum --junitfile="gotests.xml" --jsonfile="gotestsum.json" --packages="./..." --debug -- -parallel=8 -timeout=3m -short -failfast $COVERAGE_FLAGS
343+
344+
- uses: actions/upload-artifact@v3
345+
if: success() || failure()
346+
with:
347+
name: gotestsum-debug-${{ matrix.os }}.json
348+
path: ./gotestsum.json
349+
retention-days: 7
340350

341351
- uses: codecov/codecov-action@v3
342352
# This action has a tendency to error out unexpectedly, it has
@@ -399,6 +409,13 @@ jobs:
399409
- name: Test with PostgreSQL Database
400410
run: make test-postgres
401411

412+
- uses: actions/upload-artifact@v3
413+
if: success() || failure()
414+
with:
415+
name: gotestsum-debug-postgres.json
416+
path: ./gotestsum.json
417+
retention-days: 7
418+
402419
- uses: codecov/codecov-action@v3
403420
# This action has a tendency to error out unexpectedly, it has
404421
# the `fail_ci_if_error` option that defaults to `false`, but

.github/workflows/packages.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@ jobs:
3535
3636
echo "Installer URL: $installer_url"
3737
38-
# version should be extracted from the installer
39-
wingetcreate update Coder.Coder `
38+
.\wingetcreate.exe update Coder.Coder `
4039
--submit `
4140
--version "${{ steps.version.outputs.version }}" `
4241
--urls "$installer_url" `

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ vendor
1515
yarn-error.log
1616
gotests.coverage
1717
gotests.xml
18+
gotestsum.json
1819
.idea
1920
.gitpod.yml
2021
.DS_Store

Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,10 @@ test: test-clean
471471
test-postgres: test-clean test-postgres-docker
472472
# The postgres test is prone to failure, so we limit parallelism for
473473
# more consistent execution.
474-
DB=ci DB_FROM=$(shell go run scripts/migrate-ci/main.go) gotestsum --junitfile="gotests.xml" --packages="./..." -- \
474+
DB=ci DB_FROM=$(shell go run scripts/migrate-ci/main.go) gotestsum \
475+
--junitfile="gotests.xml" \
476+
--jsonfile="gotestsum.json" \
477+
--packages="./..." -- \
475478
-covermode=atomic -coverprofile="gotests.coverage" -timeout=20m \
476479
-parallel=4 \
477480
-coverpkg=./... \

README.md

Lines changed: 17 additions & 12 deletions
Large diffs are not rendered by default.

agent/agent.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,16 @@ func (a *agent) run(ctx context.Context) error {
215215
return xerrors.Errorf("create tailnet: %w", err)
216216
}
217217
a.closeMutex.Lock()
218-
a.network = network
218+
// Re-check if agent was closed while initializing the network.
219+
closed := a.isClosed()
220+
if !closed {
221+
a.network = network
222+
}
219223
a.closeMutex.Unlock()
224+
if closed {
225+
_ = network.Close()
226+
return xerrors.New("agent is closed")
227+
}
220228
} else {
221229
// Update the DERP map!
222230
network.SetDERPMap(metadata.DERPMap)
@@ -246,27 +254,20 @@ func (a *agent) trackConnGoroutine(fn func()) error {
246254
}
247255

248256
func (a *agent) createTailnet(ctx context.Context, derpMap *tailcfg.DERPMap) (_ *tailnet.Conn, err error) {
249-
a.closeMutex.Lock()
250-
if a.isClosed() {
251-
a.closeMutex.Unlock()
252-
return nil, xerrors.New("closed")
253-
}
254257
network, err := tailnet.NewConn(&tailnet.Options{
255258
Addresses: []netip.Prefix{netip.PrefixFrom(codersdk.TailnetIP, 128)},
256259
DERPMap: derpMap,
257260
Logger: a.logger.Named("tailnet"),
258261
EnableTrafficStats: true,
259262
})
260263
if err != nil {
261-
a.closeMutex.Unlock()
262264
return nil, xerrors.Errorf("create tailnet: %w", err)
263265
}
264266
defer func() {
265267
if err != nil {
266268
network.Close()
267269
}
268270
}()
269-
a.closeMutex.Unlock()
270271

271272
sshListener, err := network.Listen("tcp", ":"+strconv.Itoa(codersdk.TailnetSSHPort))
272273
if err != nil {

0 commit comments

Comments
 (0)