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

feat: support--socket* options#7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
DanielleMaywood merged 3 commits intomainfromdm-add-socket-options
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions.github/workflows/test.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,6 +7,20 @@ on:
workflow_dispatch:

jobs:
test-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: "Install latest devcontainer CLI"
run: npm install -g @devcontainers/cli

- name: "Generate documentation"
run: make -B docs

- name: "Check for unstaged"
run: ./scripts/check_unstaged.sh

test-autogenerated:
runs-on: ubuntu-latest
continue-on-error: true
Expand Down
4 changes: 4 additions & 0 deletionsMakefile
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
.PHONY: test
test:
devcontainer features test

.PHONY: docs
docs: src/code-server/README.md
cd src && devcontainer features generate-docs -n coder/devcontainer-features
26 changes: 26 additions & 0 deletionsscripts/check_unstaged.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env bash

set -euo pipefail

FILES="$(git ls-files --other --modified --exclude-standard)"
if [[ "$FILES" != "" ]]; then
mapfile -t files <<<"$FILES"

echo
echo "The following files contain unstaged changes:"
echo
for file in "${files[@]}"; do
echo " - $file"
done

echo
echo "These are the changes:"
echo
for file in "${files[@]}"; do
git --no-pager diff "$file" 1>&2
done

echo
echo "ERROR: Unstaged changes, see above for details."
exit 1
fi
2 changes: 2 additions & 0 deletionssrc/code-server/README.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,6 +29,8 @@ VS Code in the browser
| extensions | Comma-separated list of VS Code extensions to install. Format: 'publisher.extension[@version]' (e.g., 'ms-python.python,ms-azuretools.vscode-docker'). | string | - |
| 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 |
| port | The port to bind to for the code-server. | string | 8080 |
| socket | Path to a socket. When specified, host and port will be ignored. | string | - |
| socketMode | File mode of the socket when using the socket option. | string | - |
| version | The version of code-server to install. If empty, installs the latest version. | string | - |
| workspace | Path to the workspace or folder to open on startup. Can be a directory or a .code-workspace file. | string | - |

Expand Down
10 changes: 10 additions & 0 deletionssrc/code-server/devcontainer-feature.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -75,6 +75,16 @@
"default": "8080",
"description": "The port to bind to for the code-server."
},
"socket": {
"type": "string",
"default": "",
"description": "Path to a socket. When specified, host and port will be ignored."
},
"socketMode": {
"type": "string",
"default": "",
"description": "File mode of the socket when using the socket option."
},
"version": {
"type": "string",
"default": "",
Expand Down
13 changes: 12 additions & 1 deletionsrc/code-server/install.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -67,15 +67,26 @@ if [[ -n "$CERTKEY" ]]; then
CERT_FLAGS+=(--cert-key "$CERTKEY")
fi

SOCKET_FLAGS=()

if [[ -n "$SOCKET" ]]; then
SOCKET_FLAGS+=(--socket "$SOCKET")
fi

if [[ -n "$SOCKETMODE" ]]; then
SOCKET_FLAGS+=(--socket-mode "$SOCKETMODE")
fi

cat > /usr/local/bin/code-server-entrypoint \
<< EOF
#!/usr/bin/env bash
set -e

$(declare -p DISABLE_FLAGS)
$(declare -p CERT_FLAGS)
$(declare -p SOCKET_FLAGS)

su $_REMOTE_USER -c 'code-server --auth "$AUTH" --bind-addr "$HOST:$PORT" "\${DISABLE_FLAGS[@]}" "\${CERT_FLAGS[@]}" "$CODE_SERVER_WORKSPACE"'
su $_REMOTE_USER -c 'code-server --auth "$AUTH" --bind-addr "$HOST:$PORT" "\${DISABLE_FLAGS[@]}" "\${CERT_FLAGS[@]}" "\${SOCKET_FLAGS[@]}" "$CODE_SERVER_WORKSPACE"'
EOF

chmod +x /usr/local/bin/code-server-entrypoint
18 changes: 18 additions & 0 deletionstest/code-server/code-server-socket-with-mode.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
#!/bin/bash
set -e

# Optional: Import test library bundled with the devcontainer CLI
source dev-container-features-test-lib

cat /usr/local/bin/code-server-entrypoint

# Feature-specific tests
check "code-server version" code-server --version
check "code-server running" pgrep -f 'code-server/lib/node.*/code-server'
check "code-server listening" lsof -i "@127.0.0.1:8080"

check "code-server socket" grep '"--socket".*"/tmp/code-server.sock"' < /usr/local/bin/code-server-entrypoint
check "code-server socket-mode" grep '"--socket-mode".*"777"' < /usr/local/bin/code-server-entrypoint

# Report results
reportResults
17 changes: 17 additions & 0 deletionstest/code-server/code-server-socket.sh
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -e

# Optional: Import test library bundled with the devcontainer CLI
source dev-container-features-test-lib

cat /usr/local/bin/code-server-entrypoint

# Feature-specific tests
check "code-server version" code-server --version
check "code-server running" pgrep -f 'code-server/lib/node.*/code-server'
check "code-server listening" lsof -i "@127.0.0.1:8080"

check "code-server socket" grep '"--socket".*"/tmp/code-server.sock"' < /usr/local/bin/code-server-entrypoint

# Report results
reportResults
17 changes: 17 additions & 0 deletionstest/code-server/scenarios.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -141,5 +141,22 @@
"certHost": "coder.com"
}
}
},
"code-server-socket": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"code-server": {
"socket": "/tmp/code-server.sock"
}
}
},
"code-server-socket-with-mode": {
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
"features": {
"code-server": {
"socket": "/tmp/code-server.sock",
"socketMode": "777"
}
}
}
}

[8]ページ先頭

©2009-2025 Movatter.jp