Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit feda48b

Browse files
committed
Merge branch 'main' into lilac/mask-input
2 parents 441b8aa + 4f44dd0 commit feda48b

Some content is hidden

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

54 files changed

+510
-355
lines changed

.devcontainer/devcontainer.json

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"name": "Development environments on your infrastructure",
33
"image": "codercom/oss-dogfood:latest",
4-
54
"features": {
65
// See all possible options here https://github.com/devcontainers/features/tree/main/src/docker-in-docker
76
"ghcr.io/devcontainers/features/docker-in-docker:2": {
@@ -10,13 +9,52 @@
109
"ghcr.io/coder/devcontainer-features/code-server:1": {
1110
"auth": "none",
1211
"port": 13337
13-
}
12+
},
13+
"./filebrowser": {}
1414
},
1515
// SYS_PTRACE to enable go debugging
16-
"runArgs": ["--cap-add=SYS_PTRACE"],
16+
"runArgs": [
17+
"--cap-add=SYS_PTRACE"
18+
],
1719
"customizations": {
1820
"vscode": {
19-
"extensions": ["biomejs.biome"]
21+
"extensions": [
22+
"biomejs.biome"
23+
]
24+
},
25+
"coder": {
26+
"apps": [
27+
{
28+
"slug": "cursor",
29+
"displayName": "Cursor Desktop",
30+
"url": "cursor://coder.coder-remote/openDevContainer?owner=${localEnv:CODER_WORKSPACE_OWNER_NAME}&workspace=${localEnv:CODER_WORKSPACE_NAME}&agent=${localEnv:CODER_WORKSPACE_PARENT_AGENT_NAME}&url=${localEnv:CODER_URL}&token=$SESSION_TOKEN&devContainerName=${localEnv:CONTAINER_ID}&devContainerFolder=${containerWorkspaceFolder}",
31+
"external": true,
32+
"icon": "/icon/cursor.svg",
33+
"order": 1
34+
},
35+
{
36+
"slug": "windsurf",
37+
"displayName": "Windsurf Editor",
38+
"url": "windsurf://coder.coder-remote/openDevContainer?owner=${localEnv:CODER_WORKSPACE_OWNER_NAME}&workspace=${localEnv:CODER_WORKSPACE_NAME}&agent=${localEnv:CODER_WORKSPACE_PARENT_AGENT_NAME}&url=${localEnv:CODER_URL}&token=$SESSION_TOKEN&devContainerName=${localEnv:CONTAINER_ID}&devContainerFolder=${containerWorkspaceFolder}",
39+
"external": true,
40+
"icon": "/icon/windsurf.svg",
41+
"order": 4
42+
},
43+
{
44+
"slug": "zed",
45+
"displayName": "Zed Editor",
46+
"url": "zed://ssh/${localEnv:CODER_WORKSPACE_AGENT_NAME}.${localEnv:CODER_WORKSPACE_NAME}.${localEnv:CODER_WORKSPACE_OWNER_NAME}.coder/${containerWorkspaceFolder}",
47+
"external": true,
48+
"icon": "/icon/zed.svg",
49+
"order": 5
50+
}
51+
]
2052
}
21-
}
53+
},
54+
"mounts": [
55+
// Mount the entire home because conditional mounts are not supported.
56+
// See: https://github.com/devcontainers/spec/issues/132
57+
"source=${localEnv:HOME},target=/mnt/home/coder,type=bind,readonly"
58+
],
59+
"postCreateCommand": "./.devcontainer/postCreateCommand.sh"
2260
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"id": "filebrowser",
3+
"version": "0.0.1",
4+
"name": "File Browser",
5+
"description": "A web-based file browser for your development container",
6+
"options": {
7+
"port": {
8+
"type": "string",
9+
"default": "13339",
10+
"description": "The port to run filebrowser on"
11+
},
12+
// "folder": {
13+
// "type": "string",
14+
// "default": "${containerWorkspaceFolder}",
15+
// "description": "The root directory for filebrowser to serve"
16+
// },
17+
"auth": {
18+
"type": "string",
19+
"enum": [
20+
"none",
21+
"password"
22+
],
23+
"default": "none",
24+
"description": "Authentication method (none or password)"
25+
}
26+
},
27+
"entrypoint": "/usr/local/bin/filebrowser-entrypoint",
28+
"dependsOn": {
29+
"ghcr.io/devcontainers/features/common-utils:2": {}
30+
},
31+
"customizations": {
32+
"coder": {
33+
"apps": [
34+
{
35+
"slug": "filebrowser",
36+
"displayName": "File Browser",
37+
"url": "http://localhost:${localEnv:FEATURE_FILEBROWSER_OPTION_PORT:13339}",
38+
"icon": "/icon/filebrowser.svg",
39+
"order": 3,
40+
"subdomain": true,
41+
"healthcheck": {
42+
"url": "http://localhost:${localEnv:FEATURE_FILEBROWSER_OPTION_PORT:13339}/health",
43+
"interval": 5,
44+
"threshold": 6
45+
}
46+
}
47+
]
48+
}
49+
}
50+
}

