- ALM used: GitHub
- CI system used: Jenkins
- Scanner command used when applicable (private details masked):
mvn -Duser.home=/home/<hidden for privacy>/slave/workspace/CI-PR-1517/.home org.sonarsource.scanner.maven:sonar-maven-plugin:sonar --batch-mode -pl --also-make --no-snapshot-updates -Psonar -Dsonar -Dsonar.projectName=<hidden for privacy> -Dsonar.projectKey=<hidden for privacy> -Dsonar.organization=<hidden for privacy> -Dsonar.host.url=https://sonarcloud.io -Dsonar.token=<hidden for privacy> -Dsonar.pullrequest.branch=other/OP-1879-SonarCloud-suspicious-warnings -Dsonar.pullrequest.key=1517 -Dsonar.pullrequest.base=develop -Dmaven.repo.local=/home/<hidden for privacy>/slave/workspace/CI-PR-1517/.home/.m2/repository -f /home/<hidden for privacy>/slave/workspace/CI-PR-1517/Parent/pom.xml
- Languages of the repository: Java/JS/TS
- Warnings observed
Multiple warnings like this are shown during analyzing of any pull request that is targeting the ‘develop’ (main) branch
[WARNING] 14:18:25.833 Failed to find InputFile for /home/jenkins/workspace/workspace/CI-develop/<…hidden due to privacy…>, check exclusions.
It looks very suspicious: Sonar attempts to access a directory outside of current jenkins workspace (which is /home/<hidden for privacy>/slave/workspace/CI-PR-1517
).
More details:
we have Sonar analyzing running on pull requests and pushes to the develop
branch.
There are different Jenkins nodes involved in PR and push analyzing, so technically the directory /home/jenkins/workspace/workspace/CI-develop/
cannot be accessed directly from the node where the /home/<hidden for privacy>/slave/workspace/CI-PR-1517
is located.
If you check the mvn sonar scanner above, it can be seen that this command in no way involves the /home/jenkins/workspace/workspace/CI-develop
references.
- Additional info
- If I enable
mvn -X --debug
keys then even more suspicious references to another workspace appear in the log e.g.
Line 183183: [DEBUG] 14:17:05.177 Issue E at /home/jenkins/workspace/workspace/CI-develop/<hidden for privacy>(347:3 - 347:112) suppressed by unknown constraint
- If the pull request is targeting another branch (not
develop
) - the warnings are not shown
So the questions are:
- Is it correct that sonar scanner attempts to access the directory outside of current Jenkins workspace?
- Could it be related to some caching-related features, e.g. Sensor Cache for the project (it’s enabled for us)?
- Could it be a problem in Jenkins itself?
- Should we ensure that the
develop
branch must be always analyzed on the same Jenkins node as pull requests for SonarCloud purposes? (it’s a little bit hard requirement, but if needed - achievable).