Skip to content

Commit 161a9da

Browse files
committed
Merge branch 'main' into colorful-rebased
2 parents 5bd1a6e + 133dc66 commit 161a9da

File tree

291 files changed

+6496
-2542
lines changed

Some content is hidden

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

291 files changed

+6496
-2542
lines changed

.github/actions/setup-go/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: |
44
inputs:
55
version:
66
description: "The Go version to use."
7-
default: "1.20.11"
7+
default: "1.21.5"
88
runs:
99
using: "composite"
1010
steps:

.github/actions/setup-sqlc/action.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ runs:
77
- name: Setup sqlc
88
uses: sqlc-dev/setup-sqlc@v4
99
with:
10-
sqlc-version: "1.20.0"
10+
sqlc-version: "1.24.0"

.github/dependabot.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,6 @@ updates:
6262
# We need to coordinate terraform updates with the version hardcoded in
6363
# our Go code.
6464
- dependency-name: "terraform"
65-
groups:
66-
scripts-docker:
67-
patterns:
68-
- "*"
6965

7066
- package-ecosystem: "npm"
7167
directory: "/site/"

.github/fly-wsproxies/paris-coder.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ app = "paris-coder"
22
primary_region = "cdg"
33

44
[experimental]
5-
entrypoint = ["/opt/coder", "wsproxy", "server"]
5+
entrypoint = ["/bin/sh", "-c", "CODER_DERP_SERVER_RELAY_URL=\"http://[${FLY_PRIVATE_IP}]:3000\" /opt/coder wsproxy server"]
66
auto_rollback = true
77

88
[build]
99
image = "ghcr.io/coder/coder-preview:main"
1010

1111
[env]
12-
CODER_ACCESS_URL = "https://paris-coder.fly.dev"
12+
CODER_ACCESS_URL = "https://paris.fly.dev.coder.com"
1313
CODER_HTTP_ADDRESS = "0.0.0.0:3000"
1414
CODER_PRIMARY_ACCESS_URL = "https://dev.coder.com"
15+
CODER_WILDCARD_ACCESS_URL = "*--apps.paris.fly.dev.coder.com"
1516

1617
[http_service]
1718
internal_port = 3000
@@ -22,5 +23,5 @@ primary_region = "cdg"
2223

2324
[[vm]]
2425
cpu_kind = "shared"
25-
cpus = 1
26+
cpus = 2
2627
memory_mb = 512

.github/fly-wsproxies/sao-paulo-coder.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@ app = "sao-paulo-coder"
22
primary_region = "gru"
33

44
[experimental]
5-
entrypoint = ["/opt/coder", "wsproxy", "server"]
5+
entrypoint = ["/bin/sh", "-c", "CODER_DERP_SERVER_RELAY_URL=\"http://[${FLY_PRIVATE_IP}]:3000\" /opt/coder wsproxy server"]
66
auto_rollback = true
77

88
[build]
99
image = "ghcr.io/coder/coder-preview:main"
1010

1111
[env]
12-
CODER_ACCESS_URL = "https://sao-paulo-coder.fly.dev"
12+
CODER_ACCESS_URL = "https://sao-paulo.fly.dev.coder.com"
1313
CODER_HTTP_ADDRESS = "0.0.0.0:3000"
1414
CODER_PRIMARY_ACCESS_URL = "https://dev.coder.com"
15-
15+
CODER_WILDCARD_ACCESS_URL = "*--apps.sao-paulo.fly.dev.coder.com"
16+
1617
[http_service]
1718
internal_port = 3000
1819
force_https = true
@@ -22,5 +23,5 @@ primary_region = "gru"
2223

2324
[[vm]]
2425
cpu_kind = "shared"
25-
cpus = 1
26+
cpus = 2
2627
memory_mb = 512

.github/fly-wsproxies/sydney-coder.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@ app = "sydney-coder"
22
primary_region = "syd"
33

44
[experimental]
5-
entrypoint = ["/opt/coder", "wsproxy", "server"]
5+
entrypoint = ["/bin/sh", "-c", "CODER_DERP_SERVER_RELAY_URL=\"http://[${FLY_PRIVATE_IP}]:3000\" /opt/coder wsproxy server"]
66
auto_rollback = true
77

