Sonarcloud Publish Task failed in Azure DevOps with Operation cancelled

Template for a good new topic, formatted with Markdown:

  • ALM used : Azure DevOps
  • CI system used : Azure DevOps
  • Scanner command used when applicable (private details masked) : steps:
  • task: SonarCloudPublish@1
    inputs:
    pollingTimeoutSec: ‘300’
  • Languages of the repository : Java

Issue Description : Sonar Cloud Publish step is running indefinitely then fails with agent runtime error.

There is no change made to Sonar Prepare step / Publish step neither on any pipeline’s configurations.

Failure/Error message : ##[error]The job running on agent Hosted Agent ran longer than the maximum time of 60 minutes.

##[error]The operation was cancelled.

Sonar publish task was working fine till September 21st , It used to take 10 minutes to execute and publish sonar results to sonar cloud and on 21st suddenly our pipelines started failing as the sonar publish step alone is taking more than 60 minutes. This results our agent to throw error with "The job running on agent Hosted Agent ran longer than the maximum time of 60 minutes. "

Hello @prakashmenon19 !

Could you please provide more detailed logs about the issue? Also, I’m not sure I have clear the name of at least one of the projects so I can try to dig further.

Thanks in advance!

Hi, Thanks for checking this issue. I am not able to send the complete debug logs here . It just shows as loading and nothing happens. Can you please drop me mail at prakash.menon@wipro.com so I can send the logs via email.

Can you please update on this issue. All our pipelines are failing due to Sonar issue so we have disabled it for now.

Hello Prakash,

I’ll send you a private message so you can provide the logs safely.

Sure . Thanks. If you can drop me an email I can zip the logs and provide in email itself.

Hello again @prakashmenon19 !

I sent you a private through this platform as it’s the preferred method to share information. Could you please check your messages to see the one I sent you?

Hello Aura,

Can you please let me know where I can find “I sent you a private through this platform”. I don’t see it.

Hi,

Check your notifications at the top-right:

Selection_1385

 
HTH,
Ann

Thanks for providing the logs @prakashmenon19 ! I’ll take a look and come back to you soon.

Sure. Thanks Aura. Please check this issue on priority as we have disabled the sonar analysis on all pipelines which is impacting the code quality .

Hi Aura,

Please update on the issue.

Can you please update on this issue.

Hello @prakashmenon19

Apologies for the delay in my response as I’ve been out for some time. I’ll take a look at this with priority today and hopefully provide an answer to your issue soon. :pray:

Hello @prakashmenon19

From the information you’ve sent me, it seems that the issue is related to the decoration of the PR, meaning, what’s timing out is the Publish Quality Gate Result, is that accurate? Could you please confirm that if you log into SonarCloud you can see the results of a given PR?

I can see from one of the logs that

...
2023-09-20T18:41:17.5184370Z [INFO] ANALYSIS SUCCESSFUL, you can find the results at: https://sonarcloud.io/dashboard?id=GeminiDevops_Gemini-App&pullRequest=3126
2023-09-20T18:41:17.5185168Z [INFO] Note that you will be able to access the updated dashboard once the server has processed the submitted analysis report
2023-09-20T18:41:17.5609684Z [INFO] Analysis total time: 1:23.340 s
2023-09-20T18:41:17.5626239Z [INFO] ------------------------------------------------------------------------
2023-09-20T18:41:17.5627865Z [INFO] BUILD SUCCESS
2023-09-20T18:41:17.5630119Z [INFO] ------------------------------------------------------------------------
2023-09-20T18:41:17.5645556Z [INFO] Total time:  02:18 min
2023-09-20T18:41:17.5649243Z [INFO] Finished at: 2023-09-20T18:41:17Z
2023-09-20T18:41:17.5651341Z [INFO] ------------------------------------------------------------------------
...

And later,

2023-09-20T18:41:17.9352768Z ==============================================================================
2023-09-20T18:41:17.9352962Z Task         : Publish Quality Gate Result
2023-09-20T18:41:17.9353087Z Description  : Publish SonarCloud's Quality Gate result on the Azure Pipelines build result. To be used after the actual analysis.
2023-09-20T18:41:17.9353301Z Version      : 1.13.0
2023-09-20T18:41:17.9353402Z Author       : sonarsource
2023-09-20T18:41:17.9353519Z Help         : Version: 1.13.0. [More Information](https://docs.sonarcloud.io/advanced-setup/ci-based-analysis/sonarcloud-extension-for-azure-devops/)
2023-09-20T18:41:17.9353753Z ==============================================================================
2023-09-20T19:36:03.7794655Z ##[error]The operation was canceled.
2023-09-20T19:36:03.7798394Z ##[section]Finishing: SonarCloudPublish

Confirming that the issue is related only to publishing the QG will help me to narrow the issue.

Hi Aura,

No , We are not able to see the results in sonar cloud. If we create new branch and run analysis the new branch results are not getting populated in sonar cloud. The logs shows as it is publishing results but when we check in cloud we not able to see the branch name .

Alright, thanks @prakashmenon19 . Is it possible if you could activate the SonarCloud scan, run it again and provide me the logs only shown in the “1_Job.txt” (the rest is not needed)?

If it times out again, perhaps review the next day if you can see the analysis results in SonarCloud just to confirm or not if they are shown there.

Hi Aura,

We have run the sonar analysis again in branch feature/sonar and can see its same issue. the issue is at Sonarcloudpublish as mentioned above. The task runs for 1 hour and then pipeline fails.

Please find all the logs attached.
Uploading: Agent_20231114-055435-utc.log…
Uploading: capabilities.txt…
Uploading: environment.txt…
Uploading: waagentConf.txt…
Uploading: Worker_20231114-055440-utc.log…
Uploading: 1_.txt…
Uploading: 1_Initialize job.txt…
Uploading: 1_Job.txt…
Uploading: 2_Checkout Gemini-App@featuresonar to s.txt…
Uploading: 3_SonarCloudPrepare.txt…
Processing: 4_Common Build.txt…
9_Post-job Checkout Gemini-App@featuresonar to s.txt (1.5 KB)
10_Finalize Job.txt (246 Bytes)
2147483647_Report build status.txt (37 Bytes)
initializeLog.txt (2.8 KB)

Uploading: 5_Contract management Build.txt…
Uploading: 6_SonarCloudPublish.txt…
Uploading: 7_CopyFiles.txt…
Uploading: 8_PublishBuildArtifacts.txt…

Hi Aura , can you please update on this issue. Pending from long and we are not able to run sonar analysis on our code. Can we please have quick meeting so we can screen share and show what is happening might be useful for the investigation.

Hi,

You were sent a private message about a week ago looking for logs. We can’t proceed until we get them.

 
Ann