aboutsummaryrefslogtreecommitdiff
path: root/stretch-arm64-testdef
diff options
context:
space:
mode:
authorChase Qi <chase.qi@linaro.org>2018-08-21 19:16:45 +0800
committerFathi Boudra <fathi.boudra@linaro.org>2018-08-23 05:49:15 +0000
commit0e77dfc9eb3c95765e124e185db4aacb4726cd1e (patch)
treeeadc6c0ecf18caaf52c0fb64dca8a19064a2b683 /stretch-arm64-testdef
parent5be205bc681ad474564cf40ab7c7be83a85d454c (diff)
test-definitions: support to build by git tag
* We plan to tag qa/test-definition monthly. A Jenkins job will be setup to build new docker images for new tag. Instead of always build with the latest commit, this patch add support to build by tag. When the tag is not specified, the latest commit on master branch will be used. * Fix shellchecks. Change-Id: I9028a19a80cef3ccd6c21a28ad6f742f281b816a Signed-off-by: Chase Qi <chase.qi@linaro.org>
Diffstat (limited to 'stretch-arm64-testdef')
-rw-r--r--stretch-arm64-testdef/Dockerfile3
-rwxr-xr-xstretch-arm64-testdef/build.sh20
2 files changed, 16 insertions, 7 deletions
diff --git a/stretch-arm64-testdef/Dockerfile b/stretch-arm64-testdef/Dockerfile
index 8a7aaa99..cd20f093 100644
--- a/stretch-arm64-testdef/Dockerfile
+++ b/stretch-arm64-testdef/Dockerfile
@@ -3,8 +3,9 @@ FROM linaro/ci-arm64-debian:stretch
RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
python-pip \
- && git clone -b master http://git.linaro.org/qa/test-definitions.git \
+ && git clone http://git.linaro.org/qa/test-definitions.git \
&& cd test-definitions \
+ && git checkout master \
&& pip install -r automated/utils/requirements.txt \
&& apt-get clean \
&& rm -rf \
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