Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita926b94

Browse files
feat: support--socket* options (#7)
Add new configuration options:socket: Path to a socket.socketMode: File mode of the socket when using the socket option.
1 parentd719798 commita926b94

File tree

9 files changed

+120
-1
lines changed

9 files changed

+120
-1
lines changed

‎.github/workflows/test.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,20 @@ on:
77
workflow_dispatch:
88

99
jobs:
10+
test-docs:
11+
runs-on:ubuntu-latest
12+
steps:
13+
-uses:actions/checkout@v4
14+
15+
-name:"Install latest devcontainer CLI"
16+
run:npm install -g @devcontainers/cli
17+
18+
-name:"Generate documentation"
19+
run:make -B docs
20+
21+
-name:"Check for unstaged"
22+
run:./scripts/check_unstaged.sh
23+
1024
test-autogenerated:
1125
runs-on:ubuntu-latest
1226
continue-on-error:true

‎Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
.PHONY: test
22
test:
33
devcontainer featurestest
4+
5+
.PHONY: docs
6+
docs: src/code-server/README.md
7+
cd src&& devcontainer features generate-docs -n coder/devcontainer-features

‎scripts/check_unstaged.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
5+
FILES="$(git ls-files --other --modified --exclude-standard)"
6+
if [["$FILES"!="" ]];then
7+
mapfile -t files<<<"$FILES"
8+
9+
echo
10+
echo"The following files contain unstaged changes:"
11+
echo
12+
forfilein"${files[@]}";do
13+
echo" -$file"
14+
done
15+
16+
echo
17+
echo"These are the changes:"
18+
echo
19+
forfilein"${files[@]}";do
20+
git --no-pager diff"$file"1>&2
21+
done
22+
23+
echo
24+
echo"ERROR: Unstaged changes, see above for details."
25+
exit 1
26+
fi

‎src/code-server/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ VS Code in the browser
2929
| extensions| Comma-separated list of VS Code extensions to install. Format: 'publisher.extension[@version]' (e.g., 'ms-python.python,ms-azuretools.vscode-docker').| string| -|
3030
| host| The address to bind to for the code-server. Use '0.0.0.0' to listen on all interfaces.| string| 127.0.0.1|
3131
| port| The port to bind to for the code-server.| string| 8080|
32+
| socket| Path to a socket. When specified, host and port will be ignored.| string| -|
33+
| socketMode| File mode of the socket when using the socket option.| string| -|
3234
| version| The version of code-server to install. If empty, installs the latest version.| string| -|
3335
| workspace| Path to the workspace or folder to open on startup. Can be a directory or a .code-workspace file.| string| -|
3436

‎src/code-server/devcontainer-feature.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@
7575
"default":"8080",
7676
"description":"The port to bind to for the code-server."
7777
},
78+
"socket": {
79+
"type":"string",
80+
"default":"",
81+
"description":"Path to a socket. When specified, host and port will be ignored."
82+
},
83+
"socketMode": {
84+
"type":"string",
85+
"default":"",
86+
"description":"File mode of the socket when using the socket option."
87+
},
7888
"version": {
7989
"type":"string",
8090
"default":"",

‎src/code-server/install.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,26 @@ if [[ -n "$CERTKEY" ]]; then
6767
CERT_FLAGS+=(--cert-key"$CERTKEY")
6868
fi
6969

70+
SOCKET_FLAGS=()
71+
72+
if [[-n"$SOCKET" ]];then
73+
SOCKET_FLAGS+=(--socket"$SOCKET")
74+
fi
75+
76+
if [[-n"$SOCKETMODE" ]];then
77+
SOCKET_FLAGS+=(--socket-mode"$SOCKETMODE")
78+
fi
79+
7080
cat> /usr/local/bin/code-server-entrypoint \
7181
<<EOF
7282
#!/usr/bin/env bash
7383
set -e
7484
7585
$(declare -p DISABLE_FLAGS)
7686
$(declare -p CERT_FLAGS)
87+
$(declare -p SOCKET_FLAGS)
7788
78-
su$_REMOTE_USER -c 'code-server --auth "$AUTH" --bind-addr "$HOST:$PORT" "\${DISABLE_FLAGS[@]}" "\${CERT_FLAGS[@]}" "$CODE_SERVER_WORKSPACE"'
89+
su$_REMOTE_USER -c 'code-server --auth "$AUTH" --bind-addr "$HOST:$PORT" "\${DISABLE_FLAGS[@]}" "\${CERT_FLAGS[@]}" "\${SOCKET_FLAGS[@]}" "$CODE_SERVER_WORKSPACE"'
7990
EOF
8091

8192
chmod +x /usr/local/bin/code-server-entrypoint
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Optional: Import test library bundled with the devcontainer CLI
5+
source dev-container-features-test-lib
6+
7+
cat /usr/local/bin/code-server-entrypoint
8+
9+
# Feature-specific tests
10+
check"code-server version" code-server --version
11+
check"code-server running" pgrep -f'code-server/lib/node.*/code-server'
12+
check"code-server listening" lsof -i"@127.0.0.1:8080"
13+
14+
check"code-server socket" grep'"--socket".*"/tmp/code-server.sock"'< /usr/local/bin/code-server-entrypoint
15+
check"code-server socket-mode" grep'"--socket-mode".*"777"'< /usr/local/bin/code-server-entrypoint
16+
17+
# Report results
18+
reportResults
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Optional: Import test library bundled with the devcontainer CLI
5+
source dev-container-features-test-lib
6+
7+
cat /usr/local/bin/code-server-entrypoint
8+
9+
# Feature-specific tests
10+
check"code-server version" code-server --version
11+
check"code-server running" pgrep -f'code-server/lib/node.*/code-server'
12+
check"code-server listening" lsof -i"@127.0.0.1:8080"
13+
14+
check"code-server socket" grep'"--socket".*"/tmp/code-server.sock"'< /usr/local/bin/code-server-entrypoint
15+
16+
# Report results
17+
reportResults

‎test/code-server/scenarios.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,22 @@
141141
"certHost":"coder.com"
142142
}
143143
}
144+
},
145+
"code-server-socket": {
146+
"image":"mcr.microsoft.com/devcontainers/base:ubuntu",
147+
"features": {
148+
"code-server": {
149+
"socket":"/tmp/code-server.sock"
150+
}
151+
}
152+
},
153+
"code-server-socket-with-mode": {
154+
"image":"mcr.microsoft.com/devcontainers/base:ubuntu",
155+
"features": {
156+
"code-server": {
157+
"socket":"/tmp/code-server.sock",
158+
"socketMode":"777"
159+
}
160+
}
144161
}
145162
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp