-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add post-start-command to run non-interactive parts of initializing t…
…he gitconfig so it happens before rapids-build-utils' post-start-command (#279)
- Loading branch information
Showing
7 changed files
with
55 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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 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
26 changes: 26 additions & 0 deletions
26
features/src/utils/opt/devcontainer/bin/git/init-interactive.sh
This file contains 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,26 @@ | ||
#! /usr/bin/env bash | ||
|
||
init_git_cli_config_interactive() { | ||
local -; | ||
set -euo pipefail; | ||
|
||
if [ -z "$(git config --get user.name)" ]; then | ||
local git_user_name_default="anon"; | ||
local git_user_name="${git_user_name_default}"; | ||
if devcontainer-utils-shell-is-interactive; then | ||
read -rsp "Git user.name (${git_user_name_default}): " git_user_name <$(tty); | ||
fi | ||
git config --global user.name "${git_user_name:-"${git_user_name_default}"}" >/dev/null 2>&1 || true; | ||
fi | ||
|
||
if [ -z "$(git config --get user.email)" ]; then | ||
local git_user_email_default="users.noreply.${GITHUB_HOST:-github.com}"; | ||
local git_user_email="${git_user_email_default}"; | ||
if devcontainer-utils-shell-is-interactive; then | ||
read -rsp "Git user.email (${git_user_email_default}): " git_user_email <$(tty); | ||
fi | ||
git config --global user.email "${git_user_email:-"${git_user_email_default}"}" >/dev/null 2>&1 || true; | ||
fi | ||
} | ||
|
||
init_git_cli_config_interactive "$@"; |
This file contains 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
6 changes: 1 addition & 5 deletions
6
features/src/utils/opt/devcontainer/bin/post-attach-command.sh
This file contains 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 |
---|---|---|
@@ -1,12 +1,8 @@ | ||
#! /usr/bin/env bash | ||
|
||
if test -z "${SKIP_DEVCONTAINER_UTILS_POST_ATTACH_COMMAND:-}"; then | ||
find ~/ -maxdepth 1 -exec bash -c '\ | ||
[ $(stat -c "%u:%g" "$0") != "$1" ] && \ | ||
sudo chown -R "$1" "$0"' {} "$(id -u):$(id -g)" \; | ||
|
||
# shellcheck disable=SC1091 | ||
. devcontainer-utils-init-git; | ||
. devcontainer-utils-init-git-interactive; | ||
# shellcheck disable=SC1091 | ||
. devcontainer-utils-vault-s3-init; | ||
fi |
8 changes: 8 additions & 0 deletions
8
features/src/utils/opt/devcontainer/bin/post-start-command-entrypoint.sh
This file contains 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,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
export SKIP_DEVCONTAINER_UTILS_POST_START_COMMAND=; | ||
|
||
# shellcheck disable=SC1091 | ||
. devcontainer-utils-post-start-command; | ||
|
||
exec "$@"; |
10 changes: 10 additions & 0 deletions
10
features/src/utils/opt/devcontainer/bin/post-start-command.sh
This file contains 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,10 @@ | ||
#! /usr/bin/env bash | ||
|
||
if test -z "${SKIP_DEVCONTAINER_UTILS_POST_START_COMMAND:-}"; then | ||
find ~/ -maxdepth 1 -exec bash -c '\ | ||
[ $(stat -c "%u:%g" "$0") != "$1" ] && \ | ||
sudo chown -R "$1" "$0"' {} "$(id -u):$(id -g)" \; | ||
|
||
# shellcheck disable=SC1091 | ||
. devcontainer-utils-init-git; | ||
fi |