.devcontainer/filebrowser/install.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
BOLD='\033[0;1m'
6+
7+
printf "%sInstalling filebrowser\n\n" "${BOLD}"
8+
9+
# Check if filebrowser is installed.
10+
if ! command -v filebrowser &>/dev/null; then
11+
curl -fsSL https://raw.githubusercontent.com/filebrowser/get/master/get.sh | bash
12+
fi
13+
14+
printf "🥳 Installation complete!\n\n"
15+
16+
# Create run script.
17+
cat >/usr/local/bin/filebrowser-entrypoint <<EOF
18+
#!/bin/bash
19+
20+
printf "🛠️ Configuring filebrowser\n\n"
21+
22+
AUTH="${AUTH}"
23+
PORT="${PORT}"
24+
FOLDER="$(pwd)"
25+
LOG_PATH=/tmp/filebrowser.log
26+
export FB_DATABASE="/tmp/filebrowser.db"
27+
28+
# Check if filebrowser db exists.
29+
if [[ ! -f "\${FB_DATABASE}" ]]; then
30+
filebrowser config init
31+
if [[ "\$AUTH" == "password" ]]; then
32+
filebrowser users add admin admin --perm.admin=true --viewMode=mosaic
33+
fi
34+
fi
35+
36+
# Configure filebrowser.
37+
if [[ "\$AUTH" == "none" ]]; then
38+
filebrowser config set --port="\${PORT}" --auth.method=noauth --root="\${FOLDER}"
39+
else
40+
filebrowser config set --port="\${PORT}" --auth.method=json --root="\${FOLDER}"
41+
fi
42+
43+
set -euo pipefail
44+
45+
printf "👷 Starting filebrowser...\n\n"
46+
printf "📂 Serving \${FOLDER} at http://localhost:\${PORT}\n\n"
47+
48+
filebrowser >>\${LOG_PATH} 2>&1 &
49+
50+
printf "📝 Logs at \${LOG_PATH}\n\n"
51+
EOF
52+
53+
chmod +x /usr/local/bin/filebrowser-entrypoint
54+
55+
printf "✅ File Browser installed!\n\n"
56+
printf "🚀 Run 'filebrowser-entrypoint' to start the service\n\n"

