caib: fix download when using --internal-registry#96
Conversation
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
📝 WalkthroughWalkthroughAdded TLS skip propagation and hybrid internal/external registry handling: CLI download/pull functions now accept an insecureSkipTLS flag; internal build API and server logic were updated to support disk pushes to the internal registry while optionally pushing container images externally, with adjusted credential flow and messaging. Changes
Sequence Diagram(s)mermaid CLI->>BuildServer: submit build request (useInternalRegistry, containerPush?, RegistryToken?) Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 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 789-802: The OCI download call path doesn't propagate the global
--insecure flag; update the call site in main.go (where
downloadOCIArtifactIfRequested is invoked) to pass the insecureSkipTLS boolean
through, add an insecureSkipTLS parameter to downloadOCIArtifactIfRequested and
then forward it into pullOCIArtifact; inside pullOCIArtifact set the
SystemContext fields systemCtx.OCIInsecureSkipTLSVerify = insecureSkipTLS and
systemCtx.DockerInsecureSkipTLSVerify = types.OptionalBool(insecureSkipTLS) so
TLS verification is correctly disabled when insecureSkipTLS is true.
In `@internal/buildapi/server.go`:
- Around line 1183-1199: Rename the external registry secret created in the
hybrid path to avoid colliding with the internal registry secret: modify
createRegistrySecret (called in the hybrid branch after
setupInternalRegistryBuild) to generate a unique name (e.g., use
fmt.Sprintf("%s-external-registry-auth" or "%s-registry-auth-external") instead
of "%s-registry-auth") so it no longer matches createInternalRegistrySecret's
buildName + "-registry-auth"; ensure the hybrid branch continues to return the
new envSecretRef and that cleanup logic (which consumes the returned
envSecretRef) will correctly remove the externally-named secret.
🧹 Nitpick comments (1)
internal/buildapi/server.go (1)
1259-1269: Duplicate ImageStream entry for non-bootc builds.For non-bootc builds with
externalContainerPush == false,imageNameis appended at both line 1262 and line 1268, resulting inensureImageStreambeing called twice for the same name. This is harmless (the function is idempotent) but suggests the logic could be cleaner.Suggested cleanup
// Pre-create ImageStream(s) for internal registry pushes only var imageStreams []string - if !externalContainerPush { - imageStreams = append(imageStreams, imageName) - } if req.Mode.IsBootc() && req.BuildDiskImage { imageStreams = append(imageStreams, imageName+"-disk") } - if !req.Mode.IsBootc() { + if !req.Mode.IsBootc() || !externalContainerPush { imageStreams = append(imageStreams, imageName) }Wait — on second thought, the logic depends on what non-bootc +
externalContainerPusheven means. Since non-bootc modes don't useContainerPush,externalContainerPushis alwaysfalsefor them, making the de-duplication safe. No action needed unless you want to tidy up.
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Signed-off-by: Benny Zlotnik <bzlotnik@redhat.com>
Summary by CodeRabbit
New Features
Improvements
Bug Fixes