Skip to main content
After multiple image versions have accumulated in a project, you can use retention rules to specify the repositories, tags, and version ranges to retain. First, confirm which versions are still required for deployment or rollback, then perform a trial run and verify the results before deciding whether to execute the rule officially.
Formally executing the retention policy may delete artifacts that do not match the rules, affecting the deployment or rollback of Images in earlier versions. Before execution, ensure that the retention rules cover versions still in use and review the trial run results.

Create Retention Rule

Each project supports up to 15 retention rules. When multiple rules exist, they are evaluated using an OR relationship: an artifact is retained if it matches any rule.

Procedure

  1. Log in to the GPU Cloud console.
  2. Go to the STORAGE > Registry page.
  3. Select the target region, then, on the Projects tab, click the name of the target project.
  4. In the project sidebar, go to the Retention Policy page. In the Retention Rules section, click Add Policy.
  5. Configure the scope of artifacts to retain.
  6. Save the rule, then verify the matching conditions and status in the Retention Rules list.

Recommendation Strategy Examples

The following configuration example can be adjusted as needed for your project.
  • Clean Up Untagged Artifacts
    • Configure: Set the tag matching pattern to **, select Always Retain as the retention policy, and close Untagged Artifacts.
    • Description: This rule retains tagged artifacts; untagged artifacts may still be retained by other rules.
  • Retain Versions by Push and Pull History
    • Configure: Create two rules, both with the tag matching pattern set to **: one retains 20 artifacts by push time, and the other retains 10 artifacts by pull time.
    • Note: 20 and 10 are example quantities and can be adjusted as needed. To retain untagged artifacts, enable Untagged Artifacts in the relevant rule.
  • Retain Versions of Key Repositories by Tag Prefix
    • Configure: Create a rule for the aegis repository, set the tag matching pattern to v3*, and select Always Retain as the retention policy.
    • Description: Tags beginning with v3 are retained; other tags are handled according to other rules.

Trial Run and Result Verification

  1. In the Retention Rules section, click Dry Run and wait for the execution record to be generated.
    The trial run is only used to preview the scope of artifacts matched by the rule and will not delete any artifacts.
  2. In Execution History, find the record for this trial run, and verify the repositories involved and the retained results as described in View Execution History. If the results do not meet expectations, adjust the rules and run a trial again before performing the formal execution.

Execute Retention Policy

Manual Execution

After confirming that the trial run results meet expectations, click Run Now in the Retention Rules section. After execution, you can view the record in Execution History.

Configure Scheduled Execution

In Trigger Cron, select Custom, enter the Cron expression in the order of “second minute hour day month day of week,” and then click Save. The expression uses the UTC timezone. For example, 0 0 2 * * * indicates execution at 02:00 UTC every day. Before enabling scheduled execution, ensure that the labels of subsequently added versions are also within the expected retention scope.

View Execution History

  1. Open the Retention Policy page for the target project, and click Refresh under Execution History to retrieve the latest records.
  2. Locate the record you want to view, verify the execution status and the repositories involved, and confirm that the result meets expectations.
  3. Perform actions in the Actions column based on the record status.
    • Records that are in progress can be stopped.
    • Completed records support viewing logs.
    Execution History and Record Actions

Adjust or Disable Rules

In the Retention Rules list, locate the target rule. Click Edit to modify the matching criteria as needed, or click Disable to suspend it. When the rule is no longer needed, click Delete and follow the prompts to confirm. Before modifying, disabling, or deleting a rule, check whether other rules still cover the versions that need to be retained. After making changes, perform a trial run before executing it formally.