Cleaning up component versions

You can configure the server to reduce the number of component versions by archiving them. You can specify artifacts cleanup settings from the System Settings, or cleanup settings for individual components, and environments.

About this task

The server archives a full or incremental component version if the version does not meet any of the criteria for versions to keep. When archiving versions, the server retrieves the settings from the Settings > System Settings > Artifact Cleanup options first. Then it retrieves the settings for the individual components, which override the system settings. Finally, it checks the settings on the environments to which the component has been deployed. If any of these settings specify to keep the component version, it is not archived.

These settings include a number of days for which to retain versions and a number of versions to keep. The system default component settings, and the component settings refer to the creation date of the version. For example, if the system default settings or component settings keep versions for 30 days, a version is not archived until its creation date is more than 30 days in the past. Similarly, if the system default settings or component settings keep the 10 most recent versions, a version is not archived until there are 10 more recently created versions. Component settings override system default settings for that component.

By contrast, the environment settings refer to the most recent deployment date of the version. For example, if the environment settings keep versions for 30 days, a version is not archived if it has been deployed in the last 30 days. If an environment does not have settings, the server uses the system settings instead. For example, if the server settings keep versions for 30 days and the version was created more than 30 days ago but was deployed to an environment within 30 days, the version is kept.

The server uses the following criteria to determine which versions to keep and which to archive:

First, the server checks the settings on the component. If the component has settings to keep versions, the server uses those settings. Otherwise, the server uses the defaults in the server settings.
  • If the number of days to keep versions is set to -1, the version is kept.
  • If the number of versions to keep is set to -1, the version is kept.
  • If the version was created within the number of days to keep versions, it is kept.
  • Based on the number of versions to keep, if the version is in the most recently created versions, it is kept.
Then, the server checks the settings for each environment to which the component version has been deployed. If an environment does not have settings, the server uses the system settings for that environment. In the context of environments, the settings refer not to the creation date of the component but the date of the most recent deployment of that component. For example, if the system settings keep the 20 most recent versions, and the version is one of the 20 most recently deployed versions in an environment, the version is kept. Using these settings, the server uses the following criteria:
  • If the version is currently deployed to any environment or is listed in the inventory of any resource, it is kept.
  • If the version is part of any snapshot, it is kept.
  • If the number of days to keep versions is set to -1 in any of the environments, the version is kept.
  • If the number of versions to keep is set to -1 in any of the environments, the version is kept.
  • If the version has been deployed within the number of days to keep versions, it is kept.
  • Based on the number of versions to keep, if the version is in the most recently deployed versions, it is kept.

If none of these criteria are true, the component version and the artifacts in it are archived, even if the version was deployed to an environment in the past.

The following diagram is a graphical representation of the checks performed on the server for the clean-up of component versions.

clean-up diagram

Note:
  • Beginning with version 6.1, the server stores full copies of each file in each component version, even if the files are duplicates.
  • When you perform an artifact cleanup, upcoming or scheduled processes are not taken into consideration. You must be aware that the artifact cleanup removes all versions, according to the schedule, regardless of the versions that might be used in upcoming scheduled deployments. Schedule artifact cleanups with upcoming deployments in the timing to avoid deployment problems.

Procedure

  1. Specify the artifacts cleanup settings:
    1. Click Settings > System Settings.
    2. Under Artifact Cleanup, in the Daily Cleanup Start Time field, specify the hour of the day to start the cleanup process.
    3. In the Default Application Snapshot Retention (days) field, specify the minimum age in days to save snapshots.
      For more information, see Cleaning up snapshots.
    4. In the Default Version Retention for Component (days) field, specify the minimum age in days to save a component version.
      For example, to keep all component versions that are 5 days old or newer, specify 5. If you specify -1, all versions are saved, regardless of the setting in the Default Number of Versions to Retain for Environment field.
    5. In the Default Number of Versions to Retain for Component field, specify the minimum number of versions to keep.
      For example, to save the five most recent component versions, specify 5. If you specify -1, all versions are saved, regardless of the settings in the Default Version Retention for Component (days) field.

      When the server runs the cleanup, it deletes or archives all component versions that are older than the minimum age. However, the server retains at least the number of versions in the Default Number of Versions to Retain for Component field.

    6. In the Default Version Retention for Environment (days) field, specify the minimum age in days to save a environment version.
      For example, to keep all environment versions that have been deployed with in the last 5 days, specify 5. If you specify -1, all versions are saved, regardless of the setting in the Default Number of Versions to Retain for Environment field.
    7. In the Default Number of Versions to Retain for Environment field, specify the minimum number of environment versions to keep.
      For example, to save the five most recently deployed versions, specify 5. If you specify -1, all versions are saved, regardless of the settings in the Default Version Retention for Environment (days) field.

      When the server runs the cleanup, it deletes or archives all versions that have been deployed prior to the minimum age. However, the server retains at least the number of versions in the Default Number of Versions to Retain for Environment field.

    8. In the Archive Path field, specify the path of the location on the server to write compressed versions of each version that is archived.
      If you do not specify a path, then the server does not store the component versions that it removes.
    9. To preview the component versions to be archived the next time that an archive file is created, on the System Settings tab, click the Preview Version Cleanup link, and select a component.
    10. Click Save.
  2. Optional: Specify cleanup settings for individual components.
    These settings override the global settings.
    1. Click Components, click a component, go to the Configuration tab for the component, and then click Basic Settings.
    2. Clear the Use Default Component Cleanup Settings check box.
    3. In the Days to Retain Versions field, specify the minimum age in days to save a component version.
    4. In the Number of Versions to Retain field, specify the minimum number of versions to keep.
    5. Click Save.
  3. Optional: Specify cleanup settings for individual environments.
    These settings override the global settings.
    1. Click Applications, click an application, click an environment, click Configuration, and then click Basic Settings.
    2. Clear the Use Default Component Cleanup Settings check box.
    3. In the Days to Retain Versions field, specify the minimum age in days to save a component version. If you set bot both component and environment settings, the higher value is used.
    4. In the Number of Versions to Retain field, specify the minimum number of versions to keep.
    5. Click Save.