Skip to content

Commit 06befab

Browse files
committed
Merge branch 'main' into 5154/ttl-default/presleyp
2 parents 4558066 + 8d95285 commit 06befab

File tree

249 files changed

+16980
-2159
lines changed

Some content is hidden

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

249 files changed

+16980
-2159
lines changed

.github/semantic.yaml

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

.github/workflows/coder.yaml

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,23 @@ jobs:
338338
else
339339
echo ::set-output name=cover::false
340340
fi
341-
set -x
342-
gotestsum --junitfile="gotests.xml" --jsonfile="gotestsum.json" --packages="./..." --debug -- -parallel=8 -timeout=3m -short -failfast $COVERAGE_FLAGS
341+
set +e
342+
gotestsum --junitfile="gotests.xml" --jsonfile="gotestsum.json" --packages="./..." --debug -- -parallel=8 -timeout=5m -short -failfast $COVERAGE_FLAGS
343+
ret=$?
344+
if ((ret)); then
345+
# Eternalize test timeout logs because "re-run failed" erases
346+
# artifacts and gotestsum doesn't always capture it:
347+
# https://github.com/gotestyourself/gotestsum/issues/292
348+
# Multiple test packages could've failed, each one may or may
349+
# not run into the edge case. PS. Don't summon ShellCheck here.
350+
for testWithStack in $(grep 'panic: test timed out' gotestsum.json | grep -E -o '("Test":[^,}]*)'); do
351+
if [ -n "$testWithStack" ] && grep -q "${testWithStack}.*PASS" gotestsum.json; then
352+
echo "Conditions met for gotestsum stack trace missing bug, outputting panic trace:"
353+
grep -A 999999 "${testWithStack}.*panic: test timed out" gotestsum.json
354+
fi
355+
done
356+
fi
357+
exit $ret
343358
344359
- uses: actions/upload-artifact@v3
345360
if: success() || failure()
@@ -348,6 +363,13 @@ jobs:
348363
path: ./gotestsum.json
349364
retention-days: 7
350365

366+
- uses: actions/upload-artifact@v3
367+
if: success() || failure()
368+
with:
369+
name: gotests-${{ matrix.os }}.xml
370+
path: ./gotests.xml
371+
retention-days: 30
372+
351373
- uses: codecov/codecov-action@v3
352374
# This action has a tendency to error out unexpectedly, it has
353375
# the `fail_ci_if_error` option that defaults to `false`, but
@@ -407,7 +429,24 @@ jobs:
407429
terraform_wrapper: false
408430

409431
- name: Test with PostgreSQL Database
410-
run: make test-postgres
432+
run: |
433+
set +e
434+
make test-postgres
435+
ret=$?
436+
if ((ret)); then
437+
# Eternalize test timeout logs because "re-run failed" erases
438+
# artifacts and gotestsum doesn't always capture it:
439+
# https://github.com/gotestyourself/gotestsum/issues/292
440+
# Multiple test packages could've failed, each one may or may
441+
# not run into the edge case. PS. Don't summon ShellCheck here.
442+
for testWithStack in $(grep 'panic: test timed out' gotestsum.json | grep -E -o '("Test":[^,}]*)'); do
443+
if [ -n "$testWithStack" ] && grep -q "${testWithStack}.*PASS" gotestsum.json; then
444+
echo "Conditions met for gotestsum stack trace missing bug, outputting panic trace:"
445+
grep -A 999999 "${testWithStack}.*panic: test timed out" gotestsum.json
446+
fi
447+
done
448+
fi
449+
exit $ret
411450
412451
- uses: actions/upload-artifact@v3
413452
if: success() || failure()
@@ -416,6 +455,13 @@ jobs:
416455
path: ./gotestsum.json
417456
retention-days: 7
418457

458+
- uses: actions/upload-artifact@v3
459+
if: success() || failure()
460+
with:
461+
name: gotests-postgres.xml
462+
path: ./gotests.xml
463+
retention-days: 30
464+
419465
- uses: codecov/codecov-action@v3
420466
# This action has a tendency to error out unexpectedly, it has
421467
# the `fail_ci_if_error` option that defaults to `false`, but

