-
Bug
-
Resolution: Not A Defect
-
Minor
-
None
-
Jenkins Version 2.401.1,
CodeSonar Plugin Version 3.3.1,
Linux udvbuildserver20 5.4.0-152-generic #169-Ubuntu SMP Tue Jun 6 22:23:09 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux,
openjdk version "11.0.19" 2023-04-18,
OpenJDK Runtime Environment (build 11.0.19+7-post-Ubuntu-0ubuntu120.04.1),
OpenJDK 64-Bit Server VM (build 11.0.19+7-post-Ubuntu-0ubuntu120.04.1, mixed mode, sharing)Jenkins Version 2.401.1, CodeSonar Plugin Version 3.3.1, Linux udvbuildserver20 5.4.0-152-generic #169-Ubuntu SMP Tue Jun 6 22:23:09 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux, openjdk version "11.0.19" 2023-04-18, OpenJDK Runtime Environment (build 11.0.19+7-post-Ubuntu-0ubuntu120.04.1), OpenJDK 64-Bit Server VM (build 11.0.19+7-post-Ubuntu-0ubuntu120.04.1, mixed mode, sharing)
Using the https://github.com/jenkinsci/codesonar-plugin#setting-up-the-plugin
When running the job, we first get the following error, which is standard in our environment as we have multiple projects using multiple compilers.
codesonar: I did not notice any compiler executions, or I did not find any files to analyze.
Possible Cause 1: The compiler did not execute. This often happens because your build system detects the project is already built. Perform a clean/full rebuild and ensure that your build system executes a compiler.
Possible Cause 2: codesonar does not know that your compiler executable is a compiler, and ignores it. For example, perhaps your compiler is called 'mycc'. You can inform codesonar that mycc is a compiler by adding a line such as 'COMPILER_MODELS += mycc -> gcc' to /home/user/workspace/Plugin-Test-ML2-AGCX/Plugin-Test-ML2-AGCX.conf. This says that mycc should be treated as if it is gcc (there are other choices besides gcc).
Possible Cause 3: codesonar does not understand the flags being passed to your compiler on the command line, is not interpreting the commands as a compilation commands, and may be failing as a result. Check the parse log on the hub to see if any compiler invocations were noticed. If any were detected, then the compiler model may need to be switched or adjusted.
Possible Cause 4: The compiler is executing outside the process tree rooted at this codesonar process (or on another machine).
Possible Cause 5: You are using cs-java-scan, cs-dotnet-scan, cs-metascan, or another such scanner, but it was unable to identify any source files to analyze. Check that the target of the scan is correct, and the parse log on the hub for further details.
After inserting the compiler into the Plugin-Test-ML2-AGCX.conf file and trying to run again we get the same exact error again. After inspecting the Plugin-Test-ML2-AGCX.conf we can see that it has replaced the file. When we investigated further we found that when CodeSonar is starting the "monitoring" of files and how the compiler is compiling the source code the following line stood out to us.
codesonar: Authenticating with https://codesonar.deif.com:7340 (anonymous)...ok
Created /home/user/workspace/Plugin-Test-ML2-AGCX/Plugin-Test-ML2-AGCX.conf from /opt/codesonar/codesonar/template.conf
codesonar: Creating new analysis on hub...
Is there a way to disable this creation of a new projectName.conf from a template if there is already one present, and can we overwrite the compiler model in our pipeline script
{{}}
{{ env.CSONAR_CMD_ARGS = "$CSONAR_HUB_ADDRESS \
$CSONAR_WORKDIR/$CSONAR_PROJECT_NAME \
-project $CSONAR_PROJECT_NAME \
-auth certificate -hubcert $CSONAR_USER_CERT -hubkey $CSONAR_USER_PRIVKEY \
-foreground"}}