X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=ta%2Fcloudtaf.git;a=blobdiff_plain;f=rfcli-docker;fp=rfcli-docker;h=8d25e27a35895b2b85dd329a01bc84ef3b683fa3;hp=0000000000000000000000000000000000000000;hb=d448b9388fd9cb3732e35996b98f493a5a5921d4;hpb=07c5f13d2429236a603c867e09c4cc3b42e75826 diff --git a/rfcli-docker b/rfcli-docker new file mode 100755 index 0000000..8d25e27 --- /dev/null +++ b/rfcli-docker @@ -0,0 +1,55 @@ +#!/bin/bash + +# Copyright 2019 Nokia +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -e +set -u +set -x + +# TOX_ENV is tox environment which is to be executed. +if [ -z ${TOX_ENV+x} ]; then + TOX_ENV=rfcli +fi +SCRIPT_DIR="$(dirname $(readlink -f ${BASH_SOURCE[0]}))" + +DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG:-rec-cloudtaf-runner} + +$SCRIPT_DIR/rfcli-docker-build $DOCKER_IMAGE_TAG + +i=0 +ORIGINAL_ARGS=("$@") +NO_TARGET_CMD="" +while [ $i -lt ${#ORIGINAL_ARGS[@]} ]; do + arg=${ORIGINAL_ARGS[$i]} + if [ $arg == "-t" ]; then + target_index=$(expr $i + 1) + target_path=${ORIGINAL_ARGS[$target_index]} + i=$(expr $i + 2) + else + NO_TARGET_CMD="${NO_TARGET_CMD} ${arg}" + i=$(expr $i + 1) + fi +done + +cp $target_path targets +new_target_path=targets/$(basename $target_path) + +docker run --rm -t \ + --net="host" \ + --env DISPLAY \ + --env TOX_ENV \ + -v $(pwd):/tmp/rec-cloudtaf \ + -w /tmp/rec-cloudtaf \ + $DOCKER_IMAGE_TAG ./rfcli-tox-umask -t ${new_target_path} $NO_TARGET_CMD