summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2018-03-20 16:38:30 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2018-03-20 16:38:30 +0800
commit2614dcb18906b84d975bad6688dd517649ef538f (patch)
tree2916d23df4ec08a442523ee2cb7e1bbb1ea6fa1b
parent1a60d1b4bc116d501ef88947faa96592869bc03a (diff)
Add tox execute pre-condition
Change-Id: I061f4e273924f8e6253d551cff094a1a94bb52d8 Issue-ID: VFC-827 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
-rwxr-xr-xmgr/mvn-phase-script.sh38
1 files changed, 22 insertions, 16 deletions
diff --git a/mgr/mvn-phase-script.sh b/mgr/mvn-phase-script.sh
index 6103ce5..6b41abf 100755
--- a/mgr/mvn-phase-script.sh
+++ b/mgr/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
}