This topic outlines how to create a smart archiving policy. You create the smart archiving policy to archive unintended packages from Active Artifactory Instance to Archive Artifactory Instance.
Authorization
Activity | Platform Admin | Project Admin | Application User |
---|---|---|---|
Note:Only from allocated projects |
To create Archive Retention policies, 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 Archive Policy.
Configure the following in the Create New Archive Policy page:
Field
Description
Media
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
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.
Package Types
Select one or more of the package types you want to archive.
Note
If a policy includes a repository with retention settings, packages designated for retention may be inadvertently removed.
Include Repositories
Enter one or more patterns for the repository names where you want the archive policy to apply, then click Add. Alternatively, you can select Include All Repositories or specify explicit repository names. At least one pattern or explicit name is required, as only packages in repositories matching these will be archived.
Auto-complete will suggest options based on the project and package type, and both local and federated repositories are supported.
Note
It is not possible to specify a path within a repository.
Note
Set Patterns: Use wildcards (for example, **) to define Ant-like patterns to include repositories. To learn more, refer to How to use Include/Exclude patterns?
Exclude Repositories
Enter patterns or explicit repository names to exclude from the archive policy. Auto-complete will suggest options based on the project and package type.
Note
Set Patterns: Use wildcards (for example, **) to define Ant-like patterns to exclude repositories. To learn more, refer to How to use Include/Exclude patterns?
Include Package Name Pattern
Enter a pattern for a package name or an explicit package name for the archive policy, then click Add or select Include All Packages. Only one pattern or explicit name is allowed.
Note
Set Patterns: Use wildcards (for example, **) to define Ant-like patterns to include packages. To learn more, refer to How to use Include/Exclude patterns?
Exclude Package Name
Enter explicit package names to exclude from the policy and click Add. Only explicit names are accepted and not patterns.
Policy Conditions
Time-based/Version-based
Do one of the following to define under what conditions the policy finds packages:
Note
A policy must include one of the two conditions below:
Time-Based
Packages Older Than
Packages Not Downloaded Since
Version-Based: Number of Latest Versions to Keep.
We recommend using the Packages Not Downloaded Since condition to prevent the archive of packages that are currently in use.
Time-based
Select Packages Older Than checkbox, and apply the number of days/weeks/months/years for the older packages.
Note
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.
When enabled, this setting archives packages based on their creation date. For example, you can archive packages created more than a year ago. By default, it is set to archive packages created more than 2 years ago.
Select Packages Not Downloaded Since checkbox, and apply the number of days/weeks/months/years for the not downloaded packages.
Note
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.
When enabled, this setting archives packages based on their last download date. For example, it can archive packages that have not been downloaded in the past year. By default, it is set to archive packages that have not been downloaded for more than 2 years.
Note
If a package was never downloaded, the policy will archive it based only on the age condition (Packages Older Than).
Version-based - Number of Latest Versions To Keep
Select the number of the latest versions to keep. The archive policy will archive all versions that exceed this number, with the latest version always excluded from archiving.
Note
This setting appears only if Version-based is selected.
Versions are determined by creation date.
Not all package types support this condition. For information on which package types support this condition, refer to Smart Archiving Supported Packages.
Additional Settings
Cron Expression
Use a cron expression to set a schedule for policy execution. If left empty, the policy can only be Run Smart Archiving Policy Manually manually.
For example, 0 0 2 * * ? executes the policy every day at 02:00 AM. We recommend tuning it to run on off-hours.
Note
The minimum interval between policy runs is 6 hours. Scheduling a policy to run at intervals shorter than this will result in an error when saving the policy.
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 archives all or part of your packages depending on the size and number of items. If there are any pending packages to be archived, they are archived incrementally in the next scheduled run and the subsequent runs.
Skip Trash Can
When enabled, this setting will cause packages to be permanently deleted from Artifactory instance without an option to restore them immediately after the archive policy is executed, bypassing the Trash Can repository. To restore, refer to Restore Archived Packages.
Note
If you want deleted items to be transferred to the trash can, you must enable the global Trash Can setting. To learn more, refer to Trash Can Settings.
The packages are copied from Active Artifactory Instance to Archive Artifactory Instance, and then deleted in the Active Artifactory Instance.
Click Save to save the policy.
The newly created smart archiving policy appears in the Policies list and executes on the scheduled date and time.
Perform Dry Run on Smart Archiving Policy: This feature allows you to see which items would be archived without actually archiving them. We recommend performing a dry run and reviewing the results before enabling a policy.
Enable/Disable Smart Archiving Policy: The policy must be enabled to run automatically according to the schedule or Run Smart Archiving Policy Manually manually.