simondel / sonar-buildbreaker-vsts

VSTS task to break your build when you failed the quality gate
Apache License 2.0
7 stars 7 forks source link

Plugin randomly stopped working... #11

Closed ManIkWeet closed 5 years ago

ManIkWeet commented 5 years ago

We were using version 6, which suddenly stopped working without any obvious reason. I enabled debug output, here's part of that:

[debug]76382 results

[debug]found 76382 paths

[debug]applying include pattern

[debug]adjustedPattern: 'C:\DeltaPi\agent_work\10**\report-task.txt'

[debug]1 matches

[debug]1 final results

[debug]SONARQUBE_ENDPOINT=***

[debug]task result: Failed

[error]Unhandled: Cannot read property 'status' of undefined

[debug]Processed: ##vso[task.issue type=error;]Unhandled: Cannot read property 'status' of undefined

[debug]Processed: ##vso[task.complete result=Failed;]Unhandled: Cannot read property 'status' of undefined

The file does appear to exist (C:\DeltaPi\agent_work\10.sonarqube\out.sonar\report-task.txt) and has the following contents:

projectKey=DeltaPi serverUrl=http://d1nlbodwrvsts:9000 serverVersion=6.7.5.38563 dashboardUrl=http://d1nlbodwrvsts:9000/dashboard/index/DeltaPi ceTaskId=AWyUSQKpYJwQvCdTe4Ny ceTaskUrl=http://d1nlbodwrvsts:9000/api/ce/task?id=AWyUSQKpYJwQvCdTe4Ny

Note that this file only contains LineFeed line endings (not sure if that matters)

We are using SonarQube LTS so nothing should've changed there...

I tried using the latest version of the plugin, version 7, the following is part of the debug output:

[debug]pattern: 'sonar\20190815.3**\report-task.txt'

[debug]findPath: 'C:\DeltaPi\agent_work_temp\sonar\20190815.3'

[debug]statOnly: 'false'

[debug]findPath: 'C:\DeltaPi\agent_work_temp\sonar\20190815.3'

[debug]findOptions.followSpecifiedSymbolicLink: 'true'

[debug]findOptions.followSymbolicLinks: 'true'

[debug]0 results

[debug]found 0 paths

[debug]applying include pattern

[debug]adjustedPattern: 'C:\DeltaPi\agent_work_temp\sonar\20190815.3**\report-task.txt'

[debug]0 matches

[debug]0 final results

Getting task report from file undefined (node:5036) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: path must be a string or Buffer

It can't find the file, which makes sense as it's not located in the temp folder.

What can be done to fix it?

I have not originally configured the pipeline, the one who did has left the company, so please excuse me for any of my ignorance.

simondel commented 5 years ago

What task version do you see at the start of the logging? 7.0.4 or 7.0.5?

ManIkWeet commented 5 years ago

Task : SonarQube build breaker Description : Break the build when the quality gate fails. Version : 7.0.5 Author : Simon de Lang Help :

simondel commented 5 years ago

Awesome and what is the version of your SonarQube tasks? They should be at least v4.7.0

ManIkWeet commented 5 years ago

Task : Prepare Analysis Configuration Description : Prepare SonarQube analysis configuration Version : 4.7.1 Author : sonarsource Help : More Information

Task : Run Code Analysis Description : Run scanner and upload the results to the SonarQube server. Version : 4.6.3 Author : sonarsource Help : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

More Information

Hmm interesting

Task : Publish Quality Gate Result Description : Publish SonarQube's Quality Gate result on the Azure DevOps build result, to be used after the actual analysis. Version : 4.7.0 Author : sonarsource Help : More Information

simondel commented 5 years ago

Strange. I would expect all three to be the same version. Do you have access to your build server? If so, could you delete everything in the _tasks folder (probably under _work in your agent folder)? And then run the build again.

ManIkWeet commented 5 years ago

I will try that, the folder contains a lot of files. Running the build will take about 15 minutes, I'll respond again when it's done.

ManIkWeet commented 5 years ago

Deleting the folder does not seem to have made a difference

