Skip to content

Commit 1436324

Browse files
committed
Merge branch 'main' into provisionerdaemons
2 parents 200e652 + 09ee844 commit 1436324

File tree

365 files changed

+17072
-5893
lines changed

Some content is hidden

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

365 files changed

+17072
-5893
lines changed

.github/ISSUE_TEMPLATE/external_bug_report.md

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

.github/workflows/coder.yaml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ jobs:
8989
style-lint-golangci:
9090
name: style/lint/golangci
9191
timeout-minutes: 5
92-
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
92+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
9393
steps:
9494
- uses: actions/checkout@v3
9595
- uses: actions/setup-go@v3
@@ -171,7 +171,7 @@ jobs:
171171
gen:
172172
name: "style/gen"
173173
timeout-minutes: 8
174-
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
174+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
175175
needs: changes
176176
if: needs.changes.outputs.docs-only == 'false'
177177
steps:
@@ -276,7 +276,7 @@ jobs:
276276
277277
test-go:
278278
name: "test/go"
279-
runs-on: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || matrix.os }}
279+
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 }}
280280
timeout-minutes: 20
281281
strategy:
282282
matrix:
@@ -315,7 +315,7 @@ jobs:
315315
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
316316
with:
317317
repo: gotestyourself/gotestsum
318-
tag: v1.7.0
318+
tag: v1.8.2
319319

320320
- uses: hashicorp/setup-terraform@v2
321321
with:
@@ -336,11 +336,7 @@ jobs:
336336
echo ::set-output name=cover::false
337337
fi
338338
set -x
339-
test_timeout=5m
340-
if [[ "${{ matrix.os }}" == windows* ]]; then
341-
test_timeout=10m
342-
fi
343-
gotestsum --junitfile="gotests.xml" --packages="./..." -- -parallel=8 -timeout=$test_timeout -short -failfast $COVERAGE_FLAGS
339+
gotestsum --junitfile="gotests.xml" --packages="./..." -- -parallel=8 -timeout=3m -short -failfast $COVERAGE_FLAGS
344340
345341
- uses: codecov/codecov-action@v3
346342
# This action has a tendency to error out unexpectedly, it has
@@ -356,7 +352,7 @@ jobs:
356352

357353
test-go-postgres:
358354
name: "test/go/postgres"
359-
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
355+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
360356
# This timeout must be greater than the timeout set by `go test` in
361357
# `make test-postgres` to ensure we receive a trace of running
362358
# goroutines. Setting this to the timeout +5m should work quite well
@@ -393,7 +389,7 @@ jobs:
393389
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
394390
with:
395391
repo: gotestyourself/gotestsum
396-
tag: v1.7.0
392+
tag: v1.8.2
397393

398394
- uses: hashicorp/setup-terraform@v2
399395
with:
@@ -417,7 +413,7 @@ jobs:
417413

418414
deploy:
419415
name: "deploy"
420-
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
416+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
421417
timeout-minutes: 30
422418
needs: changes
423419
if: |
@@ -514,7 +510,7 @@ jobs:
514510

515511
test-js:
516512
name: "test/js"
517-
runs-on: ubuntu-latest
513+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
518514
timeout-minutes: 20
519515
steps:
520516
- uses: actions/checkout@v3

