Create a Cleanup Policy
You can create cleanup policies in JFrog Artifactory to automatically delete packages, builds, and Release Bundles v2 that match the scope and criteria you set. After you save the policy, enable it to run on a schedule, or run it manually. You can also perform a dry run first to preview which items would be deleted.
Cleanup policy types:
- Package: Delete packages by age, last download, properties, or version retention across selected repositories and paths.
- Release Bundle v2: Delete Release Bundle versions by age, and optionally limit deletion by promotion stage.
- Build: Delete builds by age, with the option to keep or remove associated build artifacts.
Prerequisite: You must be a Platform Admin, or a Project Admin in an allocated project, to create a cleanup policy. Non-admin users cannot create cleanup policies. To grant this permission to a Project Admin, see Grant Permission to a Project Admin.
Create Cleanup Policy: Package
Create a Package cleanup policy to delete packages that are not required, based on the criteria you configure.
To create a Package cleanup policy:
-
From the Administrator module, select Artifactory Settings > Retention Policies.
-
In the Retention Policies page, from the Create Policy dropdown list, click Cleanup Policy.

-
In the Create New Cleanup Policy page, select Package.

-
Configure the following in the Create New Cleanup Policy page:
-
Policy Details
-
Policy Name: Enter a unique and meaningful name for the policy. The name can contain up to 255 characters, must start with a letter, and can then contain letters, numbers, underscores (
_), and hyphens (-). -
Add Description: Describe why the policy exists and how it is configured. The description can contain up to 256 characters.
-
-
Policy Scope: Define what should be deleted.
-
Include Stages / Include All Stages: Select the stages to which the policy should apply, or choose Include All Stages to run the policy across all stages on the platform.
-
Include Projects / Include All Projects:
Select the projects to which the policy should apply, or choose Include All Projects to run the policy across all projects on the platform. You can also select Include only repositories that are not assigned to a project to apply the policy to repositories not linked to any projects.
Note
This setting applies only at the global level for Platform Admins. It does not appear when you create a policy at the project level. When visible, it is mandatory.
- Package Types: Select one or more of the package types you want to delete.
Note
If a policy includes a repository with retention settings, packages designated for retention may be inadvertently deleted.
- Include Repository Patterns: Enter the repositories this policy should clean up, or select Include All Repositories. As you type, Artifactory suggests local and federated repositories that match the project and package type you selected. Enter at least one repository name or pattern.
Note
- Use wildcards at the end to match any suffix, or at the start to match any prefix. For example,
npm-local*includes all repositories starting withnpm-local. - Regex is not supported.
- If the policy includes a local repository configured for remote push replication, deletions from that repository are replicated to the remote targets.
- Exclude Repository Patterns: Enter the repositories this policy should skip. As you type, Artifactory suggests local and federated repositories that match the project and package type you selected.
Note
- Use wildcards at the end to match any suffix, or at the start to match any prefix. For example,
npm-local*excludes all repositories starting withnpm-local. - Regex is not supported.
- Include Path Patterns (optional): Enter one or more folder path prefixes to include. Use this to narrow the policy to specific paths within the selected repositories. Available from Artifactory 7.146.7 for Self-managed.
Note
- Use wildcards at the start or end of a folder path. For example,
releases/*matches paths that start withreleases/,*/productionmatches paths that end with/production, andcom/example/releasesis an exact path match. - If you add only the last folder, the policy finds no packages. The last folder is the one that holds the file. Add at least one parent folder as well. Include path patterns are available from Artifactory 7.146.7 for Self-managed.
- Double wildcards (
**) and wildcards in the middle of a path are not supported. - You can add up to 10 paths.
- Regex is not supported.
- Exclude Path Patterns (optional): Enter one or more folder path prefixes to exclude. Packages under matching paths are not deleted. Available from Artifactory 7.146.7 for Self-managed.
Note
- Use wildcards at the start or end of a folder path. For example,
snapshots/*excludes paths that start withsnapshots/,*/devexcludes paths that end with/dev, andcom/example/internalis an exact path match. - Double wildcards (
**) and wildcards in the middle of a path are not supported. - You can add up to 10 paths.
- Regex is not supported.
- Include and exclude path patterns cannot overlap.
- Include Package Name Pattern: Enter one package name or pattern, then click Add, or select the Include All Packages checkbox. You can enter only one pattern or explicit name. Package names cannot contain
/.
Note
- Use wildcards at the end to match any suffix, or at the start to match any prefix. For example,
mypackage*includes all packages starting withmypackage. - Regex is not supported.
-
Exclude Package Name: Enter explicit package names to exclude from the policy and click Add. Only explicit names are accepted and not patterns. Package names cannot contain
/, and blank, wildcard, or duplicate names are rejected. -
Include Package Version Pattern: Enter one package version or pattern, then click Add, or select the Include All Versions checkbox.
Note
- Use wildcards at the end to match any suffix, or at the start to match any prefix. For example,
1.0.*includes all versions starting with1.0. - Regex is not supported.
- You can enter only one pattern or explicit version.
Available from V 7.127 (SaaS) and V 7.125.7 (Self-managed).
- Exclude Package Version Patterns: Enter one or more version patterns or explicit versions to exclude from the policy, then click Add.
Note
- Use wildcards at the end to match any suffix, or at the start to match any prefix. For example,
*-SNAPSHOTexcludes snapshot versions, and*-RC*excludes release-candidate versions. - Regex is not supported.
- You can enter multiple patterns.
Available from V 7.127 (SaaS) and V 7.125.7 (Self-managed).
-
-
Policy Conditions: Define when the policy selects packages for deletion.
Select one or more conditions from the multi-select group. Time, property, and version criteria use logical AND. The policy targets packages that meet all selected time and property conditions and fall outside the protected version history.
- Packages older than: Deletes packages based on their creation date, regardless of whether they have been downloaded.
- Packages not downloaded since: Deletes packages based on their last download date. The default is 2 years. If a package was never downloaded, the policy uses its creation date. The package is deleted only when that date is older than the Not Downloaded Since period. If you also select Packages older than, a never-downloaded package is deleted only when its creation date is older than the Packages older than value. Use this condition to avoid deleting packages that are currently in use.
- Matches property key/value: Deletes packages based on a property key-value pair applied to the lead artifact. The property key must be a valid XML name. Enter one value per property key. Duplicate or overlapping property values are rejected. For more information, see Cleanup Supported Packages.
- Number of latest versions to keep: Excludes the N most recent versions of each package from deletion. The count is per package path, not across a parent folder. If
com/amdocscontainsappA,appB, andappC, and you keep the last 2 versions, the policy keeps the 2 newest versions of each package (6 versions in total). It does not keep only the 2 newest versions across all three packages. The latest version of each package is always excluded. When combined with time or property conditions, only packages that meet those criteria and fall outside the retained version set are deleted. - Exclude based on property: Enable the checkbox and enter the property name and value on the lead artifact. The property key must be a valid XML name. Enter one value per property key. Packages with this property are excluded from deletion. For more information, see Cleanup Supported Packages.
Note
A day in this context is a 24-hour period from the moment the policy is executed. Other units are calculated as follows:
- 1 week = 7 days
- 1 month = 30 days
- 1 year = 365 days
The system converts matching values to the appropriate time unit. For example, if you enter 7 days, the system changes it to 1 week.
Note
- Versions are determined by creation date.
- Not all package types support this condition. For more information, see Cleanup Supported Packages.
- If your cleanup policy includes Number of latest versions to keep, a change in behavior in Helm client 3.18.0 and later creates two manifest nodes per version (tag and digest). This affects OCI-compliant repositories that store Helm charts, including Helm OCI and Docker. Because Artifactory counts each manifest node as a separate version, the policy may retain digest references instead of human-readable tags.
Behavioral logic when multiple conditions are selected: All selected conditions are evaluated together using logical AND.
- If you select both Packages older than and Packages not downloaded since, the policy deletes only packages that meet both conditions. Packages that have never been downloaded are deleted only if their creation date is older than the Packages older than value.
- If you also select Number of latest versions to keep, packages among the last N versions for their package path are never deleted, even when they meet the time and property criteria. This acts as a safety rail to prevent total depletion of a package's version history.
- When Matches property key/value is selected with time-based conditions, packages must match the property and satisfy the selected time criteria to be eligible for deletion.
Example: You select Packages older than 12 months, Matches property key/value
prod=true, and Number of latest versions to keep set to 5. The policy deletes only packages that are older than 12 months, have the propertyprod=true, and are not among the five most recent versions of their package. -
Settings: Configure when the policy runs and how deletions are handled.
- Cron Expression: Enter a Quartz cron expression (five or six fields) that defines when the policy runs:
* * * * * * (Seconds - Optional) | | | | | | | | | | | +---- Day of the week (0 - 6) (Sunday=0) | | | | +------ Month (1 - 12) | | | +-------- Day of the month (1 - 31) | | +---------- Hour (0 - 23) | +------------ Minute (0 - 59) +-------------- Second (0 - 59) (Optional)Note
Use the Quartz scheduler format (CronTrigger class), not standard Unix cron. Quartz supports an optional seconds field and uses ? for non-specific values. For more information, see Quartz Cron Expression Format.
Example:
0 0 2 * * ?- 0 - At second 0
- 0 - At minute 0
- 2 - At hour 2 (2:00 AM)
*- Every day of the month*- Every month- ? - No specific value for the day of the week
This expression schedules the policy to run every day at 2:00 AM.
Guidelines for Scheduling
- Run Interval: The minimum interval between policy executions is 6 hours. A cron expression with a shorter interval returns an error when you save.
- Off-Hours Scheduling: Run policies during off-hours to reduce impact on peak usage.
Leaving the Cron Expression Empty: If you leave the cron expression empty, the policy is not scheduled and you can only Run Cleanup Policy Manually.
- Max Run Duration: Limits how long an enabled policy run can continue. The maximum allowed duration is 5 hours.
Note
If the run exceeds this duration, the policy stops. Remaining packages are deleted in later scheduled runs.
- Skip Trash Can: When enabled, packages are permanently deleted and bypass the Trash Can repository.
Note
To send deleted items to the Trash Can, enable the global Trash Can setting. If Trash Can is disabled, you must enable Skip Trash Can before you can save or run the policy. For more information, see Trash Can Settings.
-
-
Click Save to save the policy.
The newly created cleanup policy appears in the Policies list and executes on the scheduled date and time.
- Perform Dry Run Cleanup Policy: Perform a dry run to see which items would be deleted without deleting them. Review the results before enabling a policy.
- Enable or Disable Cleanup Policy: The policy must be enabled to run automatically according to the schedule or Run Cleanup Policy Manually.
Create Cleanup Policy: Release Bundle V2
Create a Release Bundle v2 cleanup policy to delete Release Bundle versions that are not required, based on the criteria you configure.
To create a Release Bundle v2 cleanup policy:
-
From the Administrator module, select Artifactory Settings > Retention Policies.
-
In the Retention Policies page, from the Create Policy dropdown list, click Cleanup Policy.

