Skip to content

Commit cb7a084

Browse files
committed
Merge remote-tracking branch 'github/main' into asher/move-audit
2 parents b8fa2ae + d8ddce8 commit cb7a084

File tree

36 files changed

+352
-217
lines changed

36 files changed

+352
-217
lines changed

.github/workflows/ci.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,13 +788,15 @@ jobs:
788788
echo "tag=$tag" >> $GITHUB_OUTPUT
789789
790790
# build images for each architecture
791-
make -j build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
791+
# note: omitting the -j argument to avoid race conditions when pushing
792+
make build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
792793
793794
# only push if we are on main branch
794795
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
795796
# build and push multi-arch manifest, this depends on the other images
796797
# being pushed so will automatically push them
797-
make -j push/build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
798+
# note: omitting the -j argument to avoid race conditions when pushing
799+
make push/build/coder_"$version"_linux_{amd64,arm64,armv7}.tag
798800
799801
# Define specific tags
800802
tags=("$tag" "main" "latest")

coderd/database/dbgen/dbgen.go

Lines changed: 43 additions & 43 deletions
Large diffs are not rendered by default.

coderd/httpapi/name_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ import (
44
"strings"
55
"testing"
66

7-
"github.com/moby/moby/pkg/namesgenerator"
87
"github.com/stretchr/testify/assert"
98
"github.com/stretchr/testify/require"
109

1110
"github.com/coder/coder/v2/coderd/httpapi"
11+
"github.com/coder/coder/v2/testutil"
1212
)
1313

