aboutsummaryrefslogtreecommitdiff
path: root/stretch-arm64-testdef/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'stretch-arm64-testdef/build.sh')
-rwxr-xr-xstretch-arm64-testdef/build.sh20
1 files changed, 14 insertions, 6 deletions
diff --git a/stretch-arm64-testdef/build.sh b/stretch-arm64-testdef/build.sh
index ac64154b..df1b8212 100755
--- a/stretch-arm64-testdef/build.sh
+++ b/stretch-arm64-testdef/build.sh
@@ -4,10 +4,18 @@ set -e
export LANG=C
-DISTRIBUTION=$(basename ${PWD} | cut -f1 -d '-')
-ARCHITECTURE=$(basename ${PWD} | cut -f2 -d '-')
-COMMIT_HASH=$(git ls-remote --heads https://git.linaro.org/qa/test-definitions.git | grep master | cut -c1-7)
+if [ -z "$1" ]; then
+ echo "Usage: ./build.sh <git_tag>"
+ tag="$(git ls-remote https://git.linaro.org/qa/test-definitions.git refs/heads/master | cut -c1-7)"
+ echo "Warning: git tag not specified, latest commit (${tag}) on master branch is used."
+else
+ tag="$1"
+ sed -i "s/git checkout master/git checkout ${tag} -b ${tag}/" Dockerfile
+fi
-image=linaro/testdef-${ARCHITECTURE}-debian-${DISTRIBUTION}:${COMMIT_HASH}
-docker build --pull --tag=$image .
-echo $image > .docker-tag
+DISTRIBUTION="$(basename "${PWD}" | cut -f1 -d '-')"
+ARCHITECTURE="$(basename "${PWD}" | cut -f2 -d '-')"
+
+image=linaro/testdef-${ARCHITECTURE}-debian-${DISTRIBUTION}:${tag}
+docker build --pull --tag="$image" .
+echo "$image" > .docker-tag