From 1c55d819f8cc174ab9e6323a714682ed12d43978 Mon Sep 17 00:00:00 2001 From: Christian Mesh Date: Fri, 8 Dec 2023 10:52:31 -0500 Subject: [PATCH] Don't fail on listing tags, warn error instead Signed-off-by: Christian Mesh --- src/internal/module/build.go | 6 +++++- src/internal/provider/build.go | 7 ++++--- src/internal/provider/update.go | 3 +++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/internal/module/build.go b/src/internal/module/build.go index 79b879414c..abe9a68f0a 100644 --- a/src/internal/module/build.go +++ b/src/internal/module/build.go @@ -17,6 +17,9 @@ func (m Module) UpdateMetadataFile() error { if err != nil { return err } + if meta == nil { + return nil + } return m.WriteMetadata(*meta) } @@ -26,7 +29,8 @@ func (m Module) UpdateMetadataFile() error { func (m Module) BuildMetadata() (*Metadata, error) { tags, err := m.getSemverTags() if err != nil { - return nil, err + m.Logger.Error("Unable to fetch semver tags, skipping", slog.Any("err", err)) + return nil, nil } versions := make([]Version, len(tags)) diff --git a/src/internal/provider/build.go b/src/internal/provider/build.go index 76097fb5a2..8a467daaf4 100644 --- a/src/internal/provider/build.go +++ b/src/internal/provider/build.go @@ -58,7 +58,8 @@ func (p Provider) buildMetadata() (*Metadata, error) { // fetch ALL the releases releases, err := p.getSemverTags() if err != nil { - return nil, err + m.Logger.Error("Unable to fetch semver tags, skipping", slog.Any("err", err)) + return nil, nil } // filter the releases to only include those that do not already exist in the metadata @@ -66,7 +67,7 @@ func (p Provider) buildMetadata() (*Metadata, error) { if len(newReleases) == 0 { p.Logger.Info("No version bump required, all versions exist") - return &meta, nil + return &nil, nil } shouldUpdate, err := p.shouldUpdateMetadataFile() @@ -74,7 +75,7 @@ func (p Provider) buildMetadata() (*Metadata, error) { p.Logger.Error("Failed to determine update status, forcing update", slog.Any("err", err)) } else if !shouldUpdate { p.Logger.Info("No version bump required, latest versions exist") - return &meta, nil + return nil, nil } type versionResult struct { diff --git a/src/internal/provider/update.go b/src/internal/provider/update.go index c79c552dd7..5b30ef75c6 100644 --- a/src/internal/provider/update.go +++ b/src/internal/provider/update.go @@ -16,6 +16,9 @@ func (p Provider) UpdateMetadataFile() error { p.Logger.Error("Failed to version bump provider", slog.Any("err", err)) return err } + if meta == nil { + return nil + } p.Logger.Info("Completed provider version bump successfully") return p.WriteMetadata(*meta)