Skip to content

Commit ee9a6f8

Browse files
committed
chore: update terraform to 1.11.1 in nix image
Change-Id: I05d6dfd3f3cf1af48cf8a2d9e61b396bcd2b7191 Signed-off-by: Thomas Kosiewski <tk@coder.com>
1 parent 09dd69a commit ee9a6f8

File tree

8 files changed

+408
-29
lines changed

8 files changed

+408
-29
lines changed

.github/workflows/dogfood.yaml

+25-12
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,26 @@ jobs:
3535
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3636

3737
- name: Setup Nix
38-
uses: DeterminateSystems/nix-installer-action@e50d5f73bfe71c2dd0aa4218de8f4afa59f8f81d # v16
38+
uses: nixbuild/nix-quick-install-action@5bb6a3b3abe66fd09bbf250dce8ada94f856a703 # v30
39+
40+
- uses: nix-community/cache-nix-action@aee88ae5efbbeb38ac5d9862ecbebdb404a19e69 # v6.1.1
41+
with:
42+
# restore and save a cache using this key
43+
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
44+
# if there's no cache hit, restore a cache by this prefix
45+
restore-prefixes-first-match: nix-${{ runner.os }}-
46+
# collect garbage until Nix store size (in bytes) is at most this number
47+
# before trying to save a new cache
48+
# 1G = 1073741824
49+
gc-max-store-size-linux: 2G
50+
# do purge caches
51+
purge: true
52+
# purge all versions of the cache
53+
purge-prefixes: nix-${{ runner.os }}-
54+
# created more than this number of seconds ago relative to the start of the `Post Restore` phase
55+
purge-created: 0
56+
# except the version with the `primary-key`, if it exists
57+
purge-primary-key: never
3958

4059
- name: Get branch name
4160
id: branch-name
@@ -113,18 +132,12 @@ jobs:
113132

114133
- name: Terraform init and validate
115134
run: |
116-
pushd dogfood/
117-
terraform init
118-
terraform validate
119-
popd
120-
pushd dogfood/coder
121-
terraform init
135+
cd dogfood
136+
terraform init -upgrade
122137
terraform validate
123-
popd
124-
pushd dogfood/coder-envbuilder
125-
terraform init
138+
cd contents
139+
terraform init -upgrade
126140
terraform validate
127-
popd
128141
129142
- name: Get short commit SHA
130143
if: github.ref == 'refs/heads/main'
@@ -148,6 +161,6 @@ jobs:
148161
# Template source & details
149162
TF_VAR_CODER_TEMPLATE_NAME: ${{ secrets.CODER_TEMPLATE_NAME }}
150163
TF_VAR_CODER_TEMPLATE_VERSION: ${{ steps.vars.outputs.sha_short }}
151-
TF_VAR_CODER_TEMPLATE_DIR: ./coder
164+
TF_VAR_CODER_TEMPLATE_DIR: ./contents
152165
TF_VAR_CODER_TEMPLATE_MESSAGE: ${{ steps.message.outputs.pr_title }}
153166
TF_LOG: info

CLAUDE.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Coder Development Guide
2+
3+
## Build & Test Commands
4+
5+
- Build all: `make build-fat` or `make build`
6+
- Build slim version: `make build-slim`
7+
- Run all tests: `make test`
8+
- Run single test: `go test ./path/to/package -run=TestName`
9+
- Run tests with race detection: `make test-race`
10+
- Format code: `make fmt`
11+
- Lint code: `make lint`
12+
- Generate code: `make gen`
13+
14+
## Code Style Guidelines
15+
16+
- **Imports**: Standard lib first, third-party second, local imports last; alphabetized within groups
17+
- **Formatting**: Use `make fmt/go` for Go, `make fmt/ts` for TypeScript
18+
- **Naming**: CamelCase for exported, camelCase for unexported names; no "I" prefix for interfaces
19+
- **Error Handling**: Return errors with context using appropriate wrapping
20+
- **Testing**: Place tests in `*_test.go` files; use `t.Parallel()` when appropriate; use helper functions from `testutil`
21+
- **Comments**: Document exported functions, types, and constants
22+
23+
## Common Development Tasks
24+
25+
- Make changes to database: Update migrations and run `make gen/db`
26+
- End-to-end testing: `make test-e2e`
27+
- Clean build artifacts: `make clean`

