Pull Request Analysis not deleted

Hi there,

we are working with Pull Requests and everything works fine, instead of one thing: the Pull Request Analysis are not deleted as expected after (configured) 21 days.

We have two long-lived branches: master and develop
Our Pull Requests are linked to the develop branch.

The SonarQube documentation says: PR analyses on SonarQube are deleted automatically after 30 days with no analysis.
As mentioned, we changed the configuration to 21 days, but as shown in the screenshot the old pull requests analysis are still there.

Our understanding is, that the pull request analysis where deleted when a new analysis on the parent branch was executed. The last analysis on the parent branch “develop” was today.

Are we understanding something wrong?

Our environment:

  • SonarQube 7.3 Developer Edition
  • SonarC# 7.5
  • Buildsystem: TFS 2018.3
  • Database: PostgreSQL 9.5.14

Hi,

Sorry for the delay in responding to this.

To be clear, short-lived branches and PRs aren’t deleted on a timer; housekeeping is triggered by analysis. Nonetheless, your screenshot shows that your develop branch was analyzed ‘yesterday’ so that should have triggered housekeeping in general.

This is working on our dogfood server. We’ve set our housekeeping period to 7 days, and the oldest PR I see on the project I’m looking at right now is 7 days old. I’m assuming it rounded up to 7 days and if I look tomorrow that PR will be gone.

So… do you see any errors in your $SONARQUBE_HOME/logs/ce.log? In your project’s background tasks page?

And just to verify, I wonder if you could trigger analysis of the master branch and see if that does/doesn’t trigger the cleanup of those stale PRs…?

 
Thx,
Ann

Hi Ann,

thanks for your reply.
I’ve checked some things:

  • background task page: no Status != “Success” found. In the “scanner context” from the last analysis on develop I see : sonar.dbcleaner.daysBeforeDeletingInactiveShortLivingBranches=21
  • the ce.log shows no error

So I tried to run an analysis on master (which is marked as “Main Branch” in Sonar) and the PRs and short-lived branches were deleted.

Is this the correct behaviour?
Shouldn’t an analysis on every “long-lived” branch trigger the houskeeping for his “child”-branches?

With regards,
Stephan

Hi Stephan,

Well, what I’m told is that analysis on any branch should trigger housekeeping. I’m planning to follow up on this but it may take a few days.

 
Ann

Hi Ann,

that’s okay.
I’m looking forward to your answer.

Greetings from Germany
Stephan

EDIT Oops. Wrong thread.

–Ann

Hi Stephan,

We’ve created a ticket for this. No verdict yet on whether we’ll tackle it for the LTS, but if you ‘Watch’ it you’ll get updates.

SONAR-11407 - Permission index recovery fails if there is too many projects to recover

 
Ann

Hi Stephan (CC @ganncamp) ,

Indeed, we have a bug: only the stale branches of the main branch get cleaned up, and only when the main branch is analyzed.

You can track progress on the fix here: https://jira.sonarsource.com/browse/SONAR-11439

Cheers,
Janos

1 Like

Hi Janos,

thx for the info.

Greetings
Stephan