8000 Merge branch 'main' of github.com:/coder/coder into dk/prebuilds · coder/coder@4afd88e · GitHub
[go: up one dir, main page]

Skip to content

Commit 4afd88e

Browse files
committed
Merge branch 'main' of github.com:/coder/coder into dk/prebuilds
2 parents 97d314e + 5285c12 commit 4afd88e

Some content is hidden

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

45 files changed

+128
-25
lines changed

.github/dependabot.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ updates:
3737
# Update our Dockerfile.
3838
- package-ecosystem: "docker"
3939
directories:
40-
- "/dogfood/contents"
40+
- "/dogfood/coder"
41+
- "/dogfood/coder-envbuilder"
4142
- "/scripts"
4243
- "/examples/templates/docker/build"
4344
- "/examples/parameters/build"

.github/workflows/ci.yaml

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

173173
- name: Get golangci-lint cache dir
174174
run: |
175-
linter_ver=$(egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/contents/Dockerfile | cut -d '=' -f 2)
175+
linter_ver=$(egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/coder/Dockerfile | cut -d '=' -f 2)
176176
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v$linter_ver
177177
dir=$(golangci-lint cache status | awk '/Dir/ { print $2 }')
178178
echo "LINT_CACHE_DIR=$dir" >> $GITHUB_ENV

.github/workflows/dogfood.yaml

Lines changed: 32 additions & 7 deletions
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: 5G
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
@@ -68,7 +87,7 @@ jobs:
6887
project: b4q6ltmpzh
6988
token: ${{ secrets.DEPOT_TOKEN }}
7089
buildx-fallback: true
71-
context: "{{defaultContext}}:dogfood/contents"
90+
context: "{{defaultContext}}:dogfood/coder"
7291
pull: true
7392
save: true
7493
push: ${{ github.ref == 'refs/heads/main' }}
@@ -113,12 +132,18 @@ jobs:
113132

114133
- name: Terraform init and validate
115134
run: |
116-
cd dogfood
117-
terraform init -upgrade
135+
pushd dogfood/
136+
terraform init
137+
terraform validate
138+
popd
139+
pushd dogfood/coder
140+
terraform init
118141
terraform validate
119-
cd contents
120-
terraform init -upgrade
142+
popd
143+
pushd dogfood/coder-envbuilder
144+
terraform init
121145
terraform validate
146+
popd
122147
123148
- name: Get short commit SHA
124149
if: github.ref == 'refs/heads/main'
@@ -142,6 +167,6 @@ jobs:
142167
# Template source & details
143168
TF_VAR_CODER_TEMPLATE_NAME: ${{ secrets.CODER_TEMPLATE_NAME }}
144169
TF_VAR_CODER_TEMPLATE_VERSION: ${{ steps.vars.outputs.sha_short }}
145-
TF_VAR_CODER_TEMPLATE_DIR: ./contents
170+
TF_VAR_CODER_TEMPLATE_DIR: ./coder
146171
TF_VAR_CODER_TEMPLATE_MESSAGE: ${{ steps.message.outputs.pr_title }}
147172
TF_LOG: info

.github/workflows/security.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ jobs:
9999
# version in the comments will differ. This is also defined in
100100
# ci.yaml.
101101
set -euxo pipefail
102-
cd dogfood/contents
102+
cd dogfood/coder
103103
mkdir -p /usr/local/bin
104104
mkdir -p /usr/local/include
105105

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ lint/ts: site/node_modules/.installed
505505
lint/go:
506506
./scripts/check_enterprise_imports.sh
507507
./scripts/check_codersdk_imports.sh
508-
linter_ver=$(shell egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/contents/Dockerfile | cut -d '=' -f 2)
508+
linter_ver=$(shell egrep -o 'GOLANGCI_LINT_VERSION=\S+' dogfood/coder/Dockerfile | cut -d '=' -f 2)
509509
go run github.com/golangci/golangci-lint/cmd/golangci-lint@v$$linter_ver run
510510
.PHONY: lint/go
511511

@@ -963,5 +963,5 @@ else
963963
endif
964964
.PHONY: test-e2e
965965

966-
dogfood/contents/nix.hash: flake.nix flake.lock
967-
sha256sum flake.nix flake.lock >./dogfood/contents/nix.hash
966+
dogfood/coder/nix.hash: flake.nix flake.lock
967+
sha256sum flake.nix flake.lock >./dogfood/coder/nix.hash