1414
func TestUsernameValid(t *testing.T) {
@@ -168,7 +168,7 @@ func TestGeneratedTemplateVersionNameValid(t *testing.T) {
168168
t.Parallel()
169169

170170
for i := 0; i < 1000; i++ {
171-
name := namesgenerator.GetRandomName(1)
171+
name := testutil.GetRandomName(t)
172172
err := httpapi.TemplateVersionNameValid(name)
173173
require.NoError(t, err, "invalid template version name: %s", name)
174174
}

coderd/httpmw/oauth2_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ import (
77
"net/url"
88
"testing"
99

10-
"github.com/moby/moby/pkg/namesgenerator"
1110
"github.com/stretchr/testify/assert"
1211
"github.com/stretchr/testify/require"
1312
"golang.org/x/oauth2"
1413

1514
"github.com/coder/coder/v2/coderd/httpmw"
1615
"github.com/coder/coder/v2/codersdk"
16+
"github.com/coder/coder/v2/testutil"
1717
)
1818

1919
type testOAuth2Provider struct {
@@ -128,7 +128,7 @@ func TestOAuth2(t *testing.T) {
128128
})
129129
t.Run("PresetConvertState", func(t *testing.T) {
130130
t.Parallel()
131-
customState := namesgenerator.GetRandomName(1)
131+
customState := testutil.GetRandomName(t)
132132
req := httptest.NewRequest("GET", "/?oidc_merge_state="+customState+"&redirect="+url.QueryEscape("/dashboard"), nil)
133133
res := httptest.NewRecorder()
134134
tp := newTestOAuth2Provider(t, oauth2.AccessTypeOffline)

docs/templates/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,11 +159,12 @@ resource "coder_agent" "coder" {
159159
startup_script = <<EOT
160160
#!/bin/bash
161161
162-
# Install code-server 4.8.3 under /tmp/code-server using the "standalone" installation
163-
# that does not require root permissions. Note that /tmp may be mounted in tmpfs which
164-
# can lead to increased RAM usage. To avoid this, you can pre-install code-server inside
165-
# the Docker image or VM image.
166-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.8.3
162+
# Install the latest code-server under /tmp/code-server using the "standalone"
163+
# installation that does not require root permissions. Note that /tmp may be
164+
# mounted in tmpfs which can lead to increased RAM usage. To avoid this, you can
165+
# pre-install code-server inside the Docker image or VM image.
166+
# Append "--version x.x.x" to install a specific version of code-server.
167+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
167168
168169
# The & prevents the startup_script from blocking so the next commands can run.
169170
# The stdout and stderr of code-server is redirected to /tmp/code-server.log.

docs/templates/tour.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,11 @@ resource "coder_agent" "main" {
160160
startup_script = <<-EOT
161161
set -e
162162
163-
# install and start code-server
164-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.11.0
163+
# Install the latest code-server.
164+
# Append "--version x.x.x" to install a specific version of code-server.
165+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
166+
167+
# Start code-server in the background.
165168
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
166169
EOT
167170

enterprise/coderd/workspaceproxy_test.go

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"time"
1111

1212
"github.com/google/uuid"
13-
"github.com/moby/moby/pkg/namesgenerator"
1413
"github.com/stretchr/testify/assert"
1514
"github.com/stretchr/testify/require"
1615

@@ -204,7 +203,7 @@ func TestWorkspaceProxyCRUD(t *testing.T) {
204203
})
205204
ctx := testutil.Context(t, testutil.WaitLong)
206205
proxyRes, err := client.CreateWorkspaceProxy(ctx, codersdk.CreateWorkspaceProxyRequest{
207-
Name: namesgenerator.GetRandomName(1),
206+
Name: testutil.GetRandomName(t),
208207
Icon: "/emojis/flag.png",
209208
})
210209
require.NoError(t, err)
@@ -217,9 +216,9 @@ func TestWorkspaceProxyCRUD(t *testing.T) {
217216
require.NotEmpty(t, proxyRes.ProxyToken)
218217

219218
// Update the proxy
220-
expName := namesgenerator.GetRandomName(1)
221-
expDisplayName := namesgenerator.GetRandomName(1)
222-
expIcon := namesgenerator.GetRandomName(1)
219+
expName := testutil.GetRandomName(t)
220+
expDisplayName := testutil.GetRandomName(t)
221+
expIcon := testutil.GetRandomName(t)
223222
_, err = client.PatchWorkspaceProxy(ctx, codersdk.PatchWorkspaceProxy{
224223
ID: proxyRes.Proxy.ID,
225224
Name: expName,
@@ -247,7 +246,7 @@ func TestWorkspaceProxyCRUD(t *testing.T) {
247246
})
248247
ctx := testutil.Context(t, testutil.WaitLong)
249248
proxyRes, err := client.CreateWorkspaceProxy(ctx, codersdk.CreateWorkspaceProxyRequest{
250-
Name: namesgenerator.GetRandomName(1),
249+
Name: testutil.GetRandomName(t),
251250
Icon: "/emojis/flag.png",
252251
})
253252
require.NoError(t, err)
@@ -639,7 +638,7 @@ func TestIssueSignedAppToken(t *testing.T) {
639638

640639
createProxyCtx := testutil.Context(t, testutil.WaitLong)
641640
proxyRes, err := client.CreateWorkspaceProxy(createProxyCtx, codersdk.CreateWorkspaceProxyRequest{
642-
Name: namesgenerator.GetRandomName(1),
641+
Name: testutil.GetRandomName(t),
643642
Icon: "/emojis/flag.png",
644643
})
645644
require.NoError(t, err)
@@ -731,11 +730,11 @@ func TestReconnectingPTYSignedToken(t *testing.T) {
731730
_ = agenttest.New(t, client.URL, authToken)
732731
_ = coderdtest.AwaitWorkspaceAgents(t, client, workspace.ID)
733732

734-
proxyURL, err := url.Parse(fmt.Sprintf("https://%s.com", namesgenerator.GetRandomName(1)))
733+
proxyURL, err := url.Parse(fmt.Sprintf("https://%s.com", testutil.GetRandomName(t)))
735734
require.NoError(t, err)
736735

737736
_ = coderdenttest.NewWorkspaceProxyReplica(t, api, client, &coderdenttest.ProxyOptions{
738-
Name: namesgenerator.GetRandomName(1),
737+
Name: testutil.GetRandomName(t),
739738
ProxyURL: proxyURL,
740739
AppHostname: "*.sub.example.com",
741740
})

examples/parameters-dynamic-options/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,11 @@ resource "coder_agent" "main" {
5656
os = "linux"
5757
startup_script = <<EOF
5858
#!/bin/sh
59-
# install and start code-server
60-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3
59+
# Install the latest code-server.
60+
# Append "-s -- --version x.x.x" to install a specific version of code-server.
61+
curl -fsSL https://code-server.dev/install.sh | sh
62+
63+
# Start code-server.
6164
code-server --auth none --port 13337
6265
EOF
6366

examples/parameters/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,11 @@ resource "coder_agent" "main" {
2929
startup_script = <<-EOT
3030
set -e
3131
32-
# install and start code-server
33-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.11.0
32+
# Install the latest code-server.
33+
# Append "--version x.x.x" to install a specific version of code-server.
34+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
35+
36+
# Start code-server in the background.
3437
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
3538
EOT
3639
}

examples/templates/aws-linux/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,11 @@ resource "coder_agent" "dev" {
165165
startup_script = <<-EOT
166166
set -e
167167
168-
# install and start code-server
169-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.11.0
168+
# Install the latest code-server.
169+
# Append "--version x.x.x" to install a specific version of code-server.
170+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
171+
172+
# Start code-server in the background.
170173
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
171174
EOT
172175

examples/templates/community-templates.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ templates.
3434
- [sulo1337/coder-kubevirt-template](https://github.com/sulo1337/coder-kubevirt-template) -
3535
Kubevirt-based development environment which provisions KVM virtual machines
3636
as coder workspaces on top of a Kubernetes cluster.
37+
- [raulsh/coder-proxmox-qemu-template](https://github.com/raulsh/coder-proxmox-qemu-template) -
38+
Proxmox QEMU template with VS code server for Coder.
3739

3840
## Automation
3941

examples/templates/devcontainer-docker/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,11 @@ resource "coder_agent" "main" {
196196
startup_script = <<-EOT
197197
set -e
198198
199-
# install and start code-server
200-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.11.0
199+
# Install the latest code-server.
200+
# Append "--version x.x.x" to install a specific version of code-server.
201+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
202+
203+
# Start code-server in the background.
201204
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
202205
EOT
203206
dir = "/workspaces"

examples/templates/devcontainer-kubernetes/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,11 @@ resource "coder_agent" "main" {
315315
startup_script = <<-EOT
316316
set -e
317317
318-
# install and start code-server
319-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.11.0
318+
# Install the latest code-server.
319+
# Append "--version x.x.x" to install a specific version of code-server.
320+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
321+
322+
# Start code-server in the background.
320323
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
321324
EOT
322325
dir = "/workspaces"

examples/templates/docker/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ resource "coder_agent" "main" {
3535
touch ~/.init_done
3636
fi
3737
38-
# install and start code-server
39-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.19.1
38+
# Install the latest code-server.
39+
# Append "--version x.x.x" to install a specific version of code-server.
40+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
41+
42+
# Start code-server in the background.
4043
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
4144
EOT
4245

examples/templates/envbox/main.tf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,12 @@ resource "coder_agent" "main" {
102102
if [ ! -f ~/.bashrc ]; then
103103
cp /etc/skel/.bashrc $HOME
104104
fi
105-
# install and start code-server
106-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3 | tee code-server-install.log
105+
106+
# Install the latest code-server.
107+
# Append "-s -- --version x.x.x" to `sh` to install a specific version of code-server.
108+
curl -fsSL https://code-server.dev/install.sh | sh | tee code-server-install.log
109+
110+
# Start code-server in the background.
107111
code-server --auth none --port 13337 | tee code-server-install.log &
108112
EOT
109113
}

examples/templates/gcp-linux/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,11 @@ resource "coder_agent" "main" {
8080
startup_script = <<-EOT
8181
set -e
8282
83-
# install and start code-server
84-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.11.0
83+
# Install the latest code-server.
84+
# Append "--version x.x.x" to install a specific version of code-server.
85+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
86+
87+
# Start code-server in the background.
8588
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
8689
EOT
8790

examples/templates/gcp-vm-container/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,11 @@ resource "coder_agent" "main" {
7070
startup_script = <<-EOT
7171
set -e
7272
73-
# install and start code-server
74-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.11.0
73+
# Install the latest code-server.
74+
# Append "--version x.x.x" to install a specific version of code-server.
75+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
76+
77+
# Start code-server in the background.
7578
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
7679
EOT
7780
}

examples/templates/kubernetes/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,11 @@ resource "coder_agent" "main" {
109109
startup_script = <<-EOT
110110
set -e
111111
112-
# install and start code-server
113-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server --version 4.11.0
112+
# Install the latest code-server.
113+
# Append "--version x.x.x" to install a specific version of code-server.
114+
curl -fsSL https://code-server.dev/install.sh | sh -s -- --method=standalone --prefix=/tmp/code-server
115+
116+
# Start code-server in the background.
114117
/tmp/code-server/bin/code-server --auth none --port 13337 >/tmp/code-server.log 2>&1 &
115118
EOT
116119

examples/workspace-tags/main.tf

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,11 @@ resource "coder_agent" "main" {
7272
os = "linux"
7373
startup_script = <<EOF
7474
#!/bin/sh
75-
# install and start code-server
76-
curl -fsSL https://code-server.dev/install.sh | sh -s -- --version 4.8.3
75+
# Install the latest code-server.
76+
# Append "-s -- --version x.x.x" to install a specific version of code-server.
77+
curl -fsSL https://code-server.dev/install.sh | sh
78+
79+
# Start code-server.
7780
code-server --auth none --port 13337
7881
EOF
7982

site/src/api/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,8 @@ type Claims = {
329329
account_id?: string;
330330
trial: boolean;
331331
all_features: boolean;
332-
feature_set: string;
332+
// feature_set is omitted on legacy licenses
333+
feature_set?: string;
333334
version: number;
334335
features: Record<string, number>;
335336
require_telemetry?: boolean;

site/src/api/queries/groups.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,28 @@ import type {
66
PatchGroupRequest,
77
} from "api/typesGenerated";
88

9-
const GROUPS_QUERY_KEY = ["groups"];
109
type GroupSortOrder = "asc" | "desc";
1110

12-
const getGroupQueryKey = (organizationId: string, groupName: string) => [
11+
const getGroupsQueryKey = (organizationId: string) => [
12+
"organization",
1313
organizationId,
14-
"group",
15-
groupName,
14+
"groups",
1615
];
1716

1817
export const groups = (organizationId: string) => {
1918
return {
20-
queryKey: GROUPS_QUERY_KEY,
19+
queryKey: getGroupsQueryKey(organizationId),
2120
queryFn: () => API.getGroups(organizationId),
2221
} satisfies UseQueryOptions<Group[]>;
2322
};
2423

24+
const getGroupQueryKey = (organizationId: string, groupName: string) => [
25+
"organization",
26+
organizationId,
27+
"group",
28+
groupName,
29+
];
30+
2531
export const group = (organizationId: string, groupName: string) => {
2632
return {
2733
queryKey: getGroupQueryKey(organizationId, groupName),
@@ -97,7 +103,7 @@ export const createGroup = (
97103
mutationFn: (request: CreateGroupRequest) =>
98104
API.createGroup(organizationId, request),
99105
onSuccess: async () => {
100-
await queryClient.invalidateQueries(GROUPS_QUERY_KEY);
106+
await queryClient.invalidateQueries(getGroupsQueryKey(organizationId));
101107
},
102108
};
103109
};
@@ -146,7 +152,7 @@ export const invalidateGroup = (
146152
groupId: string,
147153
) =>
148154
Promise.all([
149-
queryClient.invalidateQueries(GROUPS_QUERY_KEY),
155+
queryClient.invalidateQueries(getGroupsQueryKey(organizationId)),
150156
queryClient.invalidateQueries(getGroupQueryKey(organizationId, groupId)),
151157
]);
152158

0 commit comments

Comments
 (0)