Over the lifetime of a component hundreds maybe thousands of versions are created and filled with files. These versions are used in deployments (or sometimes not) and after a certain period of time they are just filling up disk space in your CodeStation as they are not needed anymore.
Artifact Cleanup Settings
Managing when to clean up these versions IBM UrbanCode Deploy (now IBM DevOps Deploy) provides artifact cleanup settings. This settings are used to decide when a version needs to be archived.
Let’s first have a look at the system settings.
This settings can be found in Settings > System Settings > Artifact Cleanup.
Here the configuration of the various settings is done. A value of -1 means that the versions are kept indefinitely, other values mean the given days or number of versions.
In this example:
- Daily Cleanup Start Time: when to start the cleanup process. Please be aware that the time provided is the time at your IBM UrbanCode Deploy Server.
- Default Application Snapshot Retention (days): Number of days application snapshots are kept, they can be overridden by component and environment settings.
- Default Version Retention for Component (days): Number of days component versions are kept.
- Default Number of Versions to Retain for Component: Only the latest versions up to this number for each Component is kept.
- Default Version Retention for Environment (days): Number of days environment versions are kept, they can be overridden by environment settings.
- Default Number of Versions to Retain for Environment: Number of versions to retain.
- Archive Path: Provide the file location (path) where the archive (compressed file) of a component version is written.
- With the Preview Version Cleanup button you can get a preview which versions for the selected component will be archived with the actual settings.
A word of Caution:
If you want to just remove versions from your system without archiving, leave the Archive Path empty. This means that the component versions will be deleted, and no archives created.
So please take care if you want to keep the archived versions!
Please look at Artifact cleanup settings for more details on the system settings.
Component Cleanup Configuration
The system settings can be overwritten in Component > Basic Settings of each component.
The default setting is Inherit Cleanup Settings and by removing the checkbox two properties are provided:
- Days to keep Versions: Number of days to keep the versions of the component
- Number of Versions to keep: Number of Versions to keep of the component
Environment Cleanup Configuration
Here the environment related settings can be overwritten by unchecking the Use Default Artifact Cleanup Settings
The following settings can be set:
- Days to Retain Application Snapshots: Overwrite the Application Snapshot retention setting
- Days to Retain Versions: Number of Days to keep a Version
- Number of Versions to Retain Number of Component Versions to keep
As these settings can be overwritten on environment and component level, with IBM UrbanCode Deploy Version 7.3.0 a new Cleanup Configuration page was provided to control and override individual settings if needed (except the Archive Path and Start Time).
In this example we see the component view filtered.
Note: This feature allows you to edit cleanup settings of multiple components and environments at once.
In this example I have selected several components and want to change their settings. Either I can select Inherit Cleanup Settings to reset to System settings, or provide new values.
For more details, please look at Configuring cleanup settings.
Cleaning up and Restoring Component Versions
How IBM UrbanCode Deploy decides now which artifact version will be archived or not?
Based on the settings configured on the different levels, IBM UrbanCode Deploy decides with the following decision flow when a component version is to be archived.
First it retrieves the settings from System Settings, then from each individual component, which overrode them and finally it checks the environment to which the component has been deployed.
Based on the values a decision is made to archive or to keep. More details how the decision flow works with examples can be found in IBM UrbanCode Deploy component version cleanup documentation.
Archiving and Restoring
When a component version is selected for archiving it will be zipped and put into a file at the location defined in the system settings. Then the data is removed from IBM UrbanCode Deploy datastorage. It is not possible to archive it again, as the data is removed.
Note: The archive contains only the files which are used in the component version, all meta data, like Version name, properties and more are still in the IBM UrbanCode Deploy Server database (which you also should backup regularly).
View Component Versions
In the versions tab of the component the the archived versions are indicated with (archived):