Skip to content

strata cleanup lifecycle

strata cleanup lifecycle

Generate ECR lifecycle policies that expire what strata calls abandoned

Synopsis

Generates one ECR lifecycle policy per repo with a rule that expires untagged images pushed more than abandoned_pull_days ago (from the staleness policy, or --days), so ECR does the cleanup itself.

ECR sees push age but not pulls or what is built on an image, so each rule is checked against the index first. A repo where the rule would expire an image strata keeps (pulled recently, a base other images are built on, or a platform of a tagged index) gets no policy, and the table says why. --include-conflicts writes the rule anyway.

-o script prints aws ecr put-lifecycle-policy commands to review and run. Preview each with aws ecr start-lifecycle-policy-preview before applying it. A policy replaces any lifecycle policy the repository already has.

strata cleanup lifecycle [flags]

Examples

  strata cleanup lifecycle
  strata cleanup lifecycle --repo '*/sandbox/*' --days 30
  strata cleanup lifecycle -o script > apply-lifecycle.sh
  strata cleanup lifecycle -o json

Options

      --days int            expire untagged images pushed more than this many days ago (default: the policy's abandoned_pull_days)
  -h, --help                help for lifecycle
      --include-conflicts   write a repo's rule even when it would expire images strata keeps
  -o, --output string       output format: table, json or script (default "table")
      --repo strings        only repos matching this glob, with the host, such as '*/sandbox/*' (repeatable)

Options inherited from parent commands

      --config string      config file (default: $XDG_CONFIG_HOME/strata/strata.yaml, ~/.strata.yaml or ./strata.yaml)
      --db string          index file (default: $XDG_DATA_HOME/strata/strata.duckdb)
      --log-level string   log level: debug, info, warn or error (default: info)
      --platform string    platform to pick when a ref names a multi-platform index (default: linux/amd64)
      --server string      URL of a running strata serve to query instead of the index file

SEE ALSO

  • strata cleanup - List images safe to delete and the storage deleting them frees