Run a dry run
Run a dry run to preview which artifacts a cleanup rule would delete before any changes are made. Validate criteria and filters safely.
A dry run executes a cleanup rule with identical evaluation logic but does not delete any artifacts. The result shows exactly which versions would be removed, which are protected, and how much storage would be reclaimed. This gives you a safe way to validate that your criteria and pattern filters are correct before the rule runs on schedule.
Dry runs are especially important when you are setting up a new cleanup rule, changing criteria on an existing rule, or attaching a rule to additional registries. The cost of running a dry run is a few seconds of wait time. The cost of a misconfigured rule is unintended deletions across your registries.
Before you begin
An existing cleanup rule: Dry runs are available only for cleanup rules. Retention rules do not execute independently and do not have a dry run option. To create a cleanup rule, go to Create a cleanup rule.
Artifact Registry access: Project Admin or Artifact Registry Administrator role.
Run the dry run
Go to Artifact Registry > Registries Settings > Lifecycle Rules.
Find the cleanup rule you want to test.
Select the More icon (⋮) on the rule row.
Select Dry run.
The dry run starts immediately. When it completes, results appear in the Lifecycle Rule Executions tab alongside scheduled executions, tagged as a dry run.
Interpret the results
Select the dry run entry in the Lifecycle Rule Executions tab to open the detail view.
Summary metrics
The top of the detail view displays:
Total artifacts scanned: The number of artifact versions evaluated across all attached registries.
Artifacts that would be deleted: The count of versions matching all enabled criteria.
Storage that would be reclaimed: The estimated storage savings from removing those versions.
Packages affected: The number of distinct packages containing deletion candidates.
Version table
The table lists every version the rule evaluated. Each row shows:
Package name
The package or image the version belongs to.
Version
The version, tag, or digest.
Registry
The registry containing the version.
Status
WOULD BE DELETED for deletion candidates, or PROTECTED for versions shielded by a retention rule or deployment-aware protection.
Size
The size of the version.
Uploaded at
When the version was uploaded. Compare this with the "Delete artifacts older than X days" and "Keep last N versions" criteria.
Last downloaded
When the version was last downloaded. Compare this with the "Delete if not downloaded in last X days" criterion.
Use the search bar or select Add filter to narrow the table. At a parent scope, select Show items from child scope to include versions from child-scope registries.
Validate the results
After reviewing the dry run, check the following:
No unexpected deletions: Confirm that versions you expect to keep do not show WOULD BE DELETED. If they do, adjust your cleanup criteria or add a retention rule to protect them.
Protected versions are correct: Verify that versions showing PROTECTED are the ones you intend to keep. Docker images show PROTECTED when Harness CD reports them as actively deployed or when a retention rule matches them.
Storage savings are meaningful: If the estimated storage reclaimed is negligible, the criteria may be too narrow for the current state of your registries. Consider broadening the age or download-activity thresholds.
Pattern filters match correctly: If artifacts you expected to see are missing from the results, the pattern filter may be excluding them. Verify the regular expression syntax in the rule configuration.
When to run dry runs
Run a dry run in these situations:
Before activating a new cleanup rule: Validate the criteria on real data before the first scheduled execution.
After changing criteria or filters: Confirm that updated thresholds or patterns produce the expected results.
After attaching new registries: Verify that the rule does not target artifacts in the new registries that should be retained.
After creating or modifying a retention rule: Confirm that the retention rule protects the intended versions by checking that they show PROTECTED in the dry run.
Before broadening scope: If you are changing a rule from Specific Registries to All Registries, run a dry run first to see the expanded impact.
Next steps
To review past scheduled and dry run executions, go to View rule executions.
To adjust cleanup criteria, go to Create a cleanup rule.
To protect specific versions from deletion, go to Create a retention rule.
Last updated
Was this helpful?