This topic outlines how to create a cleanup policy. You create a cleanup policy to delete unintended Release Bundle V2 in Artifactory.
To create a Release Bundle V2 Cleanup Retention policy, follow these steps:
As per the User persona, you can work with the contexts as described below:
In the Retention Policies page, from the Create Policy drop-down 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:
Field
Description
Policy Name
Enter a unique and meaningful name for the policy.
Description
Enter information regarding why this policy was created, and details that help users understand its configuration.
Policy Scope
Define which Release Bundle versions should be deleted
Include Projects / Include All Projects
Note
This setting is applicable only at the global level for Platform Admins. It does not appear when creating a policy at the project level. When this setting is visible, it is mandatory.
Select the projects where you want the policy to apply, or choose Include All Projects to run the policy across all projects on the platform. You can also select Unassigned Repositories to apply the policy to repositories not linked to any projects.
Include Release Bundles
Select one or more of the Release Bundles you want to delete.
Policy Conditions
Define under what conditions the cleanup policy removes Release Bundles versions
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/weeks time unit is available.
A day in this context is a 24-hour period from the moment the policy is executed. Other units are considered as follows:
1 week = 7 days
1 month = 30 days
1 year = 365 days
The system will convert them to appropriate time unit if the matching value is entered. For example, if you enter 7 days, the system changes it to 1 Week.
Not Promoted To Environments
Select one or more of the environments the release bundles are not promoted to.
Note
Select Exclude Release Bundles that have been promoted to any environment to exclude them from deletion.
Additional Settings
Cron Expression
A cron expression is a string comprised of five or six fields separated by spaces. Each field represents a different unit of time, which collectively define the schedule for policy execution. The standard format is as follows:
* * * * * * (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
This cron expression must follow the Quartz scheduler format as used in the CronTrigger class. It differs from the standard Unix cron format. For example, Quartz supports a sixth optional field for seconds and uses ? for non-specific values. Refer to the Quartz documentation for more details: Quartz Cron Expression Format
Example Cron Expression
To illustrate how to construct a cron expression, consider the example below:
Expression:
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. If you attempt to set a cron expression that results in a runtime shorter than this duration, you will encounter an error when saving the configuration.
Off-Hours Scheduling: It is recommended to tune your cron expression so that policies run during off-hours. This helps to reduce the impact on system performance during peak usage times.
Leaving the Cron Expression Empty: If you leave the cron expression empty, you can only Run Smart Archiving Policy Manually manually. This means that there will be no automatic scheduling and the policy will not run unless you initiate it.
Max Run Duration
This setting limits the maximum duration the policy can run when enabled. The maximum allowed duration is 5 hours.
Note
The policy stops before the completion of the run if it exceeds the applied run duration. In one run, within this duration, it deletes all or part of your release bundles V2 depending on the size and number of items. If there are any pending release bundles v2 to be deleted, they are deleted incrementally in the next scheduled run and the subsequent 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: This feature allows you to see which items would be deleted without actually deleting them. We recommend performing a dry run and reviewing the results before enabling a policy.
Enable/Disable Cleanup Policy: The policy must be enabled to run automatically according to the schedule or Run Cleanup Policy Manually manually.