Skip to content

Commit

Permalink
devtool: stop asking for user confirmation on container pull
Browse files Browse the repository at this point in the history
Whenever devtool notices that its container is not cached locally, it
requests user input to confirm the new devctr version should indeed be
downloaded. In practice, I do not remember ever saying "no" here. On the
other hand, forgetting to explicitly disable these confirmations in
buildkite pipelines has lead to a myriad of "stuck pipeline" issues.
Thus, remove this confirmation step altogether, as it does more harm
than good.

To avoid having to fix all pipelines that do pass `-y` today, simply
treat the `-y` parameter as a no-op (suggested by Pablo, thanks!).

We cannot remove get_user_confirmation altogether, as its also used by
some of the release scripts, and there it seems like a valid usecase
(but these scripts we never run in buildkite).

Signed-off-by: Patrick Roy <[email protected]>
  • Loading branch information
roypat committed Dec 2, 2024
1 parent f304682 commit 692c53d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
8 changes: 2 additions & 6 deletions tools/devtool
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ PRIV_KEY_PATH=/root/.ssh/id_rsa
# Path to the linux kernel directory, as bind-mounted in the container.
CTR_KERNEL_DIR="${CTR_FC_ROOT_DIR}/.kernel"

# Global options received by $0
# These options are not command-specific, so we store them as global vars
OPT_UNATTENDED=false

# Get the target prefix to avoid repeated calls to uname -m
TARGET_PREFIX="$(uname -m)-unknown-linux-"

Expand Down Expand Up @@ -195,7 +191,6 @@ ensure_devctr() {
# download it, if we don't.
[[ $(docker images -q "$DEVCTR_IMAGE" | wc -l) -gt 0 ]] || {
say "About to pull docker image $DEVCTR_IMAGE"
get_user_confirmation || die "Aborted."

# Run docker pull 5 times in case it fails - sleep 3 seconds
# between attempts
Expand Down Expand Up @@ -1235,7 +1230,8 @@ main() {
while [ $# -gt 0 ]; do
case "$1" in
-h|--help) { cmd_help; exit 1; } ;;
-y|--unattended) { OPT_UNATTENDED=true; } ;;
-y|--unattended) # purposefully ignored
;;
-*)
die "Unknown arg: $1. Please use \`$0 help\` for help."
;;
Expand Down
5 changes: 0 additions & 5 deletions tools/functions
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,7 @@ function SGR {
# exit code 0 for successful confirmation
# exit code != 0 if the user declined
#
OPT_UNATTENDED=false
get_user_confirmation() {

# Pass if running unattended
[[ "$OPT_UNATTENDED" = true ]] && return 0

# Fail if STDIN is not a terminal (there's no user to confirm anything)
[[ -t 0 ]] || return 1

Expand Down

0 comments on commit 692c53d

Please sign in to comment.