-
Notifications
You must be signed in to change notification settings - Fork 509
[DEVCONTAINER] support customization and run as non-root user #3270
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
marcalff
merged 12 commits into
open-telemetry:main
from
dbarker:fix_devcontainer_permissions
Feb 21, 2025
Merged
Changes from 3 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
e65c6f9
add customization script for the devcontainer and set a non root user.
dbarker 935761d
apply required format
dbarker c07d3c8
fix markdownlint and shellcheck errors. update contributing guide
dbarker c4c0fbe
fix for ci markdownlint config
dbarker 66f983e
add the node version of markdownlint to the devcontainer
dbarker 38a4acc
roll back grpc and protobuf versions. Add clang-tidy. Install npm aft…
dbarker bb90b1c
Merge branch 'main' into fix_devcontainer_permissions
dbarker 33274a7
update the default build args to match the latest grpc version, proto…
dbarker a3ea646
fix markdownlint errors
dbarker 51bd5cb
Merge branch 'main' into fix_devcontainer_permissions
esigo 9eb037b
Merge branch 'main' into fix_devcontainer_permissions
ThomsonTan 9162792
Merge branch 'main' into fix_devcontainer_permissions
marcalff 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Copyright The OpenTelemetry Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| set -eu | ||
|
|
||
| if [[ $IS_CONTAINER_BUILD != "true" ]]; then | ||
| echo "This script should only run inside a Docker container." | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [[ -n "$INSTALL_PACKAGES" ]]; then | ||
| packages=($INSTALL_PACKAGES) | ||
| for package in "${packages[@]}"; do | ||
| apt install -y "$package" | ||
| done | ||
| fi | ||
|
|
||
| if [[ $(id "$USER_NAME" 2>/dev/null) ]]; then | ||
| echo "User '$USER_NAME' already exists. Removing it." | ||
| userdel -rf "$USER_NAME" | ||
| elif [[ $(id -u "$USER_UID" 2>/dev/null) ]]; then | ||
| OTHER_USER=$(getent passwd "$USER_UID" | cut -d: -f1) | ||
| echo "User '$OTHER_USER' exists with UID $USER_UID. Removing it." | ||
| userdel -rf "$OTHER_USER" | ||
| fi | ||
|
|
||
| if [[ ! $(getent group "$USER_GID" 2>/dev/null) ]]; then | ||
| echo "Group '$USER_GID' does not exist. Adding it." | ||
| groupadd -g "$USER_GID" "$USER_NAME" | ||
| fi | ||
|
|
||
| useradd -m -u "$USER_UID" -g "$USER_GID" -s /bin/bash "$USER_NAME" | ||
| echo "Created user '$USER_NAME' (UID: $USER_UID, GID: $USER_GID)." | ||
|
|
||
| echo "$USER_NAME ALL=(ALL) NOPASSWD:ALL" | tee /etc/sudoers.d/"$USER_NAME" | ||
|
|
||
| echo "User and group setup complete." |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.