summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorChandan Singh <csingh43@bloomberg.net>2019-02-15 12:22:53 +0530
committerChandan Singh <csingh43@bloomberg.net>2019-02-15 20:28:31 +0530
commit2699c77cb8653560ee2e90c081b2208147a726a1 (patch)
treebead388f3bddb04bdf7e769b34480a0d33099e28 /contrib
parentb8561fb12cc9a5ccc2a1a7134a4af66ee0b7d150 (diff)
downloadbuildstream-2699c77cb8653560ee2e90c081b2208147a726a1.tar.gz
contrib/bst-here: Allow users to specify image variant
Now that the `buildstream/buildstream` image has 9 variants, let's make it easier to choose the desired tag, using a command-line option. This is otherwise possible by specifying the full image name `image:tag` using the `-i` option. But, this will make it easier to specify just the tag using `-j`. The following two invocations of `bst-here` are now equivalent: bst-here -i buildstream/buildstream:dev bst-here -j dev
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/bst-here20
1 files changed, 17 insertions, 3 deletions
diff --git a/contrib/bst-here b/contrib/bst-here
index 51a6252d1..01c2d2c13 100755
--- a/contrib/bst-here
+++ b/contrib/bst-here
@@ -25,16 +25,22 @@
usage() {
cat <<EOF
-USAGE: $(basename "$0") [-i BST_HERE_IMAGE] [-p] [-t] [-T] [-v VOLUME ...] [-h] [COMMAND [ARG..]]
+USAGE: $(basename "$0") [-i BST_HERE_IMAGE] [-j TAG] [-p] [-t] [-T] [-v VOLUME ...] [-h] [COMMAND [ARG..]]
Run a bst command in a new BuildStream container.
If no command is specified, an interactive shell is launched
using "/bin/bash -i".
+See https://hub.docker.com/r/buildstream/buildstream for details on image
+variants.
+
OPTIONS:
-i IMAGE Specify Docker image to use; can also be specified by setting
BST_HERE_IMAGE environment variable.
+ (default: buildstream/buildstream)
+ -j TAG Specify the tag of the Docker image to use.
+ (default: latest)
-p Pull the latest buildstream image before running.
-t Force pseudo-terminal allocation.
-T Disable pseudo-terminal allocation.
@@ -46,7 +52,8 @@ EOF
exit "$1"
}
-bst_here_image="${BST_HERE_IMAGE:-buildstream/buildstream:latest}"
+bst_here_image="${BST_HERE_IMAGE:-buildstream/buildstream}"
+bst_here_tag=
is_tty=
update=false
@@ -57,12 +64,15 @@ then
is_tty=y
fi
-while getopts i:ptTv:h arg
+while getopts i:j:ptTv:h arg
do
case $arg in
i)
bst_here_image="$OPTARG"
;;
+ j)
+ bst_here_tag="$OPTARG"
+ ;;
p)
update=true
;;
@@ -83,6 +93,10 @@ do
esac
done
+if [ -n "$bst_here_tag" ]; then
+ bst_here_image="$bst_here_image:$bst_here_tag"
+fi
+
test "$OPTIND" -gt 1 &&
shift $(( OPTIND - 1 ))