Phinehas Lin
Phinehas Lin

Reputation: 21

Pending task in SonarQube & Stability config for Sonar

Our sonarqube server had 10+ pending tasks. I canceled one and now we can make tasks in the process.

How can I know they are pending now, and how to confirm when to cancel them? Because we want to manage sonar's tasks by Web API, not manually.

I find a taskId that I can use it to check the status of it. But how can I know the taskId without monitoring the console output of MAVEN BUILD?
taskId:/api/ce/task?id=AVo_WHJYU5rNTJ7ZmiZq

I tried to use this api/ce/component to get the status, but sometimes when I use projectKey as a component parameter, I got "queue": []. I can't get JSON "current": {}. Why it's empty because the projectKey is the correct one?

Another problem is how to configure the sonar.properties or etc? To make our sonar server, more stable (we only use one server, not cluster). Because I want to know why these tasks are pending.

My problems are:

  1. I want to know how to check the status of a project task (taskId), then I can choose when and which one I need to cancel.

  2. I want to know how to config my sonar better for best stability, just like JVM setting? My server's memory is 4 GB.

Upvotes: 2

Views: 270

Answers (1)

Pruthvi
Pruthvi

Reputation: 385

curl --location 'https://<SonarToken>@<Sonar-end-point>/api/ce/component?component=<Component-key>' --header 'Content-Type: application/json'

This will fetch you the latest task id of background tasks

Take id from above response and pass it to task end point

curl --location 'https://<sonar-auth-token>@<Sonar-end-point>/api/ce/task?id=<Taskid>' --header 'Content-Type: application/json'

Sonar Version : 9.9

Upvotes: 0

Related Questions