KBEC-00287 - Perform Job Cleanup with EC-Admin

Article ID:360032828412
2 minute readKnowledge base
On this page

Problem

The number of jobs in my CloudBees CD (CloudBees Flow) server is becoming unmanageable, how do I delete older jobs to keep my database size under control?

Solution

The EC-Admin plugin was developed by one of our Professional Services Engineers. It has many useful procedures, including some for job cleanup.

jobCleanup

This procedure will delete old jobs, and the associated workspace for those jobs.

You will be prompted for the following Parameters (those in italics are required):

Delete jobs older than: a dropdown select list to choose the number of days after which the jobs will be deleted — in other words select "1 month" and everything older than one month will be deleted

Type of jobs to delete: define what jobs you want to delete: Aborted, Error, All

Job property: Name of a property attached to your jobs. If this property is set, your job won’t be deleted. As an example, if you wish to save all jobs that were used for a Release delivered to production, you would set this property on all of the jobs for the Release that you wish to save.

Pattern Matching: a SQL pattern matching to automatically preserve some jobs. The pattern must solve for a LIKE statement

Delete: drop down field (Report or Delete) allows you to just run a report with no jobs deleted, or delete the jobs

Compute Disk Usage: checkbox to allow you to skip the computation of space used for the job to speed up execution

jobCleanup_byResult

This procedure will delete old jobs, and the associated workspace for those jobs.

You will be prompted for the following Parameters (those in italics are required):

Delete jobs older than: a dropdown select list to choose the number of days after which the jobs will be deleted — in other words select "1 month" and everything older than one month will be deleted

Success Jobs: the number of successful jobs to save per procedure. So if no jobs have been run in the past month, but 1 month is selected, then entering the number 5 will save 5 successful jobs regardless of how old they are

Warning Jobs: same as above with Success jobs, but for jobs with a Warning status

Failed Jobs: same as above with Success jobs, but for jobs with a Failed status

Job property: Name of a property attached to your jobs. If this property is set, your job won’t be deleted. As an example, if you wish to save all jobs that were used for a Release delivered to production, you would set this property on all of the jobs for the Release that you wish to save.

Delete: drop down field (Report or Delete) allows you to just run a report with no jobs deleted, or delete the jobs

Compute Disk Usage: checkbox to allow you to skip the computation of space used for the job to speed up execution

Skip plugins: allows you to skip the scan of plugin projects

In addition, there is a procedure deleteWorksapceOrphans. This procedure will crawl a workspace directory to find orphan jobs (directories without a matching job) on a specified resource. This is a good way to reclaim space on your workspace for jobs that have been deleted.