✨ Fail loudly when the source repository is not git - #162
Conversation
The harness only supports git, but Hub's shared/scm also supports subversion. Previously a non-git source URL was passed straight into go-git and failed with a confusing deep clone error, with the reason landing only in pod logs (issue konveyor#143). Now the harness validates the source SCM before cloning, using Hub's authoritative Repository.Kind (accept "" / "git", reject anything else; also reject an empty URL). On failure it writes a plain human-readable message to the pod termination log, which the controller surfaces on the AgentRun's Ready=False condition so the reason is visible via kubectl describe, not solely in logs. - harness: ValidateSourceRepository + ErrUnsupportedSourceSCM sentinel. - harness: termination.Write records the failure message best-effort. - controller: copy the pod termination message onto the Ready condition (falls back to the generic Sandbox reason); add pods RBAC and set TerminationMessagePolicy=FallbackToLogsOnError on the agent container. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Dylan Murray <dymurray@redhat.com>
0ad7e13 to
ce8d441
Compare
|
Warning Review limit reached
Next review available in: 58 minutes Limit details: You’ve used the included review currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?Wait for the limit to reset, then comment An organization admin can change what happens after included review limits in Billing. How do review limits work?CodeRabbit enforces per-developer PR review limits within each organization. For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (10)
✨ 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 |
|
Thanks @dymurray — took a first pass at review, a few findings: Blocking:
Non-blocking / worth a look:
|
| ctx context.Context, | ||
| run *konveyoriov1alpha1.AgentRun, | ||
| ) string { | ||
| var pods corev1.PodList |
There was a problem hiding this comment.
this is the controller's first pod read and r.List goes through the manager cache, which has no namespace or ByObject restriction, so it'll start a cluster-wide pod informer. Probably more resident memory than a best-effort message is worth. Could we use mgr.GetAPIReader() here instead?
Summary
The harness only supports git, but Hub's
shared/scmalso supports subversion. Previously a non-git source was passed straight into go-git and failed with a confusing deep clone error, with the reason landing only in pod logs.This adds fail-fast validation and surfaces the reason on the AgentRun status:
ValidateSourceRepository(+ErrUnsupportedSourceSCMsentinel) rejects non-git sources before cloning, using Hub's authoritativeRepository.Kind(accept""/git, reject anything else; also reject an empty URL).Kindis used rather than URL-scheme heuristics because SVN can also be served over https.Ready=FalseconditionMessage(falling back to the generic Sandbox reason), so the reason is visible viakubectl describe agentrun— not solely in logs. Adds pods RBAC and setsTerminationMessagePolicy=FallbackToLogsOnErroron the agent container.Validation lives in the harness (not the controller) because the clone URL is fetched from Hub at runtime and never passes through a CRD — keeping the controller domain-agnostic.
Test plan
make test— controller unit + envtest suites pass (new envtest asserts a failed pod's termination message lands on theReadycondition and phase isFailed).cd harness && go test ./...— new tests forValidateSourceRepository,termination.Write, all pass.make lint— 0 issues; harnessgofmt/go vetclean.Fixes #143
🤖 Generated with Claude Code