JetBrains / Qodana

📝 Source repository of Qodana Help
https://www.jetbrains.com/help/qodana
Apache License 2.0
392 stars 67 forks source link

Qodana TeamCity Integration not working properly when TeamCity agents are running in docker #123

Closed Sp0tlight closed 2 years ago

Sp0tlight commented 2 years ago

Discussed in https://github.com/JetBrains/Qodana/discussions/122

Originally posted by **Sp0tlight** August 24, 2022 Our TeamCity and all agents are running via individual docker containers on a common host. The default Qodana Teamcity integration (Build Step -> Qodana) therefore requires it that the working directory is synced from the agent to the host, so that the Qodana docker image that is spinned up via TC can access it: ``` Agent (docker volume mount): /tc/agent-1/work:/opt/buildagent/work Qodana build step config: Working directory=/tc/agent-1/work/checkoutDirID/ ``` Currently we encounter 2 issues: 1) We can't set the result directory as it is already mapped internally by the command and therefore the internal default one pollutes the host. This docker volume mapping is used internally by the integration plugin: ``` /opt/buildagent/temp/buildTmp/Static_Analysis_Results/Code_Inspection:/data/results/ ``` so the results will be written directly on the host at `/opt/buildagent/temp/buildTmp/Static_Analysis_Results/Code_Inspection`. Here we would expect some additional config option like the working directory, so we can redirect the output to the host mapped agent volume. 2) Qodana don't report anything at all in TeamCity but rather fails after successful analysis, as it can't resolve the written results. ### Analysis is running successfully > [22:13:09 ]() Qodana - Detailed summary > [22:13:09 ]() Analysis results: 238 problems detected > [22:13:09 ]() By severity: Critical - 11, High - 217, Moderate - 10 > [22:13:09 ]() ---------------------------------------------------------------------------- > [22:13:09 ]() Name Severity Problems count > [22:13:09 ]() ---------------------------------------------------------------------------- > [22:13:09 ]() Usage of API marked for removal Critical 11 > [22:13:09 ]() Constant conditions & exceptions High 17 > [.........] ### But completion and TeamCity report is failing > [22:13:12 ]() Generating final reports... > [22:13:13 ]() The project doesn't contain qodana.yaml config file > [22:13:13 ]() Done > [22:13:13 ]() 2022/08/24 20:13:13 Sync IDEA cache from: /data/project/.idea to: /data/cache/.idea > [22:13:14 ]() Docker exit code: 0 > [22:13:14 ]() **Can't resolve .descriptions.json** << error > [22:13:14 ]() Process exited with code 0 > [22:13:14 ]() Reporting as tests is enabled > [22:13:14 ]() Mode: test on each problem > [22:13:14 ]() Reported as tests: 0 problems > [22:13:14 ]() **No one instrument is enabled, or all enabled have failed** << error The file itself exists on the host, so it's probably some issue in the way that the qodana image or integration plugin wants to read the results for reporting it to TeamCity. `ls -a /opt/buildagent/temp/buildTmp/Static_Analysis_Results/Code_Inspection | grep .des` ``` .descriptions.json ```