简体   繁体   English

使用脚本删除旧的SonarQube项目

[英]Delete old SonarQube projects with script

I have a lot of unused and old sonarqube projects which I need to delete. 我有很多未使用和旧的声纳项目,需要删除。 With the Sonarqube API (Bulk-delete) I can only delete the projects by ID but I need to delete all projects which are older than 3 months. 使用Sonarqube API(批量删除),我只能按ID删除项目,但需要删除所有三个月以上的项目。 Is there a way to delete all projects older than 3 months maybe with a script? 是否可以使用脚本删除所有三个月以上的项目? I can't delete them by hand because there are too many projects. 我无法手动删除它们,因为项目太多。 I tried to google my problem but the only script I've found was a python script and I have no idea how to use it. 我试图用谷歌搜索我的问题,但是我发现的唯一脚本是python脚本,我不知道如何使用它。

Thanks! 谢谢!

SonarQube Web API lets you get the last analysis date of projects. SonarQube Web API使您可以获取项目的最后分析日期。 All you need to do then is to combine that with your script to delete projects. 然后,您要做的就是将其与脚本结合起来以删除项目。

Refer to this question for details on which Web API to use for querying the last analysis date . 有关使用哪个Web API查询上次分析日期的详细信息,请参考此问题

Note that there's also a UI feature (covering your use-case) coming up in SonarQube 6.x series: SONAR-4566 - Bulk deletion: add a criterion "Last analysis more than X days old" 请注意,SonarQube 6.x系列中还提供了一个UI功能(包含用例): SONAR- 4566- 批量删除:添加条件“过去X天以上的最后分析”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM