From 4b69868a7d58c0caa11e25cfb75972828c8162cd Mon Sep 17 00:00:00 2001 From: Enrique Encalada Date: Fri, 11 Dec 2020 10:16:05 +0100 Subject: [PATCH] WIP: Adding some TODOS on what we need to do for issue https://github.com/shipwright-io/build/issues/463 . Keep in mind this would be the second attempt to improve on this topic, we previously tried it with: - https://github.com/shipwright-io/build/pull/483 Signed-off-by: Zoe --- pkg/controller/build/build_controller.go | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pkg/controller/build/build_controller.go b/pkg/controller/build/build_controller.go index c068395e5a..145710a035 100644 --- a/pkg/controller/build/build_controller.go +++ b/pkg/controller/build/build_controller.go @@ -35,10 +35,21 @@ import ( buildmetrics "github.com/shipwright-io/build/pkg/metrics" ) +// TODO: +// - modify types for Build +// - regenerate CRDS for Build +// - We need to generate Constants for all types of errors +// - Also fix the distinction of secrets paths when defining the above constants +// - We need to deal with an error plus a message when validation fails +// - We need to update unit and integration tests + // succeedStatus default status for the Build CRD -const succeedStatus string = "Succeeded" -const namespace string = "namespace" -const name string = "name" +const ( + succeedStatus string = "Succeeded" + clusterBuildStrategyMissing string = "ClusterBuildStrategyMissing" + namespace string = "namespace" + name string = "name" +) type setOwnerReferenceFunc func(owner, object metav1.Object, scheme *runtime.Scheme) error @@ -404,6 +415,10 @@ func (r *ReconcileBuild) validateSecrets(ctx context.Context, secretNames []stri } } + // secret from spec.source is missing + // secret from spec.output is missing + // secret from spec.builderimage is missing + // multiple secrets are missing if len(missingSecrets) > 1 { return fmt.Errorf("secrets %s do not exist", strings.Join(missingSecrets, ", ")) } else if len(missingSecrets) > 0 {