-
Task
-
Resolution: Unresolved
-
Normal
-
None
-
None
-
None
-
Product / Portfolio Work
-
False
-
-
False
-
Not Selected
-
-
Implement full autoprune policy support for the quay-distribution Go rewrite, matching the functionality in the Python Quay codebase
Scope
- Namespace-level and repository-level autoprune policies
- NUMBER_OF_TAGS policy method (keep N most recent tags)
- CREATION_DATE policy method (remove tags older than X)
- Tag pattern regex matching
- Background goroutine worker (30s interval)
- Prometheus metrics for
monitoring
Out of Scope
- Garbage collection / blob cleanup (separate task)
- API endpoints for policy management (uses existing Quay DB)
Technical Details
- New package: internal/autoprune/
- Follow existing
worker pattern from pkg/auth/jwk/manager.go - Reads existing Quay tables: namespaceautoprunepolicy, repositoryautoprunepolicy
- Expires tags by setting lifetime_end_ms
Configuration
FEATURE_AUTOPRUNE: true
AUTOPRUNE_WORKER_INTERVAL: "30s"
AUTOPRUNE_BATCH_SIZE: 100
LABELED_EXPIRATION_MINIMUM: "1h"
LABELED_EXPIRATION_MAXIMUM: "104w"
Acceptance Criteria
- [ ] Manager starts/stops cleanly with server lifecycle
- [] Processes namespaces in batches (configurable size)
- [ ] Applies NUMBER_OF_TAGS policies correctly
- [ ] Applies CREATION_DATE policies correctly
- [ ] Respects tag pattern filters
- [ ] Skips immutable tags
- [ ]Prometheus metrics exposed
- [ ] Unit tests for policy engine
- [ ] Integration tests with database
- [ ] Documentation updated
Implementation Phases
Phase 1: Foundation
- Create internal/autoprune/ directory
- Implement models.go - policy types, tag metadata
- Implement config.go - config types with defaults
- Add config fields to pkg/config/quay_config.go
Phase 2: Core Worker
- Implement autoprune.go - Manager with Start/Stop
- Implement worker.go - background loop
- Implement metrics.go - Prometheus metrics
Phase 3: Policy Engine
- Implement queries.go - database queries
- Implement policy_engine.go - policy evaluation
- Add tag pattern regex matching
Phase 4: Integration
- Add to pkg/server/server.go - initialize manager
- Wire shutdown in cmd/quay-distribution/main.go
Phase 5: Testing
- Unit tests for policy engine
- Unit tests for worker lifecycle
- Integration tests with database
🤖 This task description was generated with Claude Code