feat: enforce version-aware tag format for custom images#431
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughChangesSwarm image validation
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 10 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
server/internal/orchestrator/swarm/rag_instance_resources_test.go (1)
206-222: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winUpdate stale comment referencing "rag/latest".
Line 208 comment says
// Override the "rag/latest" imagebut the code now overrides"rag/1.0.0". Update the comment to match.📝 Proposed fix for stale comment
- // Override the "rag/latest" image with a constraint requiring PG >= 18. + // Override the "rag/1.0.0" image with a constraint requiring PG >= 18.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@server/internal/orchestrator/swarm/rag_instance_resources_test.go` around lines 206 - 222, Update the stale comment in TestGenerateRAGInstanceResources_IncompatibleVersion to reference the "rag/1.0.0" image instead of "rag/latest", matching the service image being overridden by addServiceImage.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@server/internal/orchestrator/swarm/orchestrator.go`:
- Around line 1134-1153: Guard both version pointers before calling
versionHasPrefix in the validation block around parseImageTag: when
cur.PgEdgeVersion is present but PostgresVersion or SpockVersion is nil, append
an appropriate validation error to errs and avoid dereferencing or validating
the missing value. Preserve the existing mismatch checks for non-nil versions
and return the invalid ValidationResult consistently.
---
Outside diff comments:
In `@server/internal/orchestrator/swarm/rag_instance_resources_test.go`:
- Around line 206-222: Update the stale comment in
TestGenerateRAGInstanceResources_IncompatibleVersion to reference the
"rag/1.0.0" image instead of "rag/latest", matching the service image being
overridden by addServiceImage.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 961a90f4-c8bb-4446-97ae-d2db1083502e
📒 Files selected for processing (10)
server/internal/database/orchestrator.goserver/internal/orchestrator/swarm/image_tag.goserver/internal/orchestrator/swarm/image_tag_test.goserver/internal/orchestrator/swarm/orchestrator.goserver/internal/orchestrator/swarm/rag_instance_resources_test.goserver/internal/orchestrator/swarm/rag_service_keys_resource_test.goserver/internal/orchestrator/swarm/resolve_service_image_test.goserver/internal/orchestrator/swarm/service_images_test.goserver/internal/orchestrator/swarm/validate_instance_specs_test.goserver/internal/orchestrator/swarm/version-manifest.json
mmols
left a comment
There was a problem hiding this comment.
Just a few questions on this one before we merge
1. No image override — uses manifest defaultcp1-req create-database < ../demo/Images/create_db_with_no_image.json | cp-follow-task 2. Exact manifest image — recognized tag, versions matchcp1-req create-database < ../demo/Images/create_db_manifest_image.json | cp-follow-task 3. Wrong pg version — REJECTED (400)create_db_wrong_pg_version.json expect: "image tag postgres version 18.3 does not match spec version 17.9"cp1-req create-database < ../demo/Images/create_db_wrong_pg_version.json 4. Image not in registry — REJECTED (400)expect: "manifest unknown"cp1-req create-database < ../demo/Images/create_db_lower_image.json 5. Custom image, versions match — accepted, creates clustercreate_db_custom_image_success.json cp1-req create-database < ../demo/Images/create_db_custom_image_success.json | cp-follow-task 6. Spock patch upgrade on the cluster from step 5update_db_spock_patch_upgrade.json spec: 17.10 / spock "5", image: 17.10-spock5.0.9-standard-1prefix match accepts 5.0.9 against spec "5"cp1-req update-database storefront-custom-img < ../demo/Images/update_db_spock_patch_upgrade.json | cp-follow-task 7. No build suffix (17.10-spock5.0.10-standard)create_db_no_build_suffix.json cp1-req create-database < ../demo/Images/create_db_no_build_suffix.json | cp-follow-task 8. Major-only spock (17.10-spock5-standard) — recognized, acceptedcp1-req create-database < ../demo/Images/create_db_mutable_spock.json | cp-follow-task 9. Digest-pinned, versions match — acceptedcp1-req create-database < ../demo/Images/create_db_digest_pinned.json | cp-follow-task 10. Digest-pinned, wrong pg version — REJECTED (400)create_db_digest_wrong_pg.json cp1-req create-database < ../demo/Images/create_db_digest_wrong_pg.json 11. RAG, MCP & PostgREST Servicescreate_db_with_rag_mcp_postgrest.json
|
Summary
This PR refines the custom image validation logic. Unrecognizable image tags (for example, development builds) are now accepted without version checks, while recognizable pgEdge-formatted image tags continue to be validated against the versions declared in the specification.
Changes
my-dev-buildorlatest) without version validation. These tags are accepted as long as the image exists in the registry.{pgver}-spock{spockver}-{variant}-{build}) against the versions declared in the cluster specification.spock_version: "5"accepts image tags such asspock5.0.9andspock5.0.10without requiring a spec update.Testing
Verification:
Checklist
PLAT-641