88
[build]
99
image = "ghcr.io/coder/coder-preview:main"
1010

1111
[env]
12-
CODER_ACCESS_URL = "https://sydney-coder.fly.dev"
12+
CODER_ACCESS_URL = "https://sydney.fly.dev.coder.com"
1313
CODER_HTTP_ADDRESS = "0.0.0.0:3000"
1414
CODER_PRIMARY_ACCESS_URL = "https://dev.coder.com"
15+
CODER_WILDCARD_ACCESS_URL = "*--apps.sydney.fly.dev.coder.com"
1516

1617
[http_service]
1718
internal_port = 3000
@@ -22,5 +23,5 @@ primary_region = "syd"
2223

2324
[[vm]]
2425
cpu_kind = "shared"
25-
cpus = 1
26+
cpus = 2
2627
memory_mb = 512

.github/workflows/ci.yaml

Lines changed: 66 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ jobs:
3636
ts: ${{ steps.filter.outputs.ts }}
3737
k8s: ${{ steps.filter.outputs.k8s }}
3838
ci: ${{ steps.filter.outputs.ci }}
39+
db: ${{ steps.filter.outputs.db }}
3940
offlinedocs-only: ${{ steps.filter.outputs.offlinedocs_count == steps.filter.outputs.all_count }}
4041
offlinedocs: ${{ steps.filter.outputs.offlinedocs }}
4142
steps:
@@ -57,6 +58,12 @@ jobs:
5758
- "examples/web-server/**"
5859
- "examples/monitoring/**"
5960
- "examples/lima/**"
61+
db:
62+
- "**.sql"
63+
- "coderd/database/queries/**"
64+
- "coderd/database/migrations"
65+
- "coderd/database/sqlc.yaml"
66+
- "coderd/database/dump.sql"
6067
go:
6168
- "**.sql"
6269
- "**.go"
@@ -137,7 +144,7 @@ jobs:
137144
138145
# Check for any typos
139146
- name: Check for typos
140-
uses: crate-ci/typos@v1.16.23
147+
uses: crate-ci/typos@v1.16.24
141148
with:
142149
config: .github/workflows/typos.toml
143150

@@ -221,7 +228,7 @@ jobs:
221228
with:
222229
# This doesn't need caching. It's super fast anyways!
223230
cache: false
224-
go-version: 1.20.11
231+
go-version: 1.21.5
225232

226233
- name: Install shfmt
227234
run: go install mvdan.cc/sh/v3/cmd/shfmt@v3.7.0
@@ -568,6 +575,16 @@ jobs:
568575
with:
569576
directory: offlinedocs
570577