.devcontainer/postCreateCommand.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/sh
2+
3+
install_ssh_config() {
4+
echo "🔑 Installing SSH configuration..."
5+
rsync -a /mnt/home/coder/.ssh/ ~/.ssh/
6+
chmod 0700 ~/.ssh
7+
}
8+
9+
install_git_config() {
10+
echo "📂 Installing Git configuration..."
11+
if [ -f /mnt/home/coder/git/config ]; then
12+
rsync -a /mnt/home/coder/git/ ~/.config/git/
13+
elif [ -d /mnt/home/coder/.gitconfig ]; then
14+
rsync -a /mnt/home/coder/.gitconfig ~/.gitconfig
15+
else
16+
echo "⚠️ Git configuration directory not found."
17+
fi
18+
}
19+
20+
install_dotfiles() {
21+
if [ ! -d /mnt/home/coder/.config/coderv2/dotfiles ]; then
22+
echo "⚠️ Dotfiles directory not found."
23+
return
24+
fi
25+
26+
cd /mnt/home/coder/.config/coderv2/dotfiles || return
27+
for script in install.sh install bootstrap.sh bootstrap script/bootstrap setup.sh setup script/setup; do
28+
if [ -x $script ]; then
29+
echo "📦 Installing dotfiles..."
30+
./$script || {
31+
echo "❌ Error running $script. Please check the script for issues."
32+
return
33+
}
34+
echo "✅ Dotfiles installed successfully."
35+
return
36+
fi
37+
done
38+
echo "⚠️ No install script found in dotfiles directory."
39+
}
40+
41+
personalize() {
42+
# Allow script to continue as Coder dogfood utilizes a hack to
43+
# synchronize startup script execution.
44+
touch /tmp/.coder-startup-script.done
45+
46+
if [ -x /mnt/home/coder/personalize ]; then
47+
echo "🎨 Personalizing environment..."
48+
/mnt/home/coder/personalize
49+
fi
50+
}
51+
52+
install_ssh_config
53+
install_dotfiles
54+
personalize

.github/workflows/dogfood.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ jobs:
3535
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3636

3737
- name: Setup Nix
38-
uses: nixbuild/nix-quick-install-action@889f3180bb5f064ee9e3201428d04ae9e41d54ad # v31
38+
uses: nixbuild/nix-quick-install-action@63ca48f939ee3b8d835f4126562537df0fee5b91 # v32
39+
with:
40+
# Pinning to 2.28 here, as Nix gets a "error: [json.exception.type_error.302] type must be array, but is string"
41+
# on version 2.29 and above.
42+
nix_version: "2.28.4"
3943

4044
- uses: nix-community/cache-nix-action@135667ec418502fa5a3598af6fb9eb733888ce6a # v6.1.3
4145
with:

agent/agent.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,6 @@ func (a *agent) reportMetadata(ctx context.Context, aAPI proto.DRPCAgentClient26
565565
// channel to synchronize the results and avoid both messy
566566
// mutex logic and overloading the API.
567567
for _, md := range manifest.Metadata {
568-
md := md
569568
// We send the result to the channel in the goroutine to avoid
570569
// sending the same result multiple times. So, we don't care about
571570
// the return values.
@@ -1166,7 +1165,7 @@ func (a *agent) handleManifest(manifestOK *checkpoint) func(ctx context.Context,
11661165
)
11671166
if a.devcontainers {
11681167
a.containerAPI.Init(
1169-
agentcontainers.WithManifestInfo(manifest.OwnerName, manifest.WorkspaceName),
1168+
agentcontainers.WithManifestInfo(manifest.OwnerName, manifest.WorkspaceName, manifest.AgentName),
11701169
agentcontainers.WithDevcontainers(manifest.Devcontainers, scripts),
11711170
agentcontainers.WithSubAgentClient(agentcontainers.NewSubAgentClientFromAPI(a.logger, aAPI)),
11721171
)

agent/agent_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2372,7 +2372,7 @@ func TestAgent_DevcontainerRecreate(t *testing.T) {
23722372
// devcontainer, we do it in a goroutine so we can process logs
23732373
// concurrently.
23742374
go func(container codersdk.WorkspaceAgentContainer) {
2375-
_, err := conn.RecreateDevcontainer(ctx, container.ID)
2375+
_, err := conn.RecreateDevcontainer(ctx, devcontainerID.String())
23762376
assert.NoError(t, err, "recreate devcontainer should succeed")
23772377
}(container)
23782378

0 commit comments

Comments
 (0)