-
In the Create New Cleanup Policy page, select Release Bundle V2.

-
Configure the following in the Create New Cleanup Policy page:
-
Policy Details
-
Policy Name: Enter a unique and meaningful name for the policy. The name can contain up to 255 characters, must start with a letter, and can then contain letters, numbers, underscores (
_), and hyphens (-). -
Add Description: Describe why the policy exists and how it is configured. The description can contain up to 256 characters.
-
-
Policy Scope: Define which Release Bundle versions should be deleted.
- Include Projects / Include All Projects:
Select the projects to which the policy should apply, or select the Include All Projects checkbox. To include Release Bundles that are not assigned to a project, select Default Project.
Note
This setting applies only at the global level for Platform Admins. It does not appear when you create a policy at the project level. When visible, it is mandatory.
- Include Release Bundles: Select one or more Release Bundles, or select the Include All Release Bundles checkbox.
-
Policy Conditions: Define when the policy selects Release Bundle versions for deletion.
- Release Bundle Versions Older Than: Apply the number of days/weeks/months/years for the older Release Bundles.
Note
From version 7.119.0 onwards, days and weeks are available as time units.
A day in this context is a 24-hour period from the moment the policy is executed. Other units are calculated as follows:
- 1 week = 7 days
- 1 month = 30 days
- 1 year = 365 days
The system converts matching values to the appropriate time unit. For example, if you enter 7 days, the system changes it to 1 week.
- Not Promoted To Stages: Select one or more of the stages where the release bundles are not promoted.
Note
Select Exclude promoted Release Bundles to exclude them from deletion.
-
Settings: Configure when the policy runs and how long it can run.
-
Cron Expression: Enter a Quartz cron expression to schedule the policy, or leave it empty to run only manually. For format, examples, and scheduling guidelines (including the 6-hour minimum interval), see Cron Expression under Create Cleanup Policy: Package.
-
Max Run Duration: Limits how long an enabled policy run can continue. The maximum allowed duration is 5 hours.
Note
If the run exceeds this duration, the policy stops. Remaining Release Bundles v2 are deleted in later scheduled runs.
-
-
-
Click Save to save the policy.
The newly created cleanup policy appears in the Policies list and executes on the scheduled date and time.
- Perform Dry Run Cleanup Policy: Perform a dry run to see which items would be deleted without deleting them. Review the results before enabling a policy.
- Enable or Disable Cleanup Policy: The policy must be enabled to run automatically according to the schedule or Run Cleanup Policy Manually.
Create Cleanup Policy: Build
Create a Build cleanup policy to delete builds that are not required, based on the criteria you configure.
Removing a build deletes the build entity, build-info, and build artifacts. To keep build artifacts, clear Delete Build Artifacts under Settings (selected by default).
To create a Build cleanup policy:
-
From the Administrator module, select Artifactory Settings > Retention Policies.
-
In the Retention Policies page, from the Create Policy dropdown list, click Cleanup Policy.

