Matthias Bisping a00ceae0e5 Pull request #28: Prefetch adjustment
Merge in RR/pyinfra from prefetch_adjustment to master

Squashed commit of the following:

commit 6f9d75bf49ad196bf5728386527499025ac27b3a
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Apr 21 13:47:40 2022 +0200

    removed tests without much value that caused teardown problems with docker containers

commit b7ccbe20e3babbf1127ea5738a1d710d8029c90b
Merge: 51a459c 5925737
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Apr 21 13:04:34 2022 +0200

    Merge branch 'sonarscan_refac' into prefetch_adjustment

commit 51a459cbf04e9884cf6b7c2c3145206ecf1a0ffb
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Thu Apr 21 13:03:48 2022 +0200

    set prefetch count to 1; removed obsolete imports

commit 592573793cdfd098012a98cfc7ab0cc1fbfd0e44
Author: Matthias Bisping <matthias.bisping@iqser.com>
Date:   Tue Apr 19 18:01:46 2022 +0200

    refactoring; cleanup
2022-04-21 14:01:49 +02:00

59 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
set -e
export JAVA_HOME=/usr/bin/sonar-scanner/jre
python3 -m venv build_venv
source build_venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install dependency-check
python3 -m pip install docker-compose
python3 -m pip install coverage
echo "docker-compose down"
docker-compose down
sleep 30
echo "coverage report generation"
bash run_tests.sh
if [ ! -f reports/coverage.xml ]
then
exit 1
fi
SERVICE_NAME=$1
echo "dependency-check:aggregate"
mkdir -p reports
dependency-check --enableExperimental -f JSON -f XML \
--disableAssembly -s . -o reports --project $SERVICE_NAME --exclude ".git/**" --exclude "venv/**" \
--exclude "build_venv/**" --exclude "**/__pycache__/**" --exclude "bamboo-specs/**"
if [[ -z "${bamboo_repository_pr_key}" ]]
then
echo "Sonar Scan for branch: ${bamboo_planRepository_1_branch}"
/usr/bin/sonar-scanner/bin/sonar-scanner -X\
-Dsonar.projectKey=RED_$SERVICE_NAME \
-Dsonar.host.url=https://sonarqube.iqser.com \
-Dsonar.login=${bamboo_sonarqube_api_token_secret} \
-Dsonar.dependencyCheck.jsonReportPath=reports/dependency-check-report.json \
-Dsonar.dependencyCheck.xmlReportPath=reports/dependency-check-report.xml \
-Dsonar.dependencyCheck.htmlReportPath=reports/dependency-check-report.html \
-Dsonar.python.coverage.reportPaths=reports/coverage.xml
else
echo "Sonar Scan for PR with key1: ${bamboo_repository_pr_key}"
/usr/bin/sonar-scanner/bin/sonar-scanner \
-Dsonar.projectKey=RED_$SERVICE_NAME \
-Dsonar.host.url=https://sonarqube.iqser.com \
-Dsonar.login=${bamboo_sonarqube_api_token_secret} \
-Dsonar.pullrequest.key=${bamboo_repository_pr_key} \
-Dsonar.pullrequest.branch=${bamboo_repository_pr_sourceBranch} \
-Dsonar.pullrequest.base=${bamboo_repository_pr_targetBranch} \
-Dsonar.dependencyCheck.jsonReportPath=reports/dependency-check-report.json \
-Dsonar.dependencyCheck.xmlReportPath=reports/dependency-check-report.xml \
-Dsonar.dependencyCheck.htmlReportPath=reports/dependency-check-report.html \
-Dsonar.python.coverage.reportPaths=reports/coverage.xml
fi