List of all held forever in Jenkins?

Is there an easy way in Jenkins to list all all assemblies marked as keep-forever? And then, ideally, with one click of the mouse, either cancel the assembly, or save it, or delete it right away?

In our process, we mark the assembly as a keep-forever if it is associated with a particular type of failure; so that Jenkins automatically retires over time. I need an easy way to get a list of all these collections forever so that they do not take up all the disk space over time.

+5
jenkins jenkins-plugins
source share
2 answers

The following XPath query from Jenkins will list the URLs of all assemblies 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.

Now you can embed it in XSLT-based HTML to get a list with links to these assemblies. To remove an assembly, you can provide a button that invokes the Jenkins CLI:

 java -jar jenkins-cli.jar -s http://[jenkins_server]/ delete-builds [job-name] [build-num] 

Unfortunately, I do not know how to disable 'keep build forever' with the CLI without removing it.

+8
source share

I was looking for the same thing, and our jenkins are also quite large, and they tried to find the link:

  http://[jenkins_server]/api/xml?depth=2&xpath=/hudson/job/build[keepLog="true"]/url&wrapper=forever 

I ended up crashing.

But, as it turned out, I only need the last "save forever" assembly of one work at a time, which seems to work faster. So instead, I use the following:

 http://[jenkisn_server]/job/[job_name]/api/xml/?depth=2&xpath=/freeStyleProject/build[keepLog="true"]/number&wrapper=forever 

which returns xml with all build numbers that are marked as β€œsave forever”, you can change the xpath to suit your needs.

+3
source share

All Articles