-
In the Create New Cleanup Policy page, select Build.

-
Configure the following in the Create New Cleanup Policy page:
-
Policy Details
-
Policy Name: Enter a unique and meaningful name for the policy. The name can contain up to 255 characters, must start with a letter, and can then contain letters, numbers, underscores (
_), and hyphens (-). -
Add Description: Describe why the policy exists and how it is configured. The description can contain up to 256 characters.
-
-
Policy Scope: Define what should be deleted.
- Include Projects / Include All Projects:
Select the projects to which the policy should apply, or select the Include All Projects checkbox. To include builds that are not assigned to a project, select Default Project.
Note
This setting applies only at the global level for Platform Admins. It does not appear when you create a policy at the project level. When visible, it is mandatory.
- Include Build Patterns: Select one or more builds, or select the Include All Builds checkbox.
Note
Specify builds by explicit name, or use a trailing wildcard to match a suffix. For example,
buildxyz*includes all builds starting withbuildxyz.A leading wildcard is not allowed. For example,
*buildxyzis invalid. -
Policy Conditions: Define when the policy selects builds for deletion.
- Builds older than: Specify how old builds must be (days/weeks/months/years) based on creation date.
Note
A day in this context is a 24-hour period from the moment the policy is executed. Other units are calculated as follows:
- 1 week = 7 days
- 1 month = 30 days
- 1 year = 365 days
The system converts matching values to the appropriate time unit. For example, if you enter 7 days, the system changes it to 1 week.
-
Settings: Configure when the policy runs and how deletions are handled.
- Delete Build Artifacts: Deletes the artifacts associated with the build.
Note
This setting is enabled by default. Disable the checkbox to exclude build artifacts from deletion.
When determining which artifacts are deleted with your build, the following rules apply:
- Artifact Resolution from Build-Info: If the full repository path of the build artifacts exists in the build-info, the artifacts are resolved from their original location where the build was published via the CLI.
Note
This behavior is available from version 7.106.1.
- Older Builds: If the build artifacts do not have a full repository path, they are resolved using their SHA and associated properties:
build.name,build.number, andbuild.timestamp.
Note
-
If the artifacts were promoted or copied to another target, they are also deleted from those locations.
-
For certain build integration tools (for example, Jenkins) that may create an inconsistent
build.timestamp(compared to the build-infostartedfield), the deletion process checks whether the same build name and build number exist in another project. -
If found, the artifacts are not deleted.
-
If not found, the artifacts are deleted based on their SHA and properties (
build.name,build.number).
Always use a recent version of JFrog CLI as your build client. For more information, see CLI Documentation and Build Integration.
-
Cron Expression: Enter a Quartz cron expression to schedule the policy, or leave it empty to run only manually. For format, examples, and scheduling guidelines (including the 6-hour minimum interval), see Cron Expression under Create Cleanup Policy: Package.
-
Max Run Duration: Limits how long an enabled policy run can continue. The maximum allowed duration is 5 hours.
Note
If the run exceeds this duration, the policy stops. Remaining builds are deleted in later scheduled runs.
- Skip Trash Can: When enabled, builds are permanently deleted from the Artifactory instance and bypass the Trash Can repository.
Note
To send deleted items to the Trash Can, enable the global Trash Can setting. If Trash Can is disabled, you must enable Skip Trash Can before you can save or run the policy. For more information, see Trash Can Settings.
-
-
Click Save to save the policy.
The newly created cleanup policy appears in the Policies list and executes on the scheduled date and time.
- Perform Dry Run Cleanup Policy: Perform a dry run to see which items would be deleted without deleting them. Review the results before enabling a policy.
- Enable or Disable Cleanup Policy: The policy must be enabled to run automatically according to the schedule or Run Cleanup Policy Manually.
What Happens after the Cleanup Policy is Created?
After you create a cleanup policy:
- Enabled cleanup policies run on the scheduled date and time. You can also Run Cleanup Policy Manually.
Note
By default, Artifactory runs up to 3 cleanup policies at the same time and queues up to 5 additional runs. Any further runs are rejected. For information about changing these limits, see Cleanup Policies System Properties.
A cleanup policy does not run while a mandatory task is in progress (for example, Garbage Collection). If you need to Run Cleanup Policy Manually or Perform Dry Run Cleanup Policy, try again later.
- The system deletes matching items and their associated metadata.
- As the cleanup process progresses, you can View All Cleanup Runs.
FAQs
The following are frequently asked questions about creating cleanup policies in JFrog Artifactory.
FAQs
Q: What types of cleanup policies can I create?
A: You can create three types of cleanup policies: Package, Release Bundle v2, and Build. Each type deletes a different kind of item in Artifactory. For the procedure for each type, see Create Cleanup Policy: Package, Create Cleanup Policy: Release Bundle V2, and Create Cleanup Policy: Build.
Q: What permissions do I need to create a cleanup policy?
A: Platform Admins can create cleanup policies. Project Admins can also create them, but only from their allocated projects. Non-admin users cannot create cleanup policies. To grant a Project Admin this permission, see Grant Permission to a Project Admin.
Q: How do I schedule a cleanup policy to run automatically?
A: Set a cron expression on the policy. If you leave it empty, the policy is not scheduled and runs only when you start it. See Run Cleanup Policy Manually. Prefer off-hours schedules to reduce impact during peak usage.
Q: What happens after I create and enable a cleanup policy?
A: Enabled cleanup policies execute on the scheduled date and time, and can also be run manually. The system deletes the matching items along with their associated metadata. You can follow progress in View All Cleanup Runs.
Q: Can I test a cleanup policy before it deletes anything?
A: Yes. Perform a dry run to see which items the policy would delete without deleting them. See Perform Dry Run Cleanup Policy.
Q: How many cleanup policies can run at the same time?
A: By default, Artifactory runs up to 3 cleanup policies at the same time and queues up to 5 additional runs. Any further runs are rejected. You can change these limits with the Cleanup Policies System Properties. A cleanup policy also does not run while a mandatory task such as Garbage Collection is in progress. If that happens, try again later.
Related Topics
Updated 32 minutes ago
