summaryrefslogtreecommitdiff
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 12:26:08 +0530
commitefff7adf312431be4a38acfa0fdc6bbc87664ef4 (patch)
treea392c92db520493677072630972c9d8282a6ee84
parenta71dbfa1db8a9b3cc08f2861cf9536fa4f7d40ff (diff)
downloadbuildstream-chandan/bst-here-tags.tar.gz
contrib/bst-here: Allow users to specify image variantchandan/bst-here-tags
Now that the `buildstream/buildstream` image has 9 variants, let's make it easier to choose the desired tag, using a command-line option.
-rwxr-xr-xcontrib/bst-here20
1 files changed, 15 insertions, 5 deletions
diff --git a/contrib/bst-here b/contrib/bst-here
index 51a6252d1..5b2451848 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=latest
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
;;
@@ -101,7 +111,7 @@ fi
if "$update" == true
then
- docker pull "$bst_here_image"
+ docker pull "$bst_here_image:$bst_here_tag"
fi
# FIXME: We run with --privileged to allow bwrap to mount system
@@ -122,5 +132,5 @@ exec docker run --rm -i${is_tty:+ -t} \
--volume "$PWD":/src \
$extra_volumes_opt \
--workdir /src \
- "$bst_here_image" \
+ "$bst_here_image:$bst_here_tag" \
$command