578+
- name: Install Protoc
579+
run: |
580+
mkdir -p /tmp/proto
581+
pushd /tmp/proto
582+
curl -L -o protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v23.3/protoc-23.3-linux-x86_64.zip
583+
unzip protoc.zip
584+
cp -r ./bin/* /usr/local/bin
585+
cp -r ./include /usr/local/bin/include
586+
popd
587+
571588
- name: Setup Go
572589
uses: ./.github/actions/setup-go
573590

@@ -608,6 +625,7 @@ jobs:
608625
- test-js
609626
- test-e2e
610627
- offlinedocs
628+
- sqlc-vet
611629
# Allow this job to run even if the needed jobs fail, are skipped or
612630
# cancelled.
613631
if: always()
@@ -751,13 +769,16 @@ jobs:
751769
service_account: coder-ci@coder-dogfood.iam.gserviceaccount.com
752770

753771
- name: Set up Google Cloud SDK
754-
uses: google-github-actions/setup-gcloud@v1
772+
uses: google-github-actions/setup-gcloud@v2
755773

756774
- name: Set up Flux CLI
757775
uses: fluxcd/flux2/action@main
776+
with:
777+
# Keep this up to date with the version of flux installed in dogfood cluster
778+
version: "2.2.0"
758779

759780
- name: Get Cluster Credentials
760-
uses: "google-github-actions/get-gke-credentials@v1"
781+
uses: "google-github-actions/get-gke-credentials@v2"
761782
with:
762783
cluster_name: dogfood-v2
763784
location: us-central1-a
@@ -771,7 +792,9 @@ jobs:
771792
flux --namespace flux-system reconcile kustomization flux-system
772793
flux --namespace flux-system reconcile kustomization coder
773794
flux --namespace flux-system reconcile source chart coder-coder
795+
flux --namespace flux-system reconcile source chart coder-coder-provisioner
774796
flux --namespace coder reconcile helmrelease coder
797+
flux --namespace coder reconcile helmrelease coder-provisioner
775798
776799
# Just updating Flux is usually not enough. The Helm release may get
777800
# redeployed, but unless something causes the Deployment to update the
@@ -783,6 +806,8 @@ jobs:
783806
set -euxo pipefail
784807
kubectl --namespace coder rollout restart deployment/coder
785808
kubectl --namespace coder rollout status deployment/coder
809+
kubectl --namespace coder rollout restart deployment/coder-provisioner
810+
kubectl --namespace coder rollout status deployment/coder-provisioner
786811
787812
deploy-wsproxies:
788813
runs-on: ubuntu-latest
@@ -810,55 +835,28 @@ jobs:
810835
TOKEN_SAO_PAULO: ${{ secrets.FLY_SAO_PAULO_CODER_PROXY_SESSION_TOKEN }}
811836

812837
deploy-legacy-proxies:
813-
name: "deploy-legacy-proxies"
814-
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-16vcpu-ubuntu-2204' || 'ubuntu-latest' }}
838+
runs-on: ubuntu-latest
815839
timeout-minutes: 30
816-
needs: changes
817-
if: |
818-
github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
819-
&& needs.changes.outputs.docs-only == 'false'
840+
needs: build
841+
if: github.ref == 'refs/heads/main' && !github.event.pull_request.head.repo.fork
820842
permissions:
821843
contents: read
822844
id-token: write
823845
steps:
824-
- name: Checkout
825-
uses: actions/checkout@v4
826-
with:
827-
fetch-depth: 0
828-
829846
- name: Authenticate to Google Cloud
830847
uses: google-github-actions/auth@v2
831848
with:
832849
workload_identity_provider: projects/573722524737/locations/global/workloadIdentityPools/github/providers/github
833850
service_account: coder-ci@coder-dogfood.iam.gserviceaccount.com
834851

835852
- name: Set up Google Cloud SDK
836-
uses: google-github-actions/setup-gcloud@v1
837-
838-
- name: Setup Node
839-
uses: ./.github/actions/setup-node
840-
841-
- name: Setup Go
842-
uses: ./.github/actions/setup-go
843-
844-
- name: Install goimports
845-
run: go install golang.org/x/tools/cmd/goimports@latest
846-
- name: Install nfpm
847-
run: go install github.com/goreleaser/nfpm/v2/cmd/nfpm@v2.16.0
848-
849-
- name: Install zstd
850-
run: sudo apt-get install -y zstd
851-
852-
- name: Build Release
853-
run: |
854-
set -euo pipefail
855-
go mod download
853+
uses: google-github-actions/setup-gcloud@v2
856854

857-
version="$(./scripts/version.sh)"
858-
make gen/mark-fresh
859-
make -j \
860-
build/coder_"$version"_windows_amd64.zip \
861-
build/coder_"$version"_linux_amd64.{tar.gz,deb}
855+
- name: Download build artifacts
856+
uses: actions/download-artifact@v3
857+
with:
858+
name: coder
859+
path: ./build
862860

863861
- name: Install Release
864862
run: |
@@ -871,11 +869,11 @@ jobs:
871869
"southamerica-east1-b coder-brazil coder-workspace-proxy"
872870
)
873871
874-
deb_pkg="./build/coder_$(./scripts/version.sh)_linux_amd64.deb"
875-
if [ ! -f "$deb_pkg" ]; then
876-
echo "deb package not found: $deb_pkg"
877-
ls -l ./build
878-
exit 1
872+
deb_pkg=$(find ./build -name "coder_*_linux_amd64.deb" -print -quit)
873+
if [ -z "$deb_pkg" ]; then
874+
echo "deb package $deb_pkg not found"
875+
ls -l ./build
876+
exit 1
879877
fi
880878
881879
gcloud config set project coder-dogfood
@@ -891,3 +889,26 @@ jobs:
891889
892890
echo "::endgroup::"
893891
done
892+
893+
# sqlc-vet runs a postgres docker container, runs Coder migrations, and then
894+
# runs sqlc-vet to ensure all queries are valid. This catches any mistakes
895+
# in migrations or sqlc queries that makes a query unable to be prepared.
896+
sqlc-vet:
897+
runs-on: ${{ github.repository_owner == 'coder' && 'buildjet-8vcpu-ubuntu-2204' || 'ubuntu-latest' }}
898+
needs: changes
899+
if: needs.changes.outputs.db == 'true' || github.ref == 'refs/heads/main'
900+
steps:
901+
- name: Checkout
902+
uses: actions/checkout@v4
903+
with:
904+
fetch-depth: 1
905+
# We need golang to run the migration main.go
906+
- name: Setup Go
907+
uses: ./.github/actions/setup-go
908+
909+
- name: Setup sqlc
910+
uses: ./.github/actions/setup-sqlc
911+
912+
- name: Setup and run sqlc vet
913+
run: |
914+
make sqlc-vet

.github/workflows/dogfood.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- name: Get branch name
2525
id: branch-name
26-
uses: tj-actions/branch-names@v6.5
26+
uses: tj-actions/branch-names@v8
2727

2828
- name: "Branch name to Docker tag name"
2929
id: docker-tag-name
@@ -34,7 +34,7 @@ jobs:
3434
echo "tag=${tag}" >> $GITHUB_OUTPUT
3535
3636
- name: Set up Docker Buildx
37-
uses: docker/setup-buildx-action@v2
37+
uses: docker/setup-buildx-action@v3
3838

3939
- name: Login to DockerHub
4040
uses: docker/login-action@v3
@@ -43,7 +43,7 @@ jobs:
4343
password: ${{ secrets.DOCKERHUB_PASSWORD }}
4444

4545
- name: Build and push
46-
uses: docker/build-push-action@v4
46+
uses: docker/build-push-action@v5
4747
with:
4848
context: "{{defaultContext}}:dogfood"
4949
pull: true

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ jobs:
287287
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
288288

289289
- name: Setup GCloud SDK
290-
uses: "google-github-actions/setup-gcloud@v1"
290+
uses: "google-github-actions/setup-gcloud@v2"
291291

292292
- name: Publish Helm Chart
293293
if: ${{ !inputs.dry_run }}

.github/workflows/security.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ jobs:
122122
image_name: ${{ steps.build.outputs.image }}
123123

124124
- name: Run Trivy vulnerability scanner
125-
uses: aquasecurity/trivy-action@2b6a709cf9c4025c5438138008beaddbb02086f0
125+
uses: aquasecurity/trivy-action@91713af97dc80187565512baba96e4364e983601
126126
with:
127127
image-ref: ${{ steps.build.outputs.image }}
128128
format: sarif

.github/workflows/stale.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
actions: write
1414
steps:
1515
- name: stale
16-
uses: actions/stale@v8.0.0
16+
uses: actions/stale@v9.0.0
1717
with:
1818
stale-issue-label: "stale"
1919
stale-pr-label: "stale"

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,8 @@ lint/ts:
428428

429429
lint/go:
430430
./scripts/check_enterprise_imports.sh
431-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.2
431+
linter_ver=$(shell egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/Dockerfile | cut -d '=' -f 2)
432+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$$linter_ver
432433
golangci-lint run
433434
.PHONY: lint/go
434435

@@ -707,6 +708,12 @@ test:
707708
gotestsum --format standard-quiet -- -v -short -count=1 ./...
708709
.PHONY: test
709710

711+
sqlc-vet: test-postgres-docker
712+
echo "--- sqlc vet"
713+
SQLC_DATABASE_URL="postgresql://postgres:postgres@localhost:5432/$(shell go run scripts/migrate-ci/main.go)" \
714+
sqlc vet -f coderd/database/sqlc.yaml && echo "Passed sqlc vet"
715+
.PHONY: sqlc-vet
716+
710717
# When updating -timeout for this test, keep in sync with
711718
# test-go-postgres (.github/workflows/coder.yaml).
712719
# Do add coverage flags so that test caching works.

0 commit comments

Comments
 (0)