From 53713229003160e27c89c624a6cf00d8b3bae3c3 Mon Sep 17 00:00:00 2001 From: Natalie Arellano Date: Thu, 6 Jun 2024 17:11:20 -0400 Subject: [PATCH] Emit a better error when the lifecycle isn't ready Signed-off-by: Natalie Arellano --- pkg/reconciler/builder/builder.go | 4 ++++ pkg/reconciler/clusterbuilder/clusterbuilder.go | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/pkg/reconciler/builder/builder.go b/pkg/reconciler/builder/builder.go index 169b4db36..115a016ac 100644 --- a/pkg/reconciler/builder/builder.go +++ b/pkg/reconciler/builder/builder.go @@ -248,6 +248,10 @@ func (c *Reconciler) reconcileBuilder(ctx context.Context, builder *buildapi.Bui return buildapi.BuilderRecord{}, err } + if !clusterLifecycle.Status.GetCondition(corev1alpha1.ConditionReady).IsTrue() { + return buildapi.BuilderRecord{}, errors.Errorf("Error: clusterlifecycle '%s' is not ready", clusterLifecycle.Name) + } + builderKeychain, err := c.KeychainFactory.KeychainForSecretRef(ctx, registry.SecretRef{ ServiceAccount: builder.Spec.ServiceAccount(), Namespace: builder.Namespace, diff --git a/pkg/reconciler/clusterbuilder/clusterbuilder.go b/pkg/reconciler/clusterbuilder/clusterbuilder.go index f9839370f..a7e52c6f2 100644 --- a/pkg/reconciler/clusterbuilder/clusterbuilder.go +++ b/pkg/reconciler/clusterbuilder/clusterbuilder.go @@ -231,6 +231,10 @@ func (c *Reconciler) reconcileBuilder(ctx context.Context, builder *buildapi.Clu return buildapi.BuilderRecord{}, err } + if !clusterLifecycle.Status.GetCondition(corev1alpha1.ConditionReady).IsTrue() { + return buildapi.BuilderRecord{}, errors.Errorf("Error: clusterlifecycle '%s' is not ready", clusterLifecycle.Name) + } + builderKeychain, err := c.KeychainFactory.KeychainForSecretRef(ctx, registry.SecretRef{ ServiceAccount: builder.Spec.ServiceAccountRef.Name, Namespace: builder.Spec.ServiceAccountRef.Namespace,