Keep analyses and everything else forever (turn off dbcleaner) possible?

Hi,

is it possible to keep analyses forever? I can only set weeks and days under Administration / General Configuration / Housekeeping. For example, I wish I could turn off sonar.dbcleaner.weeksBeforeDeletingAllSnapshots
completely, or sonar.dbcleaner altogether for that matter.

In the SonarQube server code, the string of days or weeks is converted into an Integer (see sonarqube/server/sonar-db-dao/src/main/java/org/sonar/db/purge/period/Filters.java at master · SonarSource/sonarqube (github.com) for example), so my guess is we can configure that number to be Integer.MAX_VALUE which would equal to 2147483647. It would also be curious what happens when you put -1 there…

Has anyone tried this? Would be great to know.

SonarQube server details:

  • SonarQube 9.9.6 LTA (build 92038)
  • Deployed using Docker

Thanks!

Hi,

Welcome to the community!

Would you mind sharing why you want to do this?

 
Thx,
Ann

Thank you, Ann!

We are a medical device company and need to be able to keep documentation around for 10 years, this includes code and everything around it including the history of the respective SonarQube project.

While we don’t need to keep every single change, SonarQube doesn’t offer that kind of granularity (and doesn’t need to in my opinion), so turning off these housekeeping features completely seems to be the best compromise I believe.

1 Like

Hi,

Thanks for sharing. (And thanks for your diligence with the code in our medical devices!!!)

You may be interested in the “regulatory” report that’s available starting in Enterprise Edition($$) if you’re not already using it.

And in the meantime, yes, cranking those housekeeping settings up is probably your best bet. Either that, or putting an event on every analysis, although at some point even snapshots with events are cleaned out.

The events you can control are version change (sonar.projectVersion) and custom events, which are typically added through the UI, although that could be scripted. This guide may be helpful for that.

And BTW,

Turning off housekeeping will keep every change. At least for a while. (Maybe storing regular DB backups is the answer here?)

But it’s on you if your DB bloats. :smiley:

 
HTH,
Ann

Thank you for your explanation. It does help :slight_smile:

I think that’s all I need to discuss how to proceed internally.

Best regards,
Timo

1 Like