envbuilder-dogfood/main.tf renamed to dogfood/coder-envbuilder/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ data "coder_parameter" "devcontainer_repo" {
4343
data "coder_parameter" "devcontainer_dir" {
4444
type = "string"
4545
name = "Devcontainer Directory"
46-
default = "dogfood/contents/"
46+
default = "dogfood/coder/"
4747
description = "Directory containing a devcontainer.json relative to the repository root"
4848
mutable = true
4949
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

dogfood/coder/nix.hash

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
f09cd2cbbcdf00f5e855c6ddecab6008d11d871dc4ca5e1bc90aa14d4e3a2cfd flake.nix
2+
0d2489a26d149dade9c57ba33acfdb309b38100ac253ed0c67a2eca04a187e37 flake.lock

dogfood/contents/update-keys.sh renamed to dogfood/coder/update-keys.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ gpg_flags=(
1515
--yes
1616
)
1717

18-
pushd "$PROJECT_ROOT/dogfood/contents/files/usr/share/keyrings"
18+
pushd "$PROJECT_ROOT/dogfood/coder/files/usr/share/keyrings"
1919

2020
# Ansible PPA signing key
2121
curl "${curl_flags[@]}" "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x6125e2a8c77f2818fb7bd15b93c4a3fd7bb9c367" |
File renamed without changes.

dogfood/contents/nix.hash

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

dogfood/main.tf

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ resource "coderd_template" "dogfood" {
3838
display_name = "Write Coder on Coder"
3939
description = "The template to use when developing Coder on Coder!"
4040
icon = "/emojis/1f3c5.png"
41-
organization_id = "703f72a1-76f6-4f89-9de6-8a3989693fe5"
41+
organization_id = data.coderd_organization.default.id
4242
versions = [
4343
{
4444
name = var.CODER_TEMPLATE_VERSION
@@ -73,3 +73,50 @@ resource "coderd_template" "dogfood" {
7373
time_til_dormant_autodelete_ms = 7776000000
7474
time_til_dormant_ms = 8640000000
7575
}
76+
77+
78+
resource "coderd_template" "envbuilder_dogfood" {
79+
name = "coder-envbuilder"
80+
display_name = "Write Coder on Coder using Envbuilder"
81+
description = "Write Coder on Coder using a workspace built by Envbuilder."
82+
icon = "/emojis/1f3d7.png" # 🏗️
83+
organization_id = data.coderd_organization.default.id
84+
versions = [
85+
{
86+
name = var.CODER_TEMPLATE_VERSION
87+
message = var.CODER_TEMPLATE_MESSAGE
88+
directory = "./coder-envbuilder"
89+
active = true
90+
tf_vars = [{
91+
# clusters/dogfood-v2/coder/provisioner/configs/values.yaml#L191-L194
92+
name = "envbuilder_cache_dockerconfigjson_path"
93+
value = "/home/coder/envbuilder-cache-dockerconfig.json"
94+
}]
95+
}
96+
]
97+
acl = {
98+
groups = [{
99+
id = data.coderd_organization.default.id
100+
role = "use"
101+
}]
102+
users = [{
103+
id = data.coderd_user.machine.id
104+
role = "admin"
105+
}]
106+
}
107+
activity_bump_ms = 10800000
108+
allow_user_auto_start = true
109+
allow_user_auto_stop = true
110+
allow_user_cancel_workspace_jobs = false
111+
auto_start_permitted_days_of_week = ["friday", "monday", "saturday", "sunday", "thursday", "tuesday", "wednesday"]
112+
auto_stop_requirement = {
113+
days_of_week = ["sunday"]
114+
weeks = 1
115+
}
116+
default_ttl_ms = 28800000
117+
deprecation_message = null
118+
failure_ttl_ms = 604800000
119+
require_active_version = true
120+
time_til_dormant_autodelete_ms = 7776000000
121+
time_til_dormant_ms = 8640000000
122+
}

flake.lock

Lines changed: 20 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 16 additions & 3 deletions
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; [

scripts/update-flake.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ echo "protoc-gen-go version: $PROTOC_GEN_GO_REV"
3737
PROTOC_GEN_GO_SHA256=$(nix-prefetch-git https://github.com/protocolbuffers/protobuf-go --rev "$PROTOC_GEN_GO_REV" | jq -r .hash)
3838
sed -i "s#\(sha256 = \"\)[^\"]*#\1${PROTOC_GEN_GO_SHA256}#" ./flake.nix
3939
40-
make dogfood/contents/nix.hash
40+
make dogfood/coder/nix.hash
4141
4242
echo "Flake updated successfully!"

0 commit comments

Comments
 (0)
0