0bb52f9ec6
Create structured plan files with 12 phases covering the full implementation: scaffold, store, crypto, Docker/NPM clients, registry poller, webhook, deployer, API layer, SvelteKit frontend, embedding, and hardening.
2.3 KiB
2.3 KiB
Phase 5: Registry Client & Poller
Status: ⬜ Not Started Parent plan: PLAN.md Domain: backend
Objective
Implement the registry client interface with Gitea implementation, and the periodic tag polling scheduler.
Tasks
- Task 1: Define
Registryinterface —ListTags(ctx, image),GetLatestTag(ctx, image, pattern) - Task 2: Implement Gitea registry client — uses Gitea API to list container image tags
- Task 3: Implement tag pattern matching — match tags against glob patterns (e.g.,
dev-*,v*) - Task 4: Implement tag comparison — detect new tags since last poll (store last-seen tag per project/stage)
- Task 5: Create poller service — periodic scheduler using
robfig/cron - Task 6: Poller logic — for each project/stage with polling enabled, check for new tags, trigger deploy if auto_deploy
- Task 7: Add
last_polled_tagfield to instances or a newpoll_statetable in store - Task 8: Implement registry factory — create client based on registry type (gitea, future: github, dockerhub)
Files to Modify/Create
internal/registry/registry.go— interface definition + factoryinternal/registry/gitea.go— Gitea registry implementationinternal/registry/poller.go— polling scheduler serviceinternal/store/poll_state.go— poll state persistence (optional, or extend existing tables)
Acceptance Criteria
- Gitea client can list tags for a given image
- Tag pattern matching correctly filters tags (glob-style)
- Poller runs on configurable interval
- New tags are detected by comparing against stored state
- Registry factory returns correct client based on type
Notes
- Gitea API:
GET /api/v1/packages/{owner}/container/{image}/tags(or similar, verify against Gitea docs) - Auth: Bearer token from registry config
- Polling interval comes from global settings
- The poller is a fallback — webhooks are the primary detection mechanism (Phase 6)
- GitHub Container Registry support is future work — just define the interface now
Review Checklist
- All tasks completed
- Interface is clean and minimal
- Pattern matching handles edge cases (empty pattern, no tags)
- Poller doesn't leak goroutines
- Registry auth tokens handled securely