astefanutti commented on a change in pull request #784: Refactor controller
logic
URL: https://github.com/apache/camel-k/pull/784#discussion_r299380099
##########
File path: pkg/controller/build/build_controller.go
##########
@@ -170,33 +170,59 @@ func (r *ReconcileBuild) Reconcile(request
reconcile.Request) (reconcile.Result,
NewErrorRecoveryAction(),
}
- blog := rlog.ForBuild(instance)
- for _, a := range buildActionPool {
+ var targetPhase v1alpha1.BuildPhase
+ var err error
+
+ target := instance.DeepCopy()
+ targetLog := rlog.ForBuild(target)
+
+ for _, a := range actions {
a.InjectClient(r.client)
- a.InjectLogger(blog)
- if a.CanHandle(instance) {
- blog.Infof("Invoking action %s", a.Name())
- if err := a.Handle(ctx, instance); err != nil {
- if k8serrors.IsConflict(err) {
- blog.Error(err, "conflict")
- return reconcile.Result{
- Requeue: true,
- }, nil
+ a.InjectLogger(targetLog)
+
+ if a.CanHandle(target) {
+ targetLog.Infof("Invoking action %s", a.Name())
+
+ phaseFrom := target.Status.Phase
+
+ target, err = a.Handle(ctx, target)
+ if err != nil {
+ return reconcile.Result{
Review comment:
Shouldn't that be `reconcile.Result{}, err` to avoid swallowing the error?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services