When recieving Zabbix alerts for low storage on the legacy Jenkins, we can prune old builds from some of the largest storage users on the cluster using this SOP.
https://ci.centos.org/user/username/configure
JENKINSUSER=username JENKINSAPITOKEN=token
jenkins.ci.centos.org
du -csh /var/lib/jenkins/* | grep 'G' | sort -r
CRUMB=$(curl 'https://$JENKINSUSER:$JENKINSAPITOKEN@ci.centos.org/crumbIssuer/api/xml?xpath=concat(//crumbRequestField,":",//crumb)')
jobname
and start range/ end range
values which correspond with the build numbers in the jobname:curl -H "$CRUMB" -X POST "https://$JENKINSUSER:$JENKINSAPITOKEN@ci.centos.org/job/<jobname>/[<start>-<end>]/doDelete"