.github/workflows/pr.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint PR
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- reopened
8+
- edited
9+
- synchronize
10+
11+
jobs:
12+
main:
13+
name: Validate PR title
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: amannn/action-semantic-pull-request@v5
17+
env:
18+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
with:
20+
requireScope: false

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ jobs:
157157

158158
- name: Publish release
159159
run: |
160-
./scripts/publish_release.sh \
160+
./scripts/release/publish.sh \
161161
${{ (github.event.inputs.dry_run || github.event.inputs.snapshot) && '--dry-run' }} \
162162
./build/*_installer.exe \
163163
./build/*.zip \

Dockerfile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ LABEL \
1414
org.opencontainers.image.source="https://github.com/coder/coder" \
1515
org.opencontainers.image.version="$CODER_VERSION"
1616

17-
# The coder binary is injected by scripts/build_docker.sh.
18-
COPY --chown=coder:coder --chmod=755 coder /opt/coder
19-
2017
# Create coder group and user. We cannot use `addgroup` and `adduser` because
2118
# they won't work if we're building the image for a different architecture.
22-
COPY --chown=root:root --chmod=644 group passwd /etc/
23-
COPY --chown=coder:coder --chmod=700 empty-dir /home/coder
19+
COPY --chown=0:0 --chmod=644 group passwd /etc/
20+
COPY --chown=1000:1000 --chmod=700 empty-dir /home/coder
21+
22+
# The coder binary is injected by scripts/build_docker.sh.
23+
COPY --chown=1000:1000 --chmod=755 coder /opt/coder
2424

25-
USER coder:coder
25+
USER 1000:1000
2626
ENV HOME=/home/coder
2727
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt
2828
WORKDIR /home/coder

Makefile

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

47+
# Common paths to exclude from find commands, this rule is written so
48+
# that it can be it can be used in a chain of AND statements (meaning
49+
# you can simply write `find . $(FIND_EXCLUSIONS) -name thing-i-want`).
50+
# Note, all find statements should be written with `.` or `./path` as
51+
# the search path so that these exclusions match.
52+
FIND_EXCLUSIONS= \
53+
-not \( \( -path '*/.git/*' -o -path './build/*' -o -path './vendor/*' -o -path './.coderv2/*' -o -path '*/node_modules/*' -o -path './site/out/*' \) -prune \)
4754
# 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')
55+
GO_SRC_FILES = $(shell find . $(FIND_EXCLUSIONS) -type f -name '*.go')
4956
# 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')
57+
SHELL_SRC_FILES = $(shell find . $(FIND_EXCLUSIONS) -type f -name '*.sh')
5158

5259
# All ${OS}_${ARCH} combos we build for. Windows binaries have the .exe suffix.
5360
OS_ARCHES := \
@@ -101,27 +108,30 @@ build-fat build-full build: $(CODER_FAT_BINARIES)
101108
release: $(CODER_FAT_BINARIES) $(CODER_ALL_ARCHIVES) $(CODER_ALL_PACKAGES) $(CODER_ARCH_IMAGES) build/coder_helm_$(VERSION).tgz
102109
.PHONY: release
103110

104-
build/coder-slim_$(VERSION)_checksums.sha1 site/out/bin/coder.sha1: $(CODER_SLIM_BINARIES)
111+
build/coder-slim_$(VERSION)_checksums.sha1: site/out/bin/coder.sha1
112+
cp "$<" "$@"
113+
114+
site/out/bin/coder.sha1: $(CODER_SLIM_BINARIES)
105115
pushd ./site/out/bin
106116
openssl dgst -r -sha1 coder-* | tee coder.sha1
107117
popd
108118

109-
cp "site/out/bin/coder.sha1" "build/coder-slim_$(VERSION)_checksums.sha1"
110-
111119
build/coder-slim_$(VERSION).tar: build/coder-slim_$(VERSION)_checksums.sha1 $(CODER_SLIM_BINARIES)
112120
pushd ./site/out/bin
113121
tar cf "../../../build/$(@F)" coder-*
114122
popd
115123

116-
build/coder-slim_$(VERSION).tar.zst site/out/bin/coder.tar.zst: build/coder-slim_$(VERSION).tar
124+
site/out/bin/coder.tar.zst: build/coder-slim_$(VERSION).tar.zst
125+
cp "$<" "$@"
126+
127+
build/coder-slim_$(VERSION).tar.zst: build/coder-slim_$(VERSION).tar
117128
zstd $(ZSTDFLAGS) \
118129
--force \
119130
--long \
120131
--no-progress \
121132
-o "build/coder-slim_$(VERSION).tar.zst" \
122133
"build/coder-slim_$(VERSION).tar"
123134

124-
cp "build/coder-slim_$(VERSION).tar.zst" "site/out/bin/coder.tar.zst"
125135
# delete the uncompressed binaries from the embedded dir
126136
rm site/out/bin/coder-*
127137

@@ -338,7 +348,7 @@ build/coder_helm_$(VERSION).tgz:
338348
--version "$(VERSION)" \
339349
--output "$@"
340350

341-
site/out/index.html: site/package.json $(shell find ./site -not -path './site/node_modules/*' -type f \( -name '*.ts' -o -name '*.tsx' \))
351+
site/out/index.html: site/package.json $(shell find ./site $(FIND_EXCLUSIONS) -type f \( -name '*.ts' -o -name '*.tsx' \))
342352
./scripts/yarn_install.sh
343353
cd site
344354
yarn build
@@ -400,13 +410,14 @@ gen: \
400410
provisionersdk/proto/provisioner.pb.go \
401411
provisionerd/proto/provisionerd.pb.go \
402412
site/src/api/typesGenerated.ts \
403-
docs/admin/prometheus.md
413+
docs/admin/prometheus.md \
414+
coderd/apidoc/swagger.json
404415
.PHONY: gen
405416

406417
# Mark all generated files as fresh so make thinks they're up-to-date. This is
407418
# used during releases so we don't run generation scripts.
408419
gen/mark-fresh:
409-
files="coderd/database/dump.sql coderd/database/querier.go provisionersdk/proto/provisioner.pb.go provisionerd/proto/provisionerd.pb.go site/src/api/typesGenerated.ts docs/admin/prometheus.md"
420+
files="coderd/database/dump.sql coderd/database/querier.go provisionersdk/proto/provisioner.pb.go provisionerd/proto/provisionerd.pb.go site/src/api/typesGenerated.ts docs/admin/prometheus.md coderd/apidoc/swagger.json"
410421
for file in $$files; do
411422
echo "$$file"
412423
if [ ! -f "$$file" ]; then
@@ -444,7 +455,7 @@ provisionerd/proto/provisionerd.pb.go: provisionerd/proto/provisionerd.proto
444455
--go-drpc_opt=paths=source_relative \
445456
./provisionerd/proto/provisionerd.proto
446457

447-
site/src/api/typesGenerated.ts: scripts/apitypings/main.go $(shell find codersdk -type f -name '*.go')
458+
site/src/api/typesGenerated.ts: scripts/apitypings/main.go $(shell find ./codersdk $(FIND_EXCLUSIONS) -type f -name '*.go')
448459
go run scripts/apitypings/main.go > site/src/api/typesGenerated.ts
449460
cd site
450461
yarn run format:types
@@ -454,6 +465,11 @@ docs/admin/prometheus.md: scripts/metricsdocgen/main.go scripts/metricsdocgen/me
454465
cd site
455466
yarn run format:write ../docs/admin/prometheus.md
456467

468+
coderd/apidoc/swagger.json: $(shell find ./scripts/apidocgen -not \( -path './scripts/apidocgen/node_modules' -prune \) -type f) $(wildcard coderd/*.go) $(wildcard codersdk/*.go)
469+
./scripts/apidocgen/generate.sh
470+
cd site
471+
yarn run format:write ../docs/api ../docs/manifest.json ../coderd/apidoc/swagger.json
472+
457473
update-golden-files: cli/testdata/.gen-golden
458474
.PHONY: update-golden-files
459475

0 commit comments

Comments
 (0)