#!/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