summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryunlong ying <ying.yunlong@zte.com.cn>2018-03-20 07:35:57 +0000
committerGerrit Code Review <gerrit@onap.org>2018-03-20 07:35:57 +0000
commit07163fee37f72a64c0ea6cfa94b7cd61a08c7a04 (patch)
tree011c1e5b00d0289d956506eb63939f8286494fd8
parent44a867564de84883862109756233bf46aa8e6042 (diff)
parentef0c6805c4573740ed64bd97a8b0da8dadf41521 (diff)
Merge "Add tox execute pre-condition"
-rwxr-xr-xmvn-phase-script.sh38
1 files changed, 22 insertions, 16 deletions
diff --git a/mvn-phase-script.sh b/mvn-phase-script.sh
index 6103ce51..6b41abf1 100755
--- a/mvn-phase-script.sh
+++ b/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
}