From 7346b1a762a0884c9a73045d6301c836f2a46632 Mon Sep 17 00:00:00 2001 From: Somtochi Onyekwere Date: Wed, 22 Jun 2022 08:58:48 +0100 Subject: [PATCH] Return a different success message for helm oci Signed-off-by: Somtochi Onyekwere --- cmd/flux/reconcile_source_helm.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cmd/flux/reconcile_source_helm.go b/cmd/flux/reconcile_source_helm.go index be27cf82..f559a5e4 100644 --- a/cmd/flux/reconcile_source_helm.go +++ b/cmd/flux/reconcile_source_helm.go @@ -21,6 +21,8 @@ import ( "github.com/spf13/cobra" + "github.com/fluxcd/pkg/apis/meta" + "github.com/fluxcd/pkg/runtime/conditions" sourcev1 "github.com/fluxcd/source-controller/api/v1beta2" ) @@ -46,5 +48,15 @@ func (obj helmRepositoryAdapter) lastHandledReconcileRequest() string { } func (obj helmRepositoryAdapter) successMessage() string { + // HelmRepository of type OCI don't set an Artifact + if obj.Spec.Type == sourcev1.HelmRepositoryTypeOCI { + readyCondition := conditions.Get(obj.HelmRepository, meta.ReadyCondition) + // This shouldn't happen, successMessage shouldn't be called if + // object isn't ready + if readyCondition == nil { + return "" + } + return readyCondition.Message + } return fmt.Sprintf("fetched revision %s", obj.Status.Artifact.Revision) }