generated from devcontainers/feature-starter
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add --disable-*
options
#5
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
6067463
feat: add all disable options
DanielleMaywood 267eeeb
chore: remove ai fluff comment
DanielleMaywood f33c545
chore: capitalize GitHub
DanielleMaywood 0eda689
chore: use array instead of string
DanielleMaywood 360e865
chore: slight rewrite on install script and tests
DanielleMaywood File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,12 +23,42 @@ if [[ -n $WORKSPACE ]]; then | |
CODE_SERVER_WORKSPACE="$WORKSPACE" | ||
fi | ||
|
||
DISABLE_FLAGS="" | ||
|
||
if [[ "$DISABLEFILEDOWNLOADS" == "true" ]]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Haha, couldn't they have |
||
DISABLE_FLAGS="$DISABLE_FLAGS --disable-file-downloads" | ||
fi | ||
|
||
if [[ "$DISABLEFILEUPLOADS" == "true" ]]; then | ||
DISABLE_FLAGS="$DISABLE_FLAGS --disable-file-uploads" | ||
fi | ||
|
||
if [[ "$DISABLEGETTINGSTARTEDOVERRIDE" == "true" ]]; then | ||
DISABLE_FLAGS="$DISABLE_FLAGS --disable-getting-started-override" | ||
fi | ||
|
||
if [[ "$DISABLEPROXY" == "true" ]]; then | ||
DISABLE_FLAGS="$DISABLE_FLAGS --disable-proxy" | ||
fi | ||
|
||
if [[ "$DISABLETELEMETRY" == "true" ]]; then | ||
DISABLE_FLAGS="$DISABLE_FLAGS --disable-telemetry" | ||
fi | ||
|
||
if [[ "$DISABLEUPDATECHECK" == "true" ]]; then | ||
DISABLE_FLAGS="$DISABLE_FLAGS --disable-update-check" | ||
fi | ||
|
||
if [[ "$DISABLEWORKSPACETRUST" == "true" ]]; then | ||
DISABLE_FLAGS="$DISABLE_FLAGS --disable-workspace-trust" | ||
fi | ||
|
||
cat > /usr/local/bin/code-server-entrypoint \ | ||
<< EOF | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
su $_REMOTE_USER -c 'code-server --auth "$AUTH" --bind-addr "$HOST:$PORT" "$CODE_SERVER_WORKSPACE"' | ||
su $_REMOTE_USER -c 'code-server --auth "$AUTH" --bind-addr "$HOST:$PORT" $DISABLE_FLAGS "$CODE_SERVER_WORKSPACE"' | ||
EOF | ||
|
||
chmod +x /usr/local/bin/code-server-entrypoint |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Optional: Import test library bundled with the devcontainer CLI | ||
source dev-container-features-test-lib | ||
|
||
# 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 disable-file-downloads" grep $'\'code-server.* --disable-file-downloads .*' < /usr/local/bin/code-server-entrypoint | ||
|
||
# Report results | ||
reportResults |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Optional: Import test library bundled with the devcontainer CLI | ||
source dev-container-features-test-lib | ||
|
||
# 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 disable-file-uploads" grep $'\'code-server.* --disable-file-uploads .*' < /usr/local/bin/code-server-entrypoint | ||
|
||
# Report results | ||
reportResults |
15 changes: 15 additions & 0 deletions
15
test/code-server/code-server-disable-getting-started-override.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Optional: Import test library bundled with the devcontainer CLI | ||
source dev-container-features-test-lib | ||
|
||
# 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 disable-getting-started-override" grep $'\'code-server.* --disable-getting-started-override .*' < /usr/local/bin/code-server-entrypoint | ||
|
||
# Report results | ||
reportResults |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Optional: Import test library bundled with the devcontainer CLI | ||
source dev-container-features-test-lib | ||
|
||
# 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 for all three flags we enabled in this scenario | ||
check "code-server disable-file-downloads" grep $'\'code-server.* --disable-file-downloads .*' < /usr/local/bin/code-server-entrypoint | ||
check "code-server disable-file-uploads" grep $'\'code-server.* --disable-file-uploads .*' < /usr/local/bin/code-server-entrypoint | ||
check "code-server disable-getting-started-override" grep $'\'code-server.* --disable-getting-started-override .*' < /usr/local/bin/code-server-entrypoint | ||
check "code-server disable-proxy" grep $'\'code-server.* --disable-proxy .*' < /usr/local/bin/code-server-entrypoint | ||
check "code-server disable-telemetry" grep $'\'code-server.* --disable-telemetry .*' < /usr/local/bin/code-server-entrypoint | ||
check "code-server disable-update-check" grep $'\'code-server.* --disable-update-check .*' < /usr/local/bin/code-server-entrypoint | ||
check "code-server disable-workspace-trust" grep $'\'code-server.* --disable-workspace-trust .*' < /usr/local/bin/code-server-entrypoint | ||
|
||
# Report results | ||
reportResults |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Optional: Import test library bundled with the devcontainer CLI | ||
source dev-container-features-test-lib | ||
|
||
# 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 disable-proxy" grep $'\'code-server.* --disable-proxy .*' < /usr/local/bin/code-server-entrypoint | ||
|
||
# Report results | ||
reportResults |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Optional: Import test library bundled with the devcontainer CLI | ||
source dev-container-features-test-lib | ||
|
||
# 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 disable-telemetry" grep $'\'code-server.* --disable-telemetry .*' < /usr/local/bin/code-server-entrypoint | ||
|
||
# Report results | ||
reportResults |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Optional: Import test library bundled with the devcontainer CLI | ||
source dev-container-features-test-lib | ||
|
||
# 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 disable-update-check" grep $'\'code-server.* --disable-update-check .*' < /usr/local/bin/code-server-entrypoint | ||
|
||
# Report results | ||
reportResults |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Optional: Import test library bundled with the devcontainer CLI | ||
source dev-container-features-test-lib | ||
|
||
# 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 disable-workspace-trust" grep $'\'code-server.* --disable-workspace-trust .*' < /usr/local/bin/code-server-entrypoint | ||
|
||
# Report results | ||
reportResults |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestions: using arrays would be slightly cleaner.
(Note the use of
*
vs@
due to how we're creating the entry point, so this does not make it shell-safe when there are spaces in any inputs.)Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, a way to make it shell safe would be:
😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do that second approach do we lose the ability to test the entrypoint for containing certain flags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both approaches I outlined should be fine for the test. But in the latter you can't test
coder-server.*--flag
, but you can test"--flag"
individually.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I understand the second approach more now, I'm happy to do that one 👍