From 1c0724341c6a37855da5f9e6e212463cb8af0a0e Mon Sep 17 00:00:00 2001 From: Gernot Schulz Date: Fri, 14 Aug 2020 18:22:19 +0200 Subject: [PATCH] build.sh: More convenient way to push images Since build.sh now builds more than just two images, individual queries whether to push each image to a registry may become tedious. This patch replaces the queries with a single checklist menu. After making a selection, the images get pushed all at once. In the menu, all images are unchecked by default in order to prevent accidental uploads. This, too, may become tedious. In that case, the default could be flipped or a new option could be introduced. --- docker/build.sh | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/docker/build.sh b/docker/build.sh index c52ac54a3..6813339f0 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -91,13 +91,22 @@ for i in "${SELECTED_TARGETS[@]}"; do else docker build --tag "$img" --pull "${OPTIONS[@]}" "$loc" fi - BUILT_IMAGES+=("$img") + BUILT_IMAGES+=("$img OFF") done -for img in "${BUILT_IMAGES[@]}"; do - read -p "Push image '$img' to repository? [y/N] " REPL - case "$REPL" in - Y|y|Yes|yes|YES) - docker push "$img" ;; - esac -done +if hash whiptail > /dev/null 2>&1; then + while read img; do + echo "Pushing ${img}." + docker push "$img" + done < <( whiptail --title "OpenSlides build script" \ + --checklist "Select images to push to their registry." \ + 25 78 16 --separate-output --noitem --clear \ + ${BUILT_IMAGES[@]} \ + 3>&2 2>&1 1>&3 ) +else + printf "\nSuccessfully built images:\n\n" + for i in "${BUILT_IMAGES[@]}"; do + read -r img x <<< "$i" + printf " - $img\n" + done +fi