Skip to content

Commit

Permalink
Don't fail on listing tags, warn error instead
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Mesh <christianmesh1@gmail.com>
  • Loading branch information
cam72cam committed Dec 8, 2023
1 parent 268c1d1 commit 1c55d81
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/internal/module/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ func (m Module) UpdateMetadataFile() error {
if err != nil {
return err
}
if meta == nil {
return nil
}

return m.WriteMetadata(*meta)
}
Expand All @@ -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))
Expand Down
7 changes: 4 additions & 3 deletions src/internal/provider/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,24 @@ 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
newReleases := meta.filterNewReleases(releases)

if len(newReleases) == 0 {
p.Logger.Info("No version bump required, all versions exist")
return &meta, nil
return &nil, nil
}

shouldUpdate, err := p.shouldUpdateMetadataFile()
if err != nil {
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 {
Expand Down
3 changes: 3 additions & 0 deletions src/internal/provider/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1c55d81

Please sign in to comment.