summaryrefslogtreecommitdiffstats
path: root/lcm/mvn-phase-script.sh
diff options
context:
space:
mode:
authorfujinhua <fu.jinhua@zte.com.cn>2018-03-20 16:37:55 +0800
committerfujinhua <fu.jinhua@zte.com.cn>2018-03-20 16:37:55 +0800
commitbc0cea0b0346d4e55eb3a070842096a35a826d83 (patch)
treeebc9e52fc74e13257334dc5b6f49a6da51647a03 /lcm/mvn-phase-script.sh
parenteaf9d79748966db85291575290af0354882bff0e (diff)
Add tox execute pre-condition
Change-Id: I630cd66bae53b16992beb43ffa354c6b03f011c3 Issue-ID: VFC-827 Signed-off-by: fujinhua <fu.jinhua@zte.com.cn>
Diffstat (limited to 'lcm/mvn-phase-script.sh')
-rwxr-xr-xlcm/mvn-phase-script.sh38
1 files changed, 22 insertions, 16 deletions
diff --git a/lcm/mvn-phase-script.sh b/lcm/mvn-phase-script.sh
index 6103ce51..6b41abf1 100755
--- a/lcm/mvn-phase-script.sh
+++ b/lcm/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
}