Skip to content

Commit aaaa89d

Browse files
committed
Merge branch 'main' into brett-60111/add-pagination-for-organizations-members-table
2 parents 1f6b13c + 5285c12 commit aaaa89d

File tree

145 files changed

+798
-669
lines changed

Some content is hidden

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

145 files changed

+798
-669
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

.vscode/markdown.code-snippets

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
// For info about snippets, visit https://code.visualstudio.com/docs/editor/userdefinedsnippets
3+
// https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts
34

4-
"admonition": {
5-
"prefix": "#callout",
5+
"alert": {
6+
"prefix": "#alert",
67
"body": [
7-
"<blockquote class=\"admonition ${1|caution,important,note,tip,warning|}\">\n",
8-
"${TM_SELECTED_TEXT:${2:add info here}}\n",
9-
"</blockquote>\n"
8+
"> [!${1|CAUTION,IMPORTANT,NOTE,TIP,WARNING|}]",
9+
"> ${TM_SELECTED_TEXT:${2:add info here}}\n"
1010
],
11-
"description": "callout admonition caution info note tip warning"
11+
"description": "callout admonition caution important note tip warning"
1212
},
1313
"fenced code block": {
1414
"prefix": "#codeblock",
@@ -23,9 +23,8 @@
2323
"premium-feature": {
2424
"prefix": "#premium-feature",
2525
"body": [
26-
"<blockquote class=\"info\">\n",
27-
"${1:feature} ${2|is,are|} an Enterprise and Premium feature. [Learn more](https://coder.com/pricing#compare-plans).\n",
28-
"</blockquote>"
26+
"> [!NOTE]\n",
27+
"> ${1:feature} ${2|is,are|} an Enterprise and Premium feature. [Learn more](https://coder.com/pricing#compare-plans).\n"
2928
]
3029
},
3130
"tabs": {

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

agent/agent_test.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ import (
5151
"github.com/coder/coder/v2/agent/agentssh"
5252
"github.com/coder/coder/v2/agent/agenttest"
5353
"github.com/coder/coder/v2/agent/proto"
54+
"github.com/coder/coder/v2/agent/usershell"
5455
"github.com/coder/coder/v2/codersdk"
5556
"github.com/coder/coder/v2/codersdk/agentsdk"
5657
"github.com/coder/coder/v2/codersdk/workspacesdk"
@@ -1193,6 +1194,53 @@ func TestAgent_SSHConnectionEnvVars(t *testing.T) {
11931194
}
11941195
}
11951196

1197+
func TestAgent_SSHConnectionLoginVars(t *testing.T) {
1198+
t.Parallel()
1199+
1200+
envInfo := usershell.SystemEnvInfo{}
1201+
u, err := envInfo.User()
1202+
require.NoError(t, err, "get current user")
1203+
shell, err := envInfo.Shell(u.Username)
1204+
require.NoError(t, err, "get current shell")
1205+
1206+
tests := []struct {
1207+
key string
1208+
want string
1209+
}{
1210+
{
1211+
key: "USER",
1212+
want: u.Username,
1213+
},
1214+
{
1215+
key: "LOGNAME",
1216+
want: u.Username,
1217+
},
1218+
{
1219+
key: "HOME",
1220+
want: u.HomeDir,
1221+
},
1222+
{
1223+
key: "SHELL",
1224+
want: shell,
1225+
},
1226+
}
1227+
for _, tt := range tests {
1228+
tt := tt
1229+
t.Run(tt.key, func(t *testing.T) {
1230+
t.Parallel()
1231+
1232+
session := setupSSHSession(t, agentsdk.Manifest{}, codersdk.ServiceBannerConfig{}, nil)
1233+
command := "sh -c 'echo $" + tt.key + "'"
1234+
if runtime.GOOS == "windows" {
1235+
command = "cmd.exe /c echo %" + tt.key + "%"
1236+
}
1237+
output, err := session.Output(command)
1238+
require.NoError(t, err)
1239+
require.Equal(t, tt.want, strings.TrimSpace(string(output)))
1240+
})
1241+
}
1242+
}
1243+
11961244
func TestAgent_Metadata(t *testing.T) {
11971245
t.Parallel()
11981246

agent/agentssh/agentssh.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,7 +900,10 @@ func (s *Server) CreateCommand(ctx context.Context, script string, env []string,
900900
cmd.Dir = homedir
901901
}
902902
cmd.Env = append(ei.Environ(), env...)
903+
// Set login variables (see `man login`).
903904
cmd.Env = append(cmd.Env, fmt.Sprintf("USER=%s", username))
905+
cmd.Env = append(cmd.Env, fmt.Sprintf("LOGNAME=%s", username))
906+
cmd.Env = append(cmd.Env, fmt.Sprintf("SHELL=%s", shell))
904907

905908
// Set SSH connection environment variables (these are also set by OpenSSH
906909
// and thus expected to be present by SSH clients). Since the agent does

docs/CONTRIBUTING.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ This mode is useful for testing HA or validating more complex setups.
117117

118118
### Deploying a PR
119119

120-
> You need to be a member or collaborator of the of
121-
> [coder](https://github.com/coder) GitHub organization to be able to deploy a
122-
> PR.
120+
You need to be a member or collaborator of the [coder](https://github.com/coder) GitHub organization to be able to deploy a PR.
123121

124122
You can test your changes by creating a PR deployment. There are two ways to do
125123
this:
@@ -142,7 +140,8 @@ this:
142140
name and PR number, etc.
143141
- `-y` or `--yes`, will skip the CLI confirmation prompt.
144142

145-
> Note: PR deployment will be re-deployed automatically when the PR is updated.
143+
> [!NOTE]
144+
> PR deployment will be re-deployed automatically when the PR is updated.
146145
> It will use the last values automatically for redeployment.
147146
148147
Once the deployment is finished, a unique link and credentials will be posted in
@@ -256,8 +255,7 @@ Our frontend guide can be found [here](./contributing/frontend.md).
256255

257256
## Reviews
258257

259-
> The following information has been borrowed from
260-
> [Go's review philosophy](https://go.dev/doc/contribute#reviews).
258+
The following information has been borrowed from [Go's review philosophy](https://go.dev/doc/contribute#reviews).
261259

262260
Coder values thorough reviews. For each review comment that you receive, please
263261
"close" it by implementing the suggestion or providing an explanation on why the
@@ -345,6 +343,7 @@ Breaking changes can be triggered in two ways:
345343

346344
### Security
347345

346+
> [!CAUTION]
348347
> If you find a vulnerability, **DO NOT FILE AN ISSUE**. Instead, send an email
349348
> to <security@coder.com>.
350349

docs/admin/external-auth.md

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ CODER_EXTERNAL_AUTH_0_CLIENT_SECRET=xxxxxxx
9090
CODER_EXTERNAL_AUTH_0_AUTH_URL="https://login.microsoftonline.com/<TENANT ID>/oauth2/authorize"
9191
```
9292

93-
> Note: Your app registration in Entra ID requires the `vso.code_write` scope
93+
> [!NOTE]
94+
> Your app registration in Entra ID requires the `vso.code_write` scope
9495
9596
### Bitbucket Server
9697

@@ -120,11 +121,8 @@ The Redirect URI for Gitea should be
120121

121122
### GitHub
122123

123-
<blockquote class="admonition tip">
124-
125-
If you don't require fine-grained access control, it's easier to [configure a GitHub OAuth app](#configure-a-github-oauth-app).
126-
127-
</blockquote>
124+
> [!TIP]
125+
> If you don't require fine-grained access control, it's easier to [configure a GitHub OAuth app](#configure-a-github-oauth-app).
128126
129127
```env
130128
CODER_EXTERNAL_AUTH_0_ID="USER_DEFINED_ID"
@@ -179,7 +177,8 @@ CODER_EXTERNAL_AUTH_0_VALIDATE_URL="https://your-domain.com/oauth/token/info"
179177
CODER_EXTERNAL_AUTH_0_REGEX=github\.company\.org
180178
```
181179

182-
> Note: The `REGEX` variable must be set if using a custom git domain.
180+
> [!NOTE]
181+
> The `REGEX` variable must be set if using a custom git domain.
183182
184183
## Custom scopes
185184

@@ -222,26 +221,16 @@ CODER_EXTERNAL_AUTH_0_SCOPES="repo:read repo:write write:gpg_key"
222221

223222
![Install GitHub App](../images/admin/github-app-install.png)
224223

225-
## Multiple External Providers
226-
227-
<blockquote class="info">
228-
229-
Multiple providers is an Enterprise and Premium feature.
230-
[Learn more](https://coder.com/pricing#compare-plans).
231-
232-
</blockquote>
224+
## Multiple External Providers (Enterprise)(Premium)
233225

234226
Below is an example configuration with multiple providers:
235227

236-
<blockquote class="admonition warning">
237-
238-
**Note:** To support regex matching for paths like `github\.com/org`, add the following `git config` line to the [Coder agent startup script](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent#startup_script):
239-
240-
```shell
241-
git config --global credential.useHttpPath true
242-
```
243-
244-
</blockquote>
228+
> [!IMPORTANT]
229+
> To support regex matching for paths like `github\.com/org`, add the following `git config` line to the [Coder agent startup script](https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent#startup_script):
230+
>
231+
> ```shell
232+
> git config --global credential.useHttpPath true
233+
> ```
245234
246235
```env
247236
# Provider 1) github.com

docs/admin/infrastructure/scale-utility.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,25 @@ hardware sizing recommendations.
2828
| Kubernetes (GKE) | 4 cores | 16 GB | 2 | db-custom-8-30720 | 2000 | 50 | 2000 simulated | `v2.8.4` | Feb 28, 2024 |
2929
| Kubernetes (GKE) | 2 cores | 4 GB | 2 | db-custom-2-7680 | 1000 | 50 | 1000 simulated | `v2.10.2` | Apr 26, 2024 |
3030

31-
> Note: A simulated connection reads and writes random data at 40KB/s per connection.
31+
> [!NOTE]
32+
> A simulated connection reads and writes random data at 40KB/s per connection.
3233
3334
## Scale testing utility
3435

3536
Since Coder's performance is highly dependent on the templates and workflows you
3637
support, you may wish to use our internal scale testing utility against your own
3738
environments.
3839

39-
<blockquote class="admonition important">
40-
41-
This utility is experimental.
42-
43-
It is not subject to any compatibility guarantees and may cause interruptions
44-
for your users.
45-
To avoid potential outages and orphaned resources, we recommend that you run
46-
scale tests on a secondary "staging" environment or a dedicated
47-
[Kubernetes playground cluster](https://github.com/coder/coder/tree/main/scaletest/terraform).
48-
49-
Run it against a production environment at your own risk.
50-
51-
</blockquote>
40+
> [!IMPORTANT]
41+
> This utility is experimental.
42+
>
43+
> It is not subject to any compatibility guarantees and may cause interruptions
44+
> for your users.
45+
> To avoid potential outages and orphaned resources, we recommend that you run
46+
> scale tests on a secondary "staging" environment or a dedicated
47+
> [Kubernetes playground cluster](https://github.com/coder/coder/tree/main/scaletest/terraform).
48+
>
49+
> Run it against a production environment at your own risk.
5250
5351
### Create workspaces
5452

docs/admin/infrastructure/validated-architectures/index.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ cloud/on-premise computing, containerization, and the Coder platform.
3636
| Reference architectures for up to 3,000 users | An approval of your architecture; the CVA solely provides recommendations and guidelines |
3737
| Best practices for building a Coder deployment | Recommendations for every possible deployment scenario |
3838

39-
> For higher level design principles and architectural best practices, see
40-
> Coder's
41-
> [Well-Architected Framework](https://coder.com/blog/coder-well-architected-framework).
39+
For higher level design principles and architectural best practices, see Coder's
40+
[Well-Architected Framework](https://coder.com/blog/coder-well-architected-framework).
4241

4342
## General concepts
4443

docs/admin/integrations/jfrog-artifactory.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,8 @@ To set this up, follow these steps:
131131
}
132132
```
133133

134-
<blockquote class="info">
135-
136-
The admin-level access token is used to provision user tokens and is never exposed to developers or stored in workspaces.
137-
138-
</blockquote>
134+
> [!NOTE]
135+
> The admin-level access token is used to provision user tokens and is never exposed to developers or stored in workspaces.
139136

140137
If you don't want to use the official modules, you can read through the [example template](https://github.com/coder/coder/tree/main/examples/jfrog/docker), which uses Docker as the underlying compute. The
141138
same concepts apply to all compute types.

0 commit comments

Comments
 (0)