列出Jenkins中所有永久保存的版本? [英] List all keep-forever builds in Jenkins?
问题描述
Jenkins中是否有一种简单的方法可以列出所有标记为永久保存的所有版本?然后,理想情况下,只需单击一下即可将构建标记为永久保留或立即将其删除?
Is there an easy way in Jenkins to list all all builds marked as keep-forever? And then, ideally, one click to either unmark the build as keep-forever or to immediately delete it?
在我们的流程中,如果涉及某种特定类型的故障,我们会将构建标记为永久保存;这是为了防止Jenkins随着时间的流逝而自动删除.我需要一种简单的方法来获取所有这些永久构建的列表,这样它们就不会随着时间的推移占用我们所有的磁盘空间.
In our process, we mark a build as keep-forever if it involves some specific type of failure; that's to keep Jenkins from automatically deleting over time. I need an easy way to get a list of all those keep-forever builds so they don't take up all our disk space over time.
推荐答案
针对Jenkins的以下XPath查询将列出所有标记为永久保留"的版本的URL:
The following XPath query against Jenkins will list the URLs of all builds marked 'Keep Forever':
http://[jenkins_server]/api/xml?depth=2&xpath=/hudson/job/build[keepLog="true"]/url&wrapper=forever
在浏览器中输入它,然后查看返回的结果.
Enter it in the browser and see what it returns.
现在,您可以将其嵌入基于XSLT的HTML中,以获取包含这些内部版本链接的列表.要删除该版本,您可以提供一个调用Jenkins CLI的按钮:
Now, you can embed it into XSLT-based HTML to get a list with links to those builds. To delete the build you can provide a button that invokes Jenkins CLI:
java -jar jenkins-cli.jar -s http://[jenkins_server]/ delete-builds [job-name] [build-num]
不幸的是,我不知道如何在不删除CLI的情况下禁用永久保留构建".
Unfortunately, I do not know how to disable 'keep build forever' with CLI without deleting it.
这篇关于列出Jenkins中所有永久保存的版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!