==============================================================================
Task         : Prepare Analysis Configuration
Description  : Prepare SonarQube analysis configuration
Version      : 4.7.2
Author       : sonarsource
Help         : [More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
==============================================================================
Task         : Run Code Analysis
Description  : Run scanner and upload the results to the SonarQube server.
Version      : 4.6.3
Author       : sonarsource
Help         : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
==============================================================================
Task         : Publish Quality Gate Result
Description  : Publish SonarQube's Quality Gate result on the Azure DevOps build result, to be used after the actual analysis.
Version      : 4.7.0
Author       : sonarsource
Help         : [More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
==============================================================================
Task         : SonarQube build breaker
Description  : Break the build when the quality gate fails.
Version      : 7.0.5
Author       : Simon de Lang
Help         : 
==============================================================================
lnaia commented 5 years ago

Can confirm the same situation here, with the same versions of the tasks as last published here.

ManIkWeet commented 5 years ago

I tried removing the SonarQube extension, clearing the _tasks folder, restarting the agent, but to no avail.

SonarQube still has different versions for the components.

simondel commented 5 years ago

I'm working on rebuilding the extension to use as much code from sonarsource as possible to prevent me from building anything that works differently.

simondel commented 5 years ago

Hi @ManIkWeet an @lnaia :)

I have released a new version of the extension. This includes a rewrite of the code to use almost all logic from SonarSource directly. Could you test it and try it out?

For SonarQube the new version is 8. (https://github.com/simondel/sonar-buildbreaker-vsts/releases/tag/SonarQube-build-breaker-8.0.0) For SonarCloud the new version is 2. (https://github.com/simondel/sonar-buildbreaker-vsts/releases/tag/SonarCloud-build-breaker-2.0.2)

ManIkWeet commented 5 years ago

I tried it and got the attached output (mentioning that there are no analyses), does seem to get a proper server response but I'm not sure if it breaks using just that response. latest.log

simondel commented 5 years ago

That's very strange! What does the debug of the publish quality gate task say?

ManIkWeet commented 5 years ago

This is what it said during that build. publishqualitygate.log

I just finished a new build which does have a failing quality gate, but breaker is fine with it.

simondel commented 5 years ago

Interesting. That one also says it can't find an analysis. What does SonarQube put in the Summary of your build? Does that detect the failing quality gate?

ManIkWeet commented 5 years ago
07:57:49.359 INFO: CPD calculation finished
07:58:14.551 INFO: Analysis report generated in 24036ms, dir size=20 MB
07:58:20.691 INFO: Analysis reports compressed in 6140ms, zip size=8 MB
07:58:20.691 INFO: Analysis report generated in C:\DeltaPi\agent\_work\26\.sonarqube\out\.sonar\scanner-report
07:58:20.691 DEBUG: Upload report
07:58:21.082 DEBUG: POST 200 http://d1nlbodwrvsts:9000/api/ce/submit?projectKey=DeltaPi&projectName=Develop | time=391ms
07:58:21.082 INFO: Analysis report uploaded in 391ms
07:58:21.082 INFO: ANALYSIS SUCCESSFUL, you can browse http://d1nlbodwrvsts:9000/dashboard/index/DeltaPi
07:58:21.082 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
07:58:21.082 INFO: More about the report processing at http://d1nlbodwrvsts:9000/api/ce/task?id=AWyodHdxpFOZGa3vs5WH
07:58:21.082 DEBUG: Report metadata written to C:\DeltaPi\agent\_work\26\.sonarqube\out\.sonar\report-task.txt
07:58:21.082 DEBUG: Post-jobs : 
07:58:21.082 INFO: Task total time: 1:14.244 s
07:58:21.145 INFO: ------------------------------------------------------------------------
07:58:21.145 INFO: EXECUTION SUCCESS
07:58:21.145 INFO: ------------------------------------------------------------------------
07:58:21.145 INFO: Total time: 1:16.135s
07:58:21.207 INFO: Final Memory: 22M/538M
07:58:21.207 INFO: ------------------------------------------------------------------------
Process returned exit code 0
The SonarQube Scanner has finished
07:58:21.27  Post-processing succeeded.

SonarQube dashboard does detect a failure, so the analysis definitely completed.

simondel commented 5 years ago

So, on this summary dashboard in TFS/Azure DevOps the quality gate is 'FAILED'? image (https://dev.azure.com/simondel/Public/_build/results?buildId=237&view=results)

ManIkWeet commented 5 years ago

That's interesting, there's no SonarQube Analysis Report summary at all there...

Maybe different from SonarCloud? I wonder if something is simply not configured correctly, we are using an older (long term support) version of SonarQube, and it has previously worked.

ManIkWeet commented 5 years ago

I might've broken something when I created a new pipeline to test these issues, please stand by...

simondel commented 5 years ago

The Publish Quality Gate task is supposed to place that link in the summary of your build. It should look pretty much the same, only with 'SonarQube' instead of 'SonarCloud' and the name of your SonarQube project instead of my project(s).

The task unfortunately does not log a warning when no projects can be found. I'll see if I can send a PR their way to add that some day.

ManIkWeet commented 5 years ago

I looked at the history and I do indeed see the SonarQube entry in the summary, it somehow stopped doing that for reasons that are still unknown to me. I guess I'll have to try and fix that first now.

Perhaps something simply "bugged out" and I have to redo the whole SonarQube setup... It has happened before from what I've heard.

lnaia commented 5 years ago

@simondel, thank you very much for your efforts already.

We are running SonarQube locally, with v.: 6.7.2.37468

I'm getting similar results to the ones already posted here:

==============================================================================
Task         : SonarQube build breaker
Description  : Break the build when the quality gate fails.
Version      : 8.0.0
Author       : Simon de Lang
Help         : 
==============================================================================
Number of analyses in this build: 0
Summary of statusses: 
##[section]Finishing: Break build on quality gate failure

From the task

==============================================================================
Task         : Run Code Analysis
Description  : Run scanner and upload the results to the SonarQube server.
Version      : 4.6.3
Author       : sonarsource
Help         : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================

We can see the path of where the results are being saved:

10:35:46.954 INFO: Working dir: /home/vsts/work/1/s/.scannerwork
...etc...
10:35:57.900 INFO: Analysis report generated in 591ms, dir size=2 MB
10:35:58.889 INFO: Analysis reports compressed in 988ms, zip size=1 MB
10:35:58.889 INFO: Analysis report generated in /home/vsts/work/1/s/.scannerwork/scanner-report
10:35:58.889 DEBUG: Upload report
10:36:01.468 DEBUG: POST 200 http://SERVER_HOST/api/ce/submit?projectKey=PROJ_KEY&projectName=PROJ_NAME | time=2578ms
10:36:01.469 INFO: Analysis report uploaded in 2580ms
10:36:01.470 INFO: ANALYSIS SUCCESSFUL, you can browse http://SERVER_HOST/dashboard/index/PROJ_KEY
10:36:01.470 INFO: Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
10:36:01.470 INFO: More about the report processing at http://SERVER_HOST/api/ce/task?id=AWypcqgokIA-25T8s2Es
10:36:01.471 DEBUG: Report metadata written to /home/vsts/work/1/s/.scannerwork/report-task.txt
10:36:01.472 DEBUG: Post-jobs : 
10:36:01.476 INFO: Task total time: 17.871 s
10:36:01.673 INFO: ------------------------------------------------------------------------
10:36:01.674 INFO: EXECUTION SUCCESS
10:36:01.674 INFO: ------------------------------------------------------------------------
10:36:01.674 INFO: Total time: 27.992s
10:36:01.770 INFO: Final Memory: 21M/535M
10:36:01.770 INFO: ------------------------------------------------------------------------
==============================================================================
Task         : Publish Quality Gate Result
Description  : Publish SonarQube's Quality Gate result on the Azure DevOps build result, to be used after the actual analysis.
Version      : 4.7.0
Author       : sonarsource
Help         : [More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
##[debug]agent.TempDirectory=/home/vsts/work/_temp
##[debug]loading inputs and endpoints
##[debug]loading INPUT_POLLINGTIMEOUTSEC
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading SECRET_SONARQUBE_ENDPOINT
##[debug]loaded 5
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]SONARQUBE_SCANNER_PARAMS={"sonar.host.url":"http://SERVER_HOST/","sonar.login":***,"project.settings":"/home/vsts/work/1/s/sonar-project.properties","sonar.scanner.metadataFilePath":"/home/vsts/work/_temp/sonar/1.0.58849.1/046c1de1-f12a-1217-df02-9712fd8044d8/report-task.txt"}
##[debug]SONARQUBE_ENDPOINT=***
##[debug][SQ] API GET: '/api/metrics/search' with query "{"f":"name","ps":500}"
##[debug]Response: 200 Body:
...etc...
##[debug]pattern: 'sonar/1.0.58849.1/**/report-task.txt'
##[debug]findPath: '/home/vsts/work/_temp/sonar/1.0.58849.1'
##[debug]statOnly: 'false'
##[debug]findPath: '/home/vsts/work/_temp/sonar/1.0.58849.1'
##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
##[debug]findOptions.followSymbolicLinks: 'true'
##[debug]0 results
##[debug]found 0 paths
##[debug]applying include pattern
##[debug]adjustedPattern: '/home/vsts/work/_temp/sonar/1.0.58849.1/**/report-task.txt'
##[debug]0 matches
##[debug]0 final results
##[debug][SQ] Searching for sonar/1.0.58849.1/**/report-task.txt - found 0 file(s)
##[debug]Number of analyses in this build: 0
##[debug]Overall Quality Gate status: ok
##[debug]System.TeamFoundationCollectionUri=https://COMPANY.visualstudio.com/
##[debug]System.TeamProjectId=PROJECT_ID
##[debug]Build.BuildId=58849
##[debug][{"op":"add","path":"/sonarglobalqualitygate","value":"ok"}]
SYSTEMVSSCONNECTION exists true
##[debug]SYSTEMVSSCONNECTION exists true
##[debug]build.artifactStagingDirectory=/home/vsts/work/1/a
##[debug][SQ] Summary saved at: /home/vsts/work/1/a/.sqAnalysis/SonarQubeBuildSummary.md
##[debug][SQ] Uploading build summary from /home/vsts/work/1/a/.sqAnalysis/SonarQubeBuildSummary.md
##[debug]Processed: ##vso[task.addattachment type=Distributedtask.Core.Summary;name=SonarQube Analysis Report;]/home/vsts/work/1/a/.sqAnalysis/SonarQubeBuildSummary.md
##[debug]Response: 200 Body: ""{\"count\":1,\"value\":{\"sonarglobalqualitygate\":{\"$type\":\"System.String\",\"$value\":\"ok\"}}}""
##[section]Finishing: Publish Quality Gate Result

Now with full detail, regarding your specific task:

##[debug]Evaluating condition for step: 'Break build on quality gate failure'
##[debug]Evaluating: succeeded()
##[debug]Evaluating succeeded:
##[debug]=> True
##[debug]Result: True
##[section]Starting: Break build on quality gate failure
==============================================================================
Task         : SonarQube build breaker
Description  : Break the build when the quality gate fails.
Version      : 8.0.0
Author       : Simon de Lang
Help         : 
==============================================================================
##[debug]agent.TempDirectory=/home/vsts/work/_temp
##[debug]loading inputs and endpoints
##[debug]loading INPUT_SONARQUBE
##[debug]loading ENDPOINT_AUTH_8439c182-9d02-46e9-ae60-
##[debug]loading ENDPOINT_AUTH_SCHEME_8439c182-9d02-46e9-ae60-
##[debug]loading ENDPOINT_AUTH_PARAMETER_8439c182-9d02-46e9-ae60-_USERNAME
##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION
##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
##[debug]loading SECRET_SONARQUBE_ENDPOINT
##[debug]loaded 8
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
##[debug]SonarQube=8439c182-9d02-46e9-ae60-
##[debug]8439c182-9d02-46e9-ae60-=http://SERVER_HOST/
##[debug]8439c182-9d02-46e9-ae60- auth param apitoken = null
##[debug]8439c182-9d02-46e9-ae60- auth param username = ***
##[debug]8439c182-9d02-46e9-ae60- auth param password = null
##[debug]organization=null
##[debug][SQ] API GET: '/api/metrics/search' with query "{"f":"name","ps":500}"
##[debug]Response: 200 Body: "{"metrics":[{"id":"11","key":"accessors","type":"INT","name":"Accessors"},{"id":"120","key":"new_technical_debt","type":"WORK_DUR","name":"Added Technical Debt"},{"id":"97","key":"blocker_violations","type":"INT","name":"Blocker Issues"},{"id":"64","key":"new_it_conditions_to_cover","type":"INT","name":"Branches to Cover by IT on New Code"},{"id":"115","key":"bugs","type":"INT","name":"Bugs"},{"id":"142","key":"burned_budget","type":"FLOAT","name":"Burned budget"},{"id":"143","key":"business_value","type":"FLOAT","name":"Business value"},{"id":"26","key":"class_complexity_distribution","type":"DISTRIB","name":"Class Distribution / Complexity"},{"id":"7","key":"classes","type":"INT","name":"Classes"},{"id":"113","key":"code_smells","type":"INT","name":"Code Smells"},{"id":"29","key":"cognitive_complexity","type":"INT","name":"Cognitive Complexity"},{"id":"19","key":"commented_out_code_lines","type":"INT","name":"Commented-Out LOC"},{"id":"15","key":"comment_lines","type":"INT","name":"Comment Lines"},{"id":"136","key":"comment_lines_data","type":"DATA","name":"comment_lines_data"},{"id":"148","key":"cloc","type":"INT","name":"Comment Lines of Code"},{"id":"16","key":"comment_lines_density","type":"PERCENT","name":"Comments (%)"},{"id":"23","key":"class_complexity","type":"FLOAT","name":"Complexity / Class"},{"id":"21","key":"file_complexity","type":"FLOAT","name":"Complexity / File"},{"id":"25","key":"function_complexity","type":"FLOAT","name":"Complexity / Function"},{"id":"22","key":"complexity_in_classes","type":"INT","name":"Complexity in Classes"},{"id":"24","key":"complexity_in_functions","type":"INT","name":"Complexity in Functions"},{"id":"50","key":"branch_coverage","type":"PERCENT","name":"Condition Coverage"},{"id":"68","key":"new_it_branch_coverage","type":"PERCENT","name":"Condition Coverage by IT on New Code"},{"id":"51","key":"new_branch_coverage","type":"PERCENT","name":"Condition Coverage on New Code"},{"id":"52","key":"conditions_by_line","type":"DATA","name":"Conditions by Line"},{"id":"46","key":"conditions_to_cover","type":"INT","name":"Conditions to Cover"},{"id":"47","key":"new_conditions_to_cover","type":"INT","name":"Conditions to Cover on New Code"},{"id":"112","key":"confirmed_issues","type":"INT","name":"Confirmed Issues"},{"id":"37","key":"coverage","type":"PERCENT","name":"Coverage"},{"id":"55","key":"new_it_coverage","type":"PERCENT","name":"Coverage by IT on New Code"},{"id":"45","key":"coverage_line_hits_data","type":"DATA","name":"Coverage Hits by Line"},{"id":"38","key":"new_coverage","type":"PERCENT","name":"Coverage on New Code"},{"id":"53","key":"covered_conditions_by_line","type":"DATA","name":"Covered Conditions by Line"},{"id":"98","key":"critical_violations","type":"INT","name":"Critical Issues"},{"id":"20","key":"complexity","type":"INT","name":"Cyclomatic Complexity"},{"id":"141","key":"last_commit_date","type":"MILLISEC","name":"Date of Last Commit"},{"id":"9","key":"directories","type":"INT","name":"Directories"},{"id":"90","key":"duplicated_blocks","type":"INT","name":"Duplicated Blocks"},{"id":"91","key":"new_duplicated_blocks","type":"INT","name":"Duplicated Blocks on New Code"},{"id":"92","key":"duplicated_files","type":"INT","name":"Duplicated Files"},{"id":"88","key":"duplicated_lines","type":"INT","name":"Duplicated Lines"},{"id":"93","key":"duplicated_lines_density","type":"PERCENT","name":"Duplicated Lines (%)"},{"id":"89","key":"new_duplicated_lines","type":"INT","name":"Duplicated Lines on New Code"},{"id":"94","key":"new_duplicated_lines_density","type":"PERCENT","name":"Duplicated Lines on New Code (%)"},{"id":"95","key":"duplications_data","type":"DATA","name":"Duplication Details"},{"id":"126","key":"effort_to_reach_maintainability_rating_a","type":"WORK_DUR","name":"Effort to Reach Maintainability Rating A"},{"id":"137","key":"executable_lines_data","type":"DATA","name":"executable_lines_data"},{"id":"108","key":"false_positive_issues","type":"INT","name":"False Positive Issues"},{"id":"28","key":"file_complexity_distribution","type":"DISTRIB","name":"File Distribution / Complexity"},{"id":"8","key":"files","type":"INT","name":"Files"},{"id":"27","key":"function_complexity_distribution","type":"DISTRIB","name":"Function Distribution / Complexity"},{"id":"10","key":"functions","type":"INT","name":"Functions"},{"id":"2","key":"generated_lines","type":"INT","name":"Generated Lines"},{"id":"6","key":"generated_ncloc","type":"INT","name":"Generated Lines of Code"},{"id":"101","key":"info_violations","type":"INT","name":"Info Issues"},{"id":"96","key":"violations","type":"INT","name":"Issues"},{"id":"63","key":"it_conditions_to_cover","type":"INT","name":"IT Branches to Cover"},{"id":"67","key":"it_branch_coverage","type":"PERCENT","name":"IT Condition Coverage"},{"id":"69","key":"it_conditions_by_line","type":"DATA","name":"IT Conditions by Line"},{"id":"54","key":"it_coverage","type":"PERCENT","name":"IT Coverage"},{"id":"62","key":"it_coverage_line_hits_data","type":"DATA","name":"IT Coverage Hits by Line"},{"id":"70","key":"it_covered_conditions_by_line","type":"DATA","name":"IT Covered Conditions by Line"},{"id":"60","key":"it_line_coverage","type":"PERCENT","name":"IT Line Coverage"},{"id":"56","key":"it_lines_to_cover","type":"INT","name":"IT Lines to Cover"},{"id":"65","key":"it_uncovered_conditions","type":"INT","name":"IT Uncovered Conditions"},{"id":"58","key":"it_uncovered_lines","type":"INT","name":"IT Uncovered Lines"},{"id":"43","key":"line_coverage","type":"PERCENT","name":"Line Coverage"},{"id":"61","key":"new_it_line_coverage","type":"PERCENT","name":"Line Coverage by IT on New Code"},{"id":"44","key":"new_line_coverage","type":"PERCENT","name":"Line Coverage on New Code"},{"id":"1","key":"lines","type":"INT","name":"Lines"},{"id":"3","key":"ncloc","type":"INT","name":"Lines of Code"},{"id":"145","key":"loc","type":"INT","name":"Lines of Code"},{"id":"5","key":"ncloc_language_distribution","type":"DATA","name":"Lines of Code Per Language"},{"id":"39","key":"lines_to_cover","type":"INT","name":"Lines to Cover"},{"id":"57","key":"new_it_lines_to_cover","type":"INT","name":"Lines to Cover by IT on New Code"},{"id":"40","key":"new_lines_to_cover","type":"INT","name":"Lines to Cover on New Code"},{"id":"147","key":"lloc","type":"INT","name":"Logical Lines of Code"},{"id":"121","key":"sqale_rating","type":"RATING","name":"Maintainability Rating"},{"id":"122","key":"new_maintainability_rating","type":"RATING","name":"Maintainability Rating on New Code"},{"id":"99","key":"major_violations","type":"INT","name":"Major Issues"},{"id":"100","key":"minor_violations","type":"INT","name":"Minor Issues"},{"id":"135","key":"ncloc_data","type":"DATA","name":"ncloc_data"},{"id":"103","key":"new_blocker_violations","type":"INT","name":"New Blocker Issues"},{"id":"116","key":"new_bugs","type":"INT","name":"New Bugs"},{"id":"114","key":"new_code_smells","type":"INT","name":"New Code Smells"},{"id":"104","key":"new_critical_violations","type":"INT","name":"New Critical Issues"},{"id":"107","key":"new_info_violations","type":"INT","name":"New Info Issues"},{"id":"102","key":"new_violations","type":"INT","name":"New Issues"},{"id":"4","key":"new_lines","type":"INT","name":"New Lines"},{"id":"105","key":"new_major_violations","type":"INT","name":"New Major Issues"},{"id":"106","key":"new_minor_violations","type":"INT","name":"New Minor Issues"},{"id":"118","key":"new_vulnerabilities","type":"INT","name":"New Vulnerabilities"},{"id":"110","key":"open_issues","type":"INT","name":"Open Issues"},{"id":"80","key":"overall_conditions_to_cover","type":"INT","name":"Overall Branches to Cover"},{"id":"81","key":"new_overall_conditions_to_cover","type":"INT","name":"Overall Branches to Cover on New Code"},{"id":"84","key":"overall_branch_coverage","type":"PERCENT","name":"Overall Condition Coverage"},{"id":"85","key":"new_overall_branch_coverage","type":"PERCENT","name":"Overall Condition Coverage on New Code"},{"id":"86","key":"overall_conditions_by_line","type":"DATA","name":"Overall Conditions by Line"},{"id":"71","key":"overall_coverage","type":"PERCENT","name":"Overall Coverage"},{"id":"79","key":"overall_coverage_line_hits_data","type":"DATA","name":"Overall Coverage Hits by Line"},{"id":"72","key":"new_overall_coverage","type":"PERCENT","name":"Overall Coverage on New Code"},{"id":"87","key":"overall_covered_conditions_by_line","type":"DATA","name":"Overall Covered Conditions by Line"},{"id":"77","key":"overall_line_coverage","type":"PERCENT","name":"Overall Line Coverage"},{"id":"78","key":"new_overall_line_coverage","type":"PERCENT","name":"Overall Line Coverage on New Code"},{"id":"73","key":"overall_lines_to_cover","type":"INT","name":"Overall Lines to Cover"},{"id":"74","key":"new_overall_lines_to_cover","type":"INT","name":"Overall Lines to Cover on New Code"},{"id":"82","key":"overall_uncovered_conditions","type":"INT","name":"Overall Uncovered Conditions"},{"id":"83","key":"new_overall_uncovered_conditions","type":"INT","name":"Overall Uncovered Conditions on New Code"},{"id":"75","key":"overall_uncovered_lines","type":"INT","name":"Overall Uncovered Lines"},{"id":"76","key":"new_overall_uncovered_lines","type":"INT","name":"Overall Uncovered Lines on New Code"},{"id":"140","key":"quality_profiles","type":"DATA","name":"Profiles"},{"id":"149","key":"project_complexity","type":"INT","name":"Project Cyclomatic Complexity"},{"id":"14","key":"projects","type":"INT","name":"Projects"},{"id":"13","key":"public_api","type":"INT","name":"Public API"},{"id":"17","key":"public_documented_api_density","type":"PERCENT","name":"Public Documented API (%)"},{"id":"18","key":"public_undocumented_api","type":"INT","name":"Public Undocumented API"},{"id":"139","key":"quality_gate_details","type":"DATA","name":"Quality Gate Details"},{"id":"138","key":"alert_status","type":"LEVEL","name":"Quality Gate Status"},{"id":"129","key":"reliability_rating","type":"RATING","name":"Reliability Rating"},{"id":"130","key":"new_reliability_rating","type":"RATING","name":"Reliability Rating on New Code"},{"id":"127","key":"reliability_remediation_effort","type":"WORK_DUR","name":"Reliability Remediation Effort"},{"id":"128","key":"new_reliability_remediation_effort","type":"WORK_DUR","name":"Reliability Remediation Effort on New Code"},{"id":"111","key":"reopened_issues","type":"INT","name":"Reopened Issues"},{"id":"133","key":"security_rating","type":"RATING","name":"Security Rating"},{"id":"134","key":"new_security_rating","type":"RATING","name":"Security Rating on New Code"},{"id":"131","key":"security_remediation_effort","type":"WORK_DUR","name":"Security Remediation Effort"},{"id":"132","key":"new_security_remediation_effort","type":"WORK_DUR","name":"Security Remediation Effort on New Code"},{"id":"33","key":"skipped_tests","type":"INT","name":"Skipped Unit Tests"},{"id":"150","key":"sonarjava_feedback","type":"DATA","name":"SonarJava feedback"},{"id":"146","key":"sloc","type":"INT","name":"Source Lines of Code"},{"id":"123","key":"development_cost","type":"STRING","name":"SQALE Development Cost"},{"id":"12","key":"statements","type":"INT","name":"Statements"},{"id":"144","key":"team_size","type":"INT","name":"Team size"},{"id":"119","key":"sqale_index","type":"WORK_DUR","name":"Technical Debt"},{"id":"124","key":"sqale_debt_ratio","type":"PERCENT","name":"Technical Debt Ratio"},{"id":"125","key":"new_sqale_debt_ratio","type":"PERCENT","name":"Technical Debt Ratio on New Code"},{"id":"48","key":"uncovered_conditions","type":"INT","name":"Uncovered Conditions"},{"id":"66","key":"new_it_uncovered_conditions","type":"INT","name":"Uncovered Conditions by IT on New Code"},{"id":"49","key":"new_uncovered_conditions","type":"INT","name":"Uncovered Conditions on New Code"},{"id":"41","key":"uncovered_lines","type":"INT","name":"Uncovered Lines"},{"id":"59","key":"new_it_uncovered_lines","type":"INT","name":"Uncovered Lines by IT on New Code"},{"id":"42","key":"new_uncovered_lines","type":"INT","name":"Uncovered Lines on New Code"},{"id":"36","key":"test_data","type":"DATA","name":"Unit Test Details"},{"id":"31","key":"test_execution_time","type":"MILLISEC","name":"Unit Test Duration"},{"id":"32","key":"test_errors","type":"INT","name":"Unit Test Errors"},{"id":"34","key":"test_failures","type":"INT","name":"Unit Test Failures"},{"id":"30","key":"tests","type":"INT","name":"Unit Tests"},{"id":"35","key":"test_success_density","type":"PERCENT","name":"Unit Test Success (%)"},{"id":"117","key":"vulnerabilities","type":"INT","name":"Vulnerabilities"},{"id":"109","key":"wont_fix_issues","type":"INT","name":"Won't Fix Issues"}],"total":150,"p":1,"ps":500}"
##[debug]Build.BuildNumber=1.0.58849.1
##[debug]Agent.TempDirectory=/home/vsts/work/_temp
##[debug]defaultRoot: '/home/vsts/work/_temp'
##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
##[debug]findOptions.followSymbolicLinks: 'true'
##[debug]matchOptions.debug: 'false'
##[debug]matchOptions.nobrace: 'true'
##[debug]matchOptions.noglobstar: 'false'
##[debug]matchOptions.dot: 'true'
##[debug]matchOptions.noext: 'false'
##[debug]matchOptions.nocase: 'false'
##[debug]matchOptions.nonull: 'false'
##[debug]matchOptions.matchBase: 'false'
##[debug]matchOptions.nocomment: 'false'
##[debug]matchOptions.nonegate: 'false'
##[debug]matchOptions.flipNegate: 'false'
##[debug]pattern: 'sonar/1.0.58849.1/**/report-task.txt'
##[debug]findPath: '/home/vsts/work/_temp/sonar/1.0.58849.1'
##[debug]statOnly: 'false'
##[debug]findPath: '/home/vsts/work/_temp/sonar/1.0.58849.1'
##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
##[debug]findOptions.followSymbolicLinks: 'true'
##[debug]0 results
##[debug]found 0 paths
##[debug]applying include pattern
##[debug]adjustedPattern: '/home/vsts/work/_temp/sonar/1.0.58849.1/**/report-task.txt'
##[debug]0 matches
##[debug]0 final results
##[debug][SQ] Searching for sonar/1.0.58849.1/**/report-task.txt - found 0 file(s)
Number of analyses in this build: 0
Summary of statusses: 
##[section]Finishing: Break build on quality gate failure
lnaia commented 5 years ago

@simondel Ideally, it should break the build at this point, but

##[debug]matchOptions.flipNegate: 'false'
##[debug]pattern: 'sonar/1.0.58849.1/**/report-task.txt'
##[debug]findPath: '/home/vsts/work/_temp/sonar/1.0.58849.1'
##[debug]statOnly: 'false'
##[debug]findPath: '/home/vsts/work/_temp/sonar/1.0.58849.1'
##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
##[debug]findOptions.followSymbolicLinks: 'true'
##[debug]0 results
##[debug]found 0 paths
##[debug]applying include pattern
##[debug]adjustedPattern: '/home/vsts/work/_temp/sonar/1.0.58849.1/**/report-task.txt'
##[debug]0 matches
##[debug]0 final results
##[debug][SQ] Searching for sonar/1.0.58849.1/**/report-task.txt - found 0 file(s)
##[debug]Number of analyses in this build: 0
##[debug]Overall Quality Gate status: ok

is reporting there's nothing to see here, just move along, as well; could be entirely on their side, the fact that it's not picking up the file results?

ManIkWeet commented 5 years ago

I think it's because the "report-task.txt" file isn't at the expected location. The file does exist, and it's written to a different location, namely /_work/##/.sonarqube/out/.sonar/report-task.txt

The change to the _temp folder was done in commit e71f6f0598e030cdd4558abbbbd6533a6024fb1d and I can see that the Publish task from SonarQube also made this change.

So I guess the question now is: how to get the report-task.txt file in the _temp folder?

lnaia commented 5 years ago

@ManIkWeet I'm on it as well, I'm configuring sonar.properties, taken from: https://docs.sonarqube.org/latest/analysis/analysis-parameters/

sonar.scanner.metadataFilePath=report-task.txt

to ensure it's where it's expected, and running those builds as I type this. Both seem to have eager search, I'm giving it a try at the project root, before escalating to specific temp. folder

simondel commented 5 years ago

I don't think you're supposed to set the file location manually :/ But I'm also not sure why your config's don't set it in the correct place to begin with...

lnaia commented 5 years ago

I'm currently trying to set it where, the rest of the tasks expects to read from it, like so:

# task: Prepare analysis on SonarQube
sonar.scanner.metadataFilePath=$(Agent.TempDirectory)/sonar/$(Build.BuildId)/report-task.txt

The tasks run in the following order: image

##[section]Starting: Prepare analysis on SonarQube
==============================================================================
Task         : Prepare Analysis Configuration
Description  : Prepare SonarQube analysis configuration
Version      : 4.7.2
Author       : sonarsource
Help         : [More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
...etc...
##[debug]set SONARQUBE_SCANNER_PARAMS={"sonar.host.url":"http://52.164.243.4:9000/","sonar.login":***,"project.settings":"D:\\a\\1\\s\\sonar-project.properties","sonar.scanner.metadataFilePath":"D:\\a\\_temp\\sonar\\1.0.58891.1\\0c8df93a-f11a-c5d3-bc16-7486afbe9d43\\report-task.txt"}
##[debug]Processed: ##vso[task.setvariable variable=SONARQUBE_SCANNER_PARAMS;issecret=false;]{"sonar.host.url":"http://52.164.243.4:9000/","sonar.login":***,"project.settings":"D:\\a\\1\\s\\sonar-project.properties","sonar.scanner.metadataFilePath":"D:\\a\\_temp\\sonar\\1.0.58891.1\\0c8df93a-f11a-c5d3-bc16-7486afbe9d43\\report-task.txt"}

But when I check:

==============================================================================
Task         : Run Code Analysis
Description  : Run scanner and upload the results to the SonarQube server.
Version      : 4.6.3
Author       : sonarsource
Help         : This task is not needed for Maven and Gradle projects since the scanner should be run as part of the build.

[More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================
...etc...
14:14:57.006 DEBUG: Report metadata written to D:\a\1\s\.scannerwork\report-task.txt
14:14:57.008 DEBUG: Post-jobs : 
14:14:57.013 INFO: Task total time: 15.387 s
14:14:57.946 INFO: ------------------------------------------------------------------------
14:14:57.946 INFO: EXECUTION SUCCESS
14:14:57.946 INFO: ------------------------------------------------------------------------
14:14:57.946 INFO: Total time: 31.798s
14:14:58.038 INFO: Final Memory: 12M/337M
14:14:58.038 INFO: ------------------------------------------------------------------------

And then the following one, before yours also doesn't pick up the scan results.

##[section]Starting: Publish Quality Gate Result
==============================================================================
Task         : Publish Quality Gate Result
Description  : Publish SonarQube's Quality Gate result on the Azure DevOps build result, to be used after the actual analysis.
Version      : 4.7.0
Author       : sonarsource
Help         : [More Information](http://redirect.sonarsource.com/doc/install-configure-scanner-tfs-ts.html)
==============================================================================

...etc...
##[debug]pattern: 'sonar\1.0.58891.1\**\report-task.txt'
##[debug]findPath: 'D:\a\_temp\sonar\1.0.58891.1'
##[debug]statOnly: 'false'
##[debug]findPath: 'D:\a\_temp\sonar\1.0.58891.1'
##[debug]findOptions.allowBrokenSymbolicLinks: 'false'
##[debug]findOptions.followSpecifiedSymbolicLink: 'true'
##[debug]findOptions.followSymbolicLinks: 'true'
##[debug]0 results
##[debug]found 0 paths
##[debug]applying include pattern
##[debug]adjustedPattern: 'D:\a\_temp\sonar\1.0.58891.1\**\report-task.txt'
##[debug]0 matches
##[debug]0 final results
##[debug][SQ] Searching for sonar\1.0.58891.1\**\report-task.txt - found 0 file(s)
##[debug]Number of analyses in this build: 0

Right now my guess is that Run Code Analysis isn't reading that property correctly, so it saves on the wrong place by default, instead of the manually specified one.

I don't like it to have to change default behaviors, to the point where I say where it will be written, but given that is an option, it should work. Right now I have no clue, as to why it doesn't

lnaia commented 5 years ago

Before I leave, I'm trying something else, that so far I have had positive results. Between tasks, after the report metadata is written, I'm creating a symbolic link to that report, on the target path that but subsequent tasks expect the file to be.

So the file is there before, Publish Quality Gate Result and Break build on quality gate failure kick in. I have a number of builds on the queue, I'll report the success of this approach tomorrow. o/

Update @simondel worked perfectly.

a command line task with the following code, just after the Run Code Analisis:

mkdir -p "$(Agent.TempDirectory)/sonar/$(Build.BuildNumber)"
ln -s $(System.DefaultWorkingDirectory)/.scannerwork\report-task.txt $(Agent.TempDirectory)/sonar/$(Build.BuildNumber)/report-task.txt

This has nothing to do with your task, or your plugin. As they work 100%. Something changes in SonarQube tasks, to the point where:

All I did was symbolic link it, to ensure that even the publish quality gate result worked. If you active the debug mode, you can see further details where the tasks are looking for the report.

Again, @simondel thank you for all your attention, but this is on SonarQube.

ManIkWeet commented 5 years ago

@lnaia Your command doesn't work for me:

'ln' is not recognized as an internal or external command,
operable program or batch file.

I have made a command line script task and pasted your command in it.

emi662002 commented 5 years ago

@simondel

i have version 8 of the break build sonarqube task,

i have no results on the summary of the build and it is not breaking on failure.

debug says 0:

2019-08-22T06:01:17.3180064Z ##[debug]Evaluating condition for step: 'Break build on quality gate failure' 2019-08-22T06:01:17.3180731Z ##[debug]Evaluating: succeeded() 2019-08-22T06:01:17.3180895Z ##[debug]Evaluating succeeded: 2019-08-22T06:01:17.3181081Z ##[debug]=> True 2019-08-22T06:01:17.3181292Z ##[debug]Result: True 2019-08-22T06:01:17.3181485Z ##[section]Starting: Break build on quality gate failure 2019-08-22T06:01:17.3185026Z ============================================================================== 2019-08-22T06:01:17.3185100Z Task : SonarQube build breaker 2019-08-22T06:01:17.3185164Z Description : Break the build when the quality gate fails. 2019-08-22T06:01:17.3185212Z Version : 8.0.0 2019-08-22T06:01:17.3185286Z Author : Simon de Lang 2019-08-22T06:01:17.3185331Z Help : 2019-08-22T06:01:17.3185395Z ============================================================================== 2019-08-22T06:01:18.5213125Z ##[debug]agent.TempDirectory=D:\agent_work_temp 2019-08-22T06:01:18.5213500Z ##[debug]loading inputs and endpoints 2019-08-22T06:01:18.5213686Z ##[debug]loading ENDPOINT_AUTH_a15e5241-ad0b-4078-b6a8-4b468f6846ba 2019-08-22T06:01:18.5213869Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_a15e5241-ad0b-4078-b6a8-4b468f6846ba_USERNAME 2019-08-22T06:01:18.5214036Z ##[debug]loading ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN 2019-08-22T06:01:18.5214209Z ##[debug]loading ENDPOINT_AUTH_SCHEME_a15e5241-ad0b-4078-b6a8-4b468f6846ba 2019-08-22T06:01:18.5214376Z ##[debug]loading ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION 2019-08-22T06:01:18.5214498Z ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION 2019-08-22T06:01:18.5214661Z ##[debug]loading INPUT_SONARQUBE 2019-08-22T06:01:18.5214835Z ##[debug]loading SECRET_SONARQUBE_ENDPOINT 2019-08-22T06:01:18.5214969Z ##[debug]loaded 8 2019-08-22T06:01:18.5215082Z ##[debug]Agent.ProxyUrl=undefined 2019-08-22T06:01:18.5215236Z ##[debug]Agent.CAInfo=undefined 2019-08-22T06:01:18.5215351Z ##[debug]Agent.ClientCert=undefined 2019-08-22T06:01:18.5215518Z ##[debug]Agent.SkipCertValidation=undefined 2019-08-22T06:01:18.5215694Z ##[debug]SonarQube=a15e5241-ad0b-4078-b6a8-4b468f6846ba 2019-08-22T06:01:18.5224448Z ##[debug]a15e5241-ad0b-4078-b6a8-4b468f6846ba=http://10.100.3.30:9000/sonarqube 2019-08-22T06:01:18.5225853Z ##[debug]a15e5241-ad0b-4078-b6a8-4b468f6846ba auth param apitoken = null 2019-08-22T06:01:18.5226475Z ##[debug]a15e5241-ad0b-4078-b6a8-4b468f6846ba auth param username = ** 2019-08-22T06:01:18.5226687Z ##[debug]a15e5241-ad0b-4078-b6a8-4b468f6846ba auth param password = null 2019-08-22T06:01:18.5226863Z ##[debug]organization=null 2019-08-22T06:01:18.5227470Z ##[debug][SQ] API GET: '/api/metrics/search' with query "{"f":"name","ps":500}" 2019-08-22T06:01:18.5231861Z ##[debug]Response: 200 Body: "{"metrics":[{"id":"11","key":"accessors","type":"INT","name":"Accessors"},{"id":"120","key":"new_technical_debt","type":"WORK_DUR","name":"Added Technical Debt"},{"id":"97","key":"blocker_violations","type":"INT","name":"Blocker Issues"},{"id":"64","key":"new_it_conditions_to_cover","type":"INT","name":"Branches to Cover by IT on New Code"},{"id":"115","key":"bugs","type":"INT","name":"Bugs"},{"id":"142","key":"burned_budget","type":"FLOAT","name":"Burned budget"},{"id":"143","key":"business_value","type":"FLOAT","name":"Business value"},{"id":"26","key":"class_complexity_distribution","type":"DISTRIB","name":"Class Distribution / Complexity"},{"id":"7","key":"classes","type":"INT","name":"Classes"},{"id":"113","key":"code_smells","type":"INT","name":"Code Smells"},{"id":"29","key":"cognitive_complexity","type":"INT","name":"Cognitive Complexity"},{"id":"15","key":"comment_lines","type":"INT","name":"Comment Lines"},{"id":"136","key":"comment_lines_data","type":"DATA","name":"comment_lines_data"},{"id":"19","key":"commented_out_code_lines","type":"INT","name":"Commented-Out LOC"},{"id":"16","key":"comment_lines_density","type":"PERCENT","name":"Comments (%)"},{"id":"23","key":"class_complexity","type":"FLOAT","name":"Complexity / Class"},{"id":"21","key":"file_complexity","type":"FLOAT","name":"Complexity / File"},{"id":"25","key":"function_complexity","type":"FLOAT","name":"Complexity / Function"},{"id":"22","key":"complexity_in_classes","type":"INT","name":"Complexity in Classes"},{"id":"24","key":"complexity_in_functions","type":"INT","name":"Complexity in Functions"},{"id":"50","key":"branch_coverage","type":"PERCENT","name":"Condition Coverage"},{"id":"68","key":"new_it_branch_coverage","type":"PERCENT","name":"Condition Coverage by IT on New Code"},{"id":"51","key":"new_branch_coverage","type":"PERCENT","name":"Condition Coverage on New Code"},{"id":"52","key":"conditions_by_line","type":"DATA","name":"Conditions by Line"},{"id":"46","key":"conditions_to_cover","type":"INT","name":"Conditions to Cover"},{"id":"47","key":"new_conditions_to_cover","type":"INT","name":"Conditions to Cover on New Code"},{"id":"112","key":"confirmed_issues","type":"INT","name":"Confirmed Issues"},{"id":"37","key":"coverage","type":"PERCENT","name":"Coverage"},{"id":"55","key":"new_it_coverage","type":"PERCENT","name":"Coverage by IT on New Code"},{"id":"45","key":"coverage_line_hits_data","type":"DATA","name":"Coverage Hits by Line"},{"id":"38","key":"new_coverage","type":"PERCENT","name":"Coverage on New Code"},{"id":"53","key":"covered_conditions_by_line","type":"DATA","name":"Covered Conditions by Line"},{"id":"98","key":"critical_violations","type":"INT","name":"Critical Issues"},{"id":"20","key":"complexity","type":"INT","name":"Cyclomatic Complexity"},{"id":"141","key":"last_commit_date","type":"MILLISEC","name":"Date of Last Commit"},{"id":"9","key":"directories","type":"INT","name":"Directories"},{"id":"90","key":"duplicated_blocks","type":"INT","name":"Duplicated Blocks"},{"id":"91","key":"new_duplicated_blocks","type":"INT","name":"Duplicated Blocks on New Code"},{"id":"92","key":"duplicated_files","type":"INT","name":"Duplicated Files"},{"id":"88","key":"duplicated_lines","type":"INT","name":"Duplicated Lines"},{"id":"93","key":"duplicated_lines_density","type":"PERCENT","name":"Duplicated Lines (%)"},{"id":"89","key":"new_duplicated_lines","type":"INT","name":"Duplicated Lines on New Code"},{"id":"94","key":"new_duplicated_lines_density","type":"PERCENT","name":"Duplicated Lines on New Code (%)"},{"id":"95","key":"duplications_data","type":"DATA","name":"Duplication Details"},{"id":"126","key":"effort_to_reach_maintainability_rating_a","type":"WORK_DUR","name":"Effort to Reach Maintainability Rating A"},{"id":"137","key":"executable_lines_data","type":"DATA","name":"executable_lines_data"},{"id":"108","key":"false_positive_issues","type":"INT","name":"False Positive Issues"},{"id":"28","key":"file_complexity_distribution","type":"DISTRIB","name":"File Distribution / Complexity"},{"id":"8","key":"files","type":"INT","name":"Files"},{"id":"27","key":"function_complexity_distribution","type":"DISTRIB","name":"Function Distribution / Complexity"},{"id":"10","key":"functions","type":"INT","name":"Functions"},{"id":"2","key":"generated_lines","type":"INT","name":"Generated Lines"},{"id":"6","key":"generated_ncloc","type":"INT","name":"Generated Lines of Code"},{"id":"101","key":"info_violations","type":"INT","name":"Info Issues"},{"id":"96","key":"violations","type":"INT","name":"Issues"},{"id":"63","key":"it_conditions_to_cover","type":"INT","name":"IT Branches to Cover"},{"id":"67","key":"it_branch_coverage","type":"PERCENT","name":"IT Condition Coverage"},{"id":"69","key":"it_conditions_by_line","type":"DATA","name":"IT Conditions by Line"},{"id":"54","key":"it_coverage","type":"PERCENT","name":"IT Coverage"},{"id":"62","key":"it_coverage_line_hits_data","type":"DATA","name":"IT Coverage Hits by Line"},{"id":"70","key":"it_covered_conditions_by_line","type":"DATA","name":"IT Covered Conditions by Line"},{"id":"60","key":"it_line_coverage","type":"PERCENT","name":"IT Line Coverage"},{"id":"56","key":"it_lines_to_cover","type":"INT","name":"IT Lines to Cover"},{"id":"65","key":"it_uncovered_conditions","type":"INT","name":"IT Uncovered Conditions"},{"id":"58","key":"it_uncovered_lines","type":"INT","name":"IT Uncovered Lines"},{"id":"43","key":"line_coverage","type":"PERCENT","name":"Line Coverage"},{"id":"61","key":"new_it_line_coverage","type":"PERCENT","name":"Line Coverage by IT on New Code"},{"id":"44","key":"new_line_coverage","type":"PERCENT","name":"Line Coverage on New Code"},{"id":"1","key":"lines","type":"INT","name":"Lines"},{"id":"3","key":"ncloc","type":"INT","name":"Lines of Code"},{"id":"5","key":"ncloc_language_distribution","type":"DATA","name":"Lines of Code Per Language"},{"id":"39","key":"lines_to_cover","type":"INT","name":"Lines to Cover"},{"id":"57","key":"new_it_lines_to_cover","type":"INT","name":"Lines to Cover by IT on New Code"},{"id":"40","key":"new_lines_to_cover","type":"INT","name":"Lines to Cover on New Code"},{"id":"121","key":"sqale_rating","type":"RATING","name":"Maintainability Rating"},{"id":"122","key":"new_maintainability_rating","type":"RATING","name":"Maintainability Rating on New Code"},{"id":"99","key":"major_violations","type":"INT","name":"Major Issues"},{"id":"100","key":"minor_violations","type":"INT","name":"Minor Issues"},{"id":"135","key":"ncloc_data","type":"DATA","name":"ncloc_data"},{"id":"103","key":"new_blocker_violations","type":"INT","name":"New Blocker Issues"},{"id":"116","key":"new_bugs","type":"INT","name":"New Bugs"},{"id":"114","key":"new_code_smells","type":"INT","name":"New Code Smells"},{"id":"104","key":"new_critical_violations","type":"INT","name":"New Critical Issues"},{"id":"107","key":"new_info_violations","type":"INT","name":"New Info Issues"},{"id":"102","key":"new_violations","type":"INT","name":"New Issues"},{"id":"4","key":"new_lines","type":"INT","name":"New Lines"},{"id":"105","key":"new_major_violations","type":"INT","name":"New Major Issues"},{"id":"106","key":"new_minor_violations","type":"INT","name":"New Minor Issues"},{"id":"118","key":"new_vulnerabilities","type":"INT","name":"New Vulnerabilities"},{"id":"110","key":"open_issues","type":"INT","name":"Open Issues"},{"id":"80","key":"overall_conditions_to_cover","type":"INT","name":"Overall Branches to Cover"},{"id":"81","key":"new_overall_conditions_to_cover","type":"INT","name":"Overall Branches to Cover on New Code"},{"id":"84","key":"overall_branch_coverage","type":"PERCENT","name":"Overall Condition Coverage"},{"id":"85","key":"new_overall_branch_coverage","type":"PERCENT","name":"Overall Condition Coverage on New Code"},{"id":"86","key":"overall_conditions_by_line","type":"DATA","name":"Overall Conditions by Line"},{"id":"71","key":"overall_coverage","type":"PERCENT","name":"Overall Coverage"},{"id":"79","key":"overall_coverage_line_hits_data","type":"DATA","name":"Overall Coverage Hits by Line"},{"id":"72","key":"new_overall_coverage","type":"PERCENT","name":"Overall Coverage on New Code"},{"id":"87","key":"overall_covered_conditions_by_line","type":"DATA","name":"Overall Covered Conditions by Line"},{"id":"77","key":"overall_line_coverage","type":"PERCENT","name":"Overall Line Coverage"},{"id":"78","key":"new_overall_line_coverage","type":"PERCENT","name":"Overall Line Coverage on New Code"},{"id":"73","key":"overall_lines_to_cover","type":"INT","name":"Overall Lines to Cover"},{"id":"74","key":"new_overall_lines_to_cover","type":"INT","name":"Overall Lines to Cover on New Code"},{"id":"82","key":"overall_uncovered_conditions","type":"INT","name":"Overall Uncovered Conditions"},{"id":"83","key":"new_overall_uncovered_conditions","type":"INT","name":"Overall Uncovered Conditions on New Code"},{"id":"75","key":"overall_uncovered_lines","type":"INT","name":"Overall Uncovered Lines"},{"id":"76","key":"new_overall_uncovered_lines","type":"INT","name":"Overall Uncovered Lines on New Code"},{"id":"140","key":"quality_profiles","type":"DATA","name":"Profiles"},{"id":"14","key":"projects","type":"INT","name":"Projects"},{"id":"13","key":"public_api","type":"INT","name":"Public API"},{"id":"17","key":"public_documented_api_density","type":"PERCENT","name":"Public Documented API (%)"},{"id":"18","key":"public_undocumented_api","type":"INT","name":"Public Undocumented API"},{"id":"139","key":"quality_gate_details","type":"DATA","name":"Quality Gate Details"},{"id":"138","key":"alert_status","type":"LEVEL","name":"Quality Gate Status"},{"id":"129","key":"reliability_rating","type":"RATING","name":"Reliability Rating"},{"id":"130","key":"new_reliability_rating","type":"RATING","name":"Reliability Rating on New Code"},{"id":"127","key":"reliability_remediation_effort","type":"WORK_DUR","name":"Reliability Remediation Effort"},{"id":"128","key":"new_reliability_remediation_effort","type":"WORK_DUR","name":"Reliability Remediation Effort on New Code"},{"id":"111","key":"reopened_issues","type":"INT","name":"Reopened Issues"},{"id":"133","key":"security_rating","type":"RATING","name":"Security Rating"},{"id":"134","key":"new_security_rating","type":"RATING","name":"Security Rating on New Code"},{"id":"131","key":"security_remediation_effort","type":"WORK_DUR","name":"Security Remediation Effort"},{"id":"132","key":"new_security_remediation_effort","type":"WORK_DUR","name":"Security Remediation Effort on New Code"},{"id":"33","key":"skipped_tests","type":"INT","name":"Skipped Unit Tests"},{"id":"123","key":"development_cost","type":"STRING","name":"SQALE Development Cost"},{"id":"12","key":"statements","type":"INT","name":"Statements"},{"id":"144","key":"team_size","type":"INT","name":"Team size"},{"id":"119","key":"sqale_index","type":"WORK_DUR","name":"Technical Debt"},{"id":"124","key":"sqale_debt_ratio","type":"PERCENT","name":"Technical Debt Ratio"},{"id":"125","key":"new_sqale_debt_ratio","type":"PERCENT","name":"Technical Debt Ratio on New Code"},{"id":"48","key":"uncovered_conditions","type":"INT","name":"Uncovered Conditions"},{"id":"66","key":"new_it_uncovered_conditions","type":"INT","name":"Uncovered Conditions by IT on New Code"},{"id":"49","key":"new_uncovered_conditions","type":"INT","name":"Uncovered Conditions on New Code"},{"id":"41","key":"uncovered_lines","type":"INT","name":"Uncovered Lines"},{"id":"59","key":"new_it_uncovered_lines","type":"INT","name":"Uncovered Lines by IT on New Code"},{"id":"42","key":"new_uncovered_lines","type":"INT","name":"Uncovered Lines on New Code"},{"id":"36","key":"test_data","type":"DATA","name":"Unit Test Details"},{"id":"31","key":"test_execution_time","type":"MILLISEC","name":"Unit Test Duration"},{"id":"32","key":"test_errors","type":"INT","name":"Unit Test Errors"},{"id":"34","key":"test_failures","type":"INT","name":"Unit Test Failures"},{"id":"35","key":"test_success_density","type":"PERCENT","name":"Unit Test Success (%)"},{"id":"30","key":"tests","type":"INT","name":"Unit Tests"},{"id":"117","key":"vulnerabilities","type":"INT","name":"Vulnerabilities"},{"id":"109","key":"wont_fix_issues","type":"INT","name":"Won't Fix Issues"}],"total":144,"p":1,"ps":500}" 2019-08-22T06:01:18.5238142Z ##[debug]Build.BuildNumber=20190822.4.0 2019-08-22T06:01:18.5238369Z ##[debug]Agent.TempDirectory=D:\agent_work_temp 2019-08-22T06:01:18.5243902Z ##[debug]defaultRoot: 'D:\agent_work_temp' 2019-08-22T06:01:18.5245170Z ##[debug]findOptions.allowBrokenSymbolicLinks: 'false' 2019-08-22T06:01:18.5245311Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true' 2019-08-22T06:01:18.5245567Z ##[debug]findOptions.followSymbolicLinks: 'true' 2019-08-22T06:01:18.5247145Z ##[debug]matchOptions.debug: 'false' 2019-08-22T06:01:18.5247331Z ##[debug]matchOptions.nobrace: 'true' 2019-08-22T06:01:18.5247450Z ##[debug]matchOptions.noglobstar: 'false' 2019-08-22T06:01:18.5247604Z ##[debug]matchOptions.dot: 'true' 2019-08-22T06:01:18.5247720Z ##[debug]matchOptions.noext: 'false' 2019-08-22T06:01:18.5247918Z ##[debug]matchOptions.nocase: 'true' 2019-08-22T06:01:18.5248143Z ##[debug]matchOptions.nonull: 'false' 2019-08-22T06:01:18.5248355Z ##[debug]matchOptions.matchBase: 'false' 2019-08-22T06:01:18.5248807Z ##[debug]matchOptions.nocomment: 'false' 2019-08-22T06:01:18.5248942Z ##[debug]matchOptions.nonegate: 'false' 2019-08-22T06:01:18.5249141Z ##[debug]matchOptions.flipNegate: 'false' 2019-08-22T06:01:18.5251190Z ##[debug]pattern: 'sonar\20190822.4.0*\report-task.txt' 2019-08-22T06:01:18.5289217Z ##[debug]findPath: 'D:\agent_work_temp\sonar\20190822.4.0' 2019-08-22T06:01:18.5289438Z ##[debug]statOnly: 'false' 2019-08-22T06:01:18.5292412Z ##[debug]findPath: 'D:\agent_work_temp\sonar\20190822.4.0' 2019-08-22T06:01:18.5293349Z ##[debug]findOptions.allowBrokenSymbolicLinks: 'false' 2019-08-22T06:01:18.5293936Z ##[debug]findOptions.followSpecifiedSymbolicLink: 'true' 2019-08-22T06:01:18.5294070Z ##[debug]findOptions.followSymbolicLinks: 'true' 2019-08-22T06:01:18.5295774Z ##[debug]0 results 2019-08-22T06:01:18.5296011Z ##[debug]found 0 paths 2019-08-22T06:01:18.5296184Z ##[debug]applying include pattern 2019-08-22T06:01:18.5296431Z ##[debug]adjustedPattern: 'D:\agent_work_temp\sonar\20190822.4.0\\report-task.txt' 2019-08-22T06:01:18.5300245Z ##[debug]0 matches 2019-08-22T06:01:18.5300466Z ##[debug]0 final results 2019-08-22T06:01:18.5300880Z ##[debug][SQ] Searching for sonar\20190822.4.0**\report-task.txt - found 0 file(s) 2019-08-22T06:01:18.5315821Z Number of analyses in this build: 0 2019-08-22T06:01:18.5316126Z Summary of statusses: 2019-08-22T06:01:18.5384765Z ##[section]Finishing: Break build on quality gate failure

simondel commented 5 years ago

Hi @emi662002 There probably is something wrong with your SonarQube setup. If you run your build in debug mode, you'll find that the Publish Quality Gate task also finds 0 analyses. So you probably don't see any SonarQube summary in your build summary.

emi662002 commented 5 years ago

Hi @emi662002 There probably is something wrong with your SonarQube setup. If you run your build in debug mode, you'll find that the Publish Quality Gate task also finds 0 analyses. So you probably don't see any SonarQube summary in your build summary.

Do you mean on the Prepare, analyze and publish steps?

simondel commented 5 years ago

The 'Publish Quality Gate Result' task that you can also see here: https://dev.azure.com/simondel/Public/_build/results?buildId=237

emi662002 commented 5 years ago

The 'Publish Quality Gate Result' task that you can also see here: https://dev.azure.com/simondel/Public/_build/results?buildId=237

seems related to this, we'll just have to wait https://community.sonarsource.com/t/sonarqubebuildsummary-md-file-empty-with-the-publish-quality-gate-result-step-in-azure-devops/13305/2

simondel commented 5 years ago

Nice find @emi662002

I'm closing this issue for now as it seems to be an issue on SonarSource's side.