caib: restore caib download#79
Conversation
📝 WalkthroughWalkthroughAdds a new Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as CLI (caib download)
participant API as Build API
participant Reg as OCI Registry
participant FS as Local filesystem
CLI->>API: GET /builds/{name}
API-->>CLI: BuildResponse (state, diskImage)
alt build.state == phaseCompleted and diskImage present
CLI->>Reg: OCI pull (diskImage) with creds
Reg-->>CLI: stream artifact
CLI->>FS: write file to --output
FS-->>CLI: success
else not completed or no diskImage
API-->>CLI: error/status
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@cmd/caib/main.go`:
- Around line 1772-1810: runDownload is missing the same partial registry
credential validation used elsewhere: after extracting credentials with
extractRegistryCredentials(ociRef, "") validate that registryUsername and
registryPassword are both present (use the existing validateRegistryCredentials
function) and reject partial credentials with a clear error before calling
pullOCIArtifact; update runDownload to call
validateRegistryCredentials(registryUsername, registryPassword) (or the
appropriate signature) right after extraction so users get an explicit "missing
password/username" error instead of an opaque OCI auth failure.
In `@internal/controller/operatorconfig/resources.go`:
- Around line 79-81: Restore the explicit ImagePullPolicy to avoid Kubernetes
defaulting to Always for :latest images by adding ImagePullPolicy:
corev1.PullIfNotPresent to the container specs for the "build-api" container
(where getOperatorImage() is used) and likewise for the "oauth-proxy" and
"init-secrets" container definitions in resources.go; ensure corev1 is imported
and set the ImagePullPolicy field on the respective corev1.Container literals so
pods reuse cached images (or conditionally set policy if you intend different
behavior).
🧹 Nitpick comments (1)
cmd/caib/main.go (1)
532-536: Consider marking--outputas required via cobra.The flag is manually validated in
runDownload(Line 1780), but marking it required with cobra (downloadCmd.MarkFlagRequired("output")) would provide automatic help text indicating it's mandatory and consistent error messaging.
To download already built images Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
To download already built images
fixes #76
Summary by CodeRabbit
New Features
Chores