.github/workflows/packages.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Submit Packages
2+
on:
3+
release:
4+
types: [published]
5+
6+
env:
7+
CODER_VERSION: "${{ github.event.release.tag_name }}"
8+
9+
jobs:
10+
winget:
11+
runs-on: windows-latest
12+
steps:
13+
- name: Install wingetcreate
14+
run: |
15+
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
16+
17+
# the package version is the same as the release tag without the leading
18+
# "v", and with a trailing ".0" (e.g. "v1.2.3" -> "1.2.3.0")
19+
- name: Calculate package version
20+
id: version
21+
run: |
22+
$version = $env:CODER_VERSION -replace "^v", ""
23+
$version += ".0"
24+
echo "::set-output name=version::$version"
25+
26+
- name: Submit updated manifest to winget-pkgs
27+
run: |
28+
$release_assets = gh release view --repo coder/coder "$env:CODER_VERSION" --json assets | `
29+
ConvertFrom-Json
30+
31+
$installer_url = $release_assets.assets | `
32+
Where-Object name -Match ".*_windows_amd64_installer.exe$" | `
33+
Select -ExpandProperty url
34+
35+
echo "Installer URL: $installer_url"
36+
37+
# version should be extracted from the installer
38+
wingetcreate update Coder.Coder `
39+
--submit `
40+
--version "${{ steps.version.outputs.version }}" `
41+
--urls "$installer_url" `
42+
--token "${{ secrets.CDRCI_GITHUB_TOKEN }}"
43+
44+
- name: Comment on PR
45+
run: |
46+
# find the PR that wingetcreate just made
47+
$pr_list = gh pr list --repo microsoft/winget-pkgs --search "author:cdrci Coder.Coder version ${{ steps.version.outputs.version }}" --limit 1 --json number | `
48+
ConvertFrom-Json`
49+
$pr_number = $pr_list[0].number
50+
51+
gh pr comment --repo microsoft/winget-pkgs "$pr_number" --body "🤖 cc: @deansheather"

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ env:
2828

2929
jobs:
3030
release:
31-
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
31+
runs-on: ${{ github.repository_owner == 'coder' && 'ubuntu-latest-16-cores' || 'ubuntu-latest' }}
3232
env:
3333
# Necessary for Docker manifest
3434
DOCKER_CLI_EXPERIMENTAL: "enabled"

.github/workflows/stale.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ jobs:
1515
# https://github.com/actions/stale/pull/775
1616
- uses: actions/stale@v6.0.0
1717
with:
18-
stale-issue-label: stale
19-
stale-pr-label: stale
18+
stale-issue-label: 'stale'
19+
stale-pr-label: 'stale'
20+
exempt-issue-labels: 'never stale'
21+
exempt-pr-labels: 'never stale'
2022
# Pull Requests become stale more quickly due to merge conflicts.
2123
# Also, we promote minimizing WIP.
2224
days-before-pr-stale: 7

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@ site/out/
4949
**/*.swp
5050
.coderv2/*
5151
**/__debug_bin
52+
53+
# direnv
54+
.envrc

Makefile

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ else
4444
ZSTDFLAGS := -6
4545
endif
4646

47+
# Source files used for make targets, evaluated on use.
48+
GO_SRC_FILES = $(shell find . -not \( -path './.git/*' -o -path './build/*' -o -path './vendor/*' -o -path './.coderv2/*' -o -path './site/node_modules/*' -o -path './site/out/*' \) -type f -name '*.go')
49+
# All the shell files in the repo, excluding ignored files.
50+
SHELL_SRC_FILES = $(shell find . -not \( -path './.git/*' -o -path './build/*' -o -path './vendor/*' -o -path './.coderv2/*' -o -path './site/node_modules/*' -o -path './site/out/*' \) -type f -name '*.sh')
51+
4752
# All ${OS}_${ARCH} combos we build for. Windows binaries have the .exe suffix.
4853
OS_ARCHES := \
4954
linux_amd64 linux_arm64 linux_armv7 \
@@ -171,7 +176,7 @@ endef
171176
# You should probably use the non-version targets above instead if you're
172177
# calling this manually.
173178
$(CODER_ALL_BINARIES): go.mod go.sum \
174-
$(shell find . -not -path './vendor/*' -type f -name '*.go') \
179+
$(GO_SRC_FILES) \
175180
$(shell find ./examples/templates)
176181

177182
$(get-mode-os-arch-ext)
@@ -333,7 +338,7 @@ build/coder_helm_$(VERSION).tgz:
333338
--version "$(VERSION)" \
334339
--output "$@"
335340

336-
site/out/index.html: $(shell find ./site -not -path './site/node_modules/*' -type f -name '*.tsx') $(shell find ./site -not -path './site/node_modules/*' -type f -name '*.ts') site/package.json
341+
site/out/index.html: site/package.json $(shell find ./site -not -path './site/node_modules/*' -type f \( -name '*.ts' -o -name '*.tsx' \))
337342
./scripts/yarn_install.sh
338343
cd site
339344
yarn build
@@ -364,13 +369,13 @@ fmt/terraform: $(wildcard *.tf)
364369
terraform fmt -recursive
365370
.PHONY: fmt/terraform
366371

367-
fmt/shfmt: $(shell shfmt -f .)
372+
fmt/shfmt: $(SHELL_SRC_FILES)
368373
echo "--- shfmt"
369374
# Only do diff check in CI, errors on diff.
370375
ifdef CI
371-
shfmt -d $(shell shfmt -f .)
376+
shfmt -d $(SHELL_SRC_FILES)
372377
else
373-
shfmt -w $(shell shfmt -f .)
378+
shfmt -w $(SHELL_SRC_FILES)
374379
endif
375380
.PHONY: fmt/shfmt
376381

@@ -383,9 +388,9 @@ lint/go:
383388
.PHONY: lint/go
384389

385390
# Use shfmt to determine the shell files, takes editorconfig into consideration.
386-
lint/shellcheck: $(shell shfmt -f .)
391+
lint/shellcheck: $(SHELL_SRC_FILES)
387392
echo "--- shellcheck"
388-
shellcheck --external-sources $(shell shfmt -f .)
393+
shellcheck --external-sources $(SHELL_SRC_FILES)
389394
.PHONY: lint/shellcheck
390395

391396
# all gen targets should be added here and to gen/mark-fresh
@@ -446,8 +451,7 @@ site/src/api/typesGenerated.ts: scripts/apitypings/main.go $(shell find codersdk
446451
update-golden-files: cli/testdata/.gen-golden
447452
.PHONY: update-golden-files
448453

449-
cli/testdata/.gen-golden: $(wildcard cli/testdata/*.golden) \
450-
$(shell find . -not -path './vendor/*' -type f -name '*.go')
454+
cli/testdata/.gen-golden: $(wildcard cli/testdata/*.golden) $(GO_SRC_FILES)
451455

452456
go test ./cli -run=TestCommandHelp -update
453457
touch "$@"
@@ -459,8 +463,11 @@ test: test-clean
459463
# When updating -timeout for this test, keep in sync with
460464
# test-go-postgres (.github/workflows/coder.yaml).
461465
test-postgres: test-clean test-postgres-docker
466+
# The postgres test is prone to failure, so we limit parallelism for
467+
# more consistent execution.
462468
DB=ci DB_FROM=$(shell go run scripts/migrate-ci/main.go) gotestsum --junitfile="gotests.xml" --packages="./..." -- \
463469
-covermode=atomic -coverprofile="gotests.coverage" -timeout=20m \
470+
-parallel=4 \
464471
-coverpkg=./... \
465472
-count=1 -race -failfast
466473
.PHONY: test-postgres

0 commit comments

Comments
 (0)