File tree Expand file tree Collapse file tree 9 files changed +117
-1
lines changed Expand file tree Collapse file tree 9 files changed +117
-1
lines changed Original file line number Diff line number Diff line change 77 workflow_dispatch :
88
99jobs :
10+ test-docs :
11+ runs-on : ubuntu-latest
12+ steps :
13+ - uses : actions/checkout@v4
14+
15+ - name : " Generate documentation"
16+ run : make -B docs
17+
18+ - name : " Check for unstaged"
19+ run : ./scripts/check_unstaged.sh
20+
1021 test-autogenerated :
1122 runs-on : ubuntu-latest
1223 continue-on-error : true
Original file line number Diff line number Diff line change 11.PHONY : test
22test :
33 devcontainer features test
4+
5+ .PHONY : docs
6+ docs : src/code-server/README.md
7+ cd src && devcontainer features generate-docs -n coder/devcontainer-features
Original file line number Diff line number Diff line change 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+ for file in " ${files[@]} " ; do
13+ echo " - $file "
14+ done
15+
16+ echo
17+ echo " These are the changes:"
18+ echo
19+ for file in " ${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
Original file line number Diff line number Diff line change @@ -30,6 +30,8 @@ VS Code in the browser
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 |
3232| version | The version of code-server to install. If empty, installs the latest version. | string | - |
33+ | socket | Path to a socket. When specified, host and port will be ignored. | string | - |
34+ | socketMode | File mode of the socket when using the socket option. | string | - |
3335| workspace | Path to the workspace or folder to open on startup. Can be a directory or a .code-workspace file. | string | - |
3436
3537
Original file line number Diff line number Diff line change 8080 "default" : " " ,
8181 "description" : " The version of code-server to install. If empty, installs the latest version."
8282 },
83+ "socket" : {
84+ "type" : " string" ,
85+ "default" : " " ,
86+ "description" : " Path to a socket. When specified, host and port will be ignored."
87+ },
88+ "socketMode" : {
89+ "type" : " string" ,
90+ "default" : " " ,
91+ "description" : " File mode of the socket when using the socket option."
92+ },
8393 "workspace" : {
8494 "type" : " string" ,
8595 "default" : " " ,
Original file line number Diff line number Diff line change @@ -67,15 +67,26 @@ if [[ -n "$CERTKEY" ]]; then
6767 CERT_FLAGS+=(--cert-key " $CERTKEY " )
6868fi
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+
7080cat > /usr/local/bin/code-server-entrypoint \
7181<< EOF
7282#!/usr/bin/env bash
7383set -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 "'
7990EOF
8091
8192chmod +x /usr/local/bin/code-server-entrypoint
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change 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}
You can’t perform that action at this time.
0 commit comments