summaryrefslogtreecommitdiffstats
path: root/gvnfmadapter/mvn-phase-script.sh
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2018-03-20 16:39:53 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2018-03-20 16:39:53 +0800
commite9b1aa33239c115d4d6c5731e608aaacd9536223 (patch)
tree2a8fb390683eb0ac8df231ee834fdfba53b8ee75 /gvnfmadapter/mvn-phase-script.sh
parentcb18ec2f4a99f44a08942d445242d38d7bb0a343 (diff)
Add tox execute pre-condition
Change-Id: I8e60987e163b624a9d04af3f1b887e24fc4957bb Issue-ID: VFC-827 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
Diffstat (limited to 'gvnfmadapter/mvn-phase-script.sh')
-rwxr-xr-xgvnfmadapter/mvn-phase-script.sh38
1 files changed, 22 insertions, 16 deletions
diff --git a/gvnfmadapter/mvn-phase-script.sh b/gvnfmadapter/mvn-phase-script.sh
index 6103ce5..6b41abf 100755
--- a/gvnfmadapter/mvn-phase-script.sh
+++ b/gvnfmadapter/mvn-phase-script.sh
@@ -43,24 +43,30 @@ echo "MVN_PROJECT_GROUPID is [$MVN_PROJECT_GROUPID]"
echo "MVN_PROJECT_ARTIFACTID is [$MVN_PROJECT_ARTIFACTID]"
echo "MVN_PROJECT_VERSION is [$MVN_PROJECT_VERSION]"
-run_tox_test()
-{
+run_tox_test()
+{
set -x
CURDIR=$(pwd)
- TOXINIS=$(find . -name "tox.ini")
- for TOXINI in "${TOXINIS[@]}"; do
- DIR=$(echo "$TOXINI" | rev | cut -f2- -d'/' | rev)
- cd "${CURDIR}/${DIR}"
- rm -rf ./venv-tox ./.tox
- virtualenv ./venv-tox
- source ./venv-tox/bin/activate
- pip install --upgrade pip
- pip install --upgrade tox argparse
- pip freeze
- tox
- deactivate
- rm -rf ./venv-tox ./.tox
- done
+ if [[ ${CURDIR} =~ "-sonar" ]]
+ then
+ echo "====Sonar job, need execute tox."
+ TOXINIS=$(find . -name "tox.ini")
+ for TOXINI in "${TOXINIS[@]}"; do
+ DIR=$(echo "$TOXINI" | rev | cut -f2- -d'/' | rev)
+ cd "${CURDIR}/${DIR}"
+ rm -rf ./venv-tox ./.tox
+ virtualenv ./venv-tox
+ source ./venv-tox/bin/activate
+ pip install --upgrade pip
+ pip install --upgrade tox argparse
+ pip freeze
+ tox
+ deactivate
+ rm -rf ./venv-tox ./.tox
+ done
+ else
+ echo "====Not a sonar job, need not execute tox."
+ fi
}