dogfood/coder/nix.hash

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
f41c80bd08bfef063a9cfe907d0ea1f377974ebe011751f64008a3a07a6b152a flake.nix
2-
32c441011f1f3054a688c036a85eac5e4c3dbef0f8cfa4ab85acd82da577dc35 flake.lock
1+
f09cd2cbbcdf00f5e855c6ddecab6008d11d871dc4ca5e1bc90aa14d4e3a2cfd flake.nix
2+
0d2489a26d149dade9c57ba33acfdb309b38100ac253ed0c67a2eca04a187e37 flake.lock

flake.lock

+20-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

+16-3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
inputs = {
55
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
6+
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
67
nixpkgs-pinned.url = "github:nixos/nixpkgs/5deee6281831847857720668867729617629ef1f";
78
flake-utils.url = "github:numtide/flake-utils";
89
pnpm2nix = {
@@ -22,6 +23,7 @@
2223
self,
2324
nixpkgs,
2425
nixpkgs-pinned,
26+
nixpkgs-unstable,
2527
flake-utils,
2628
drpc,
2729
pnpm2nix,
@@ -31,7 +33,7 @@
3133
let
3234
pkgs = import nixpkgs {
3335
inherit system;
34-
# Workaround for: terraform has an unfree license (‘bsl11’), refusing to evaluate.
36+
# Workaround for: google-chrome has an unfree license (‘unfree’), refusing to evaluate.
3537
config.allowUnfree = true;
3638
};
3739

@@ -41,6 +43,17 @@
4143
inherit system;
4244
};
4345

46+
unstablePkgs = import nixpkgs-unstable {
47+
inherit system;
48+
49+
# Workaround for: terraform has an unfree license (‘bsl11’), refusing to evaluate.
50+
config.allowUnfreePredicate =
51+
pkg:
52+
builtins.elem (pkgs.lib.getName pkg) [
53+
"terraform"
54+
];
55+
};
56+
4457
formatter = pkgs.nixfmt-rfc-style;
4558

4659
nodejs = pkgs.nodejs_20;
@@ -148,7 +161,7 @@
148161
shellcheck
149162
(pinnedPkgs.shfmt)
150163
sqlc
151-
terraform
164+
unstablePkgs.terraform
152165
typos
153166
which
154167
# Needed for many LD system libs!
@@ -185,7 +198,7 @@
185198
name = "coder-${osArch}";
186199
# Updated with ./scripts/update-flake.sh`.
187200
# This should be updated whenever go.mod changes!
188-
vendorHash = "sha256-QjqF+QZ5JKMnqkpNh6ZjrJU2QcSqiT4Dip1KoicwLYc=";
201+
vendorHash = "sha256-6sdvX0Wglj0CZiig2VD45JzuTcxwg7yrGoPPQUYvuqU=";
189202
proxyVendor = true;
190203
src = ./.;
191204
nativeBuildInputs = with pkgs; [

tailnet/configmaps.go

+6
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ type configMaps struct {
7777
derpMap *tailcfg.DERPMap
7878
logger slog.Logger
7979
blockEndpoints bool
80+
// endpointFilterFn is a callback that filters endpoints based on network conditions
81+
// This approach avoids a cyclic dependency between configMaps and Conn
82+
endpointFilterFn func(endpoints []string) []string
8083

8184
// for testing
8285
clock quartz.Clock
@@ -241,6 +244,9 @@ func (c *configMaps) peerConfigLocked() []*tailcfg.Node {
241244
n := p.node.Clone()
242245
if c.blockEndpoints {
243246
n.Endpoints = nil
247+
} else if c.endpointFilterFn != nil && len(n.Endpoints) > 0 {
248+
// Filter endpoints based on MTU to avoid connection issues with low-MTU interfaces
249+
n.Endpoints = c.endpointFilterFn(n.Endpoints)
244250
}
245251
out = append(out, n)
246252
}

0 commit comments

Comments
 (0)