Skip to content

Commit 8d150cd

Browse files
committed
RCB-620: More Sonar filtering. Try to run the scan just once.
1 parent 106832d commit 8d150cd

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

CI.Jenkinsfile

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,27 @@ def runSonnarForPythonVersion(sourceDir, ver){
1313
mySonarOpts="$mySonarOpts -Dsonar.pullrequest.base=${env.CHANGE_TARGET} -Dsonar.pullrequest.branch=${env.CHANGE_BRANCH}"
1414
}
1515

16-
// TODO: find a way to skip the Sonar scan for all those version, but one (maybe the latest?).
16+
// Only run Sonar once.
17+
if($ver == 3.11) {
18+
sonarExec="cd /root/ && \
19+
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip && \
20+
unzip -q sonar-scanner-cli-4.8.0.2856-linux.zip && \
21+
cd /source && \
22+
/root/sonar-scanner-4.8.0.2856-linux/bin/sonar-scanner ${mySonarOpts}"
23+
} else {
24+
sonarExec=""
25+
}
26+
1727
sh "docker run \
1828
--pull always \
1929
--rm --volume ${sourceDir}:/source \
2030
python:${ver}-slim \
2131
bash -c \"apt-get update && \
2232
apt-get install -y wget unzip && \
2333
pip3 install tox && \
24-
cd /root/ && \
25-
wget -q https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.8.0.2856-linux.zip && \
26-
unzip -q sonar-scanner-cli-4.8.0.2856-linux.zip && \
2734
cd /source && \
2835
tox && \
29-
/root/sonar-scanner-4.8.0.2856-linux/bin/sonar-scanner \
30-
${mySonarOpts}\""
36+
${sonarExec}\""
3137
}
3238

3339
node ("docker-light") {

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ sonar.projectKey=rosette-api-python-binding
22
sonar.sources=rosette
33
sonar.python.coverage.reportPaths=coverage.xml
44
sonar.sources=rosette
5-
sonar.tests=tests
5+
sonar.tests=tests/*.py
66
#sonar.branch.name=RCB-596-pool-size

0 commit comments

Comments
 (0)