Skip to content

Commit

Permalink
go/runtime/bundle: Don't abort when some manifests cannot be loaded
Browse files Browse the repository at this point in the history
When upgrading from earlier versions the exploded bundle directory may
contain non-bundle subdirectories which should not cause the loader to
fail.
  • Loading branch information
kostko committed Feb 7, 2025
1 parent 6609237 commit 7a3d8fc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Empty file added .changelog/6044.trivial.md
Empty file.
12 changes: 10 additions & 2 deletions go/runtime/bundle/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -508,12 +508,20 @@ func (m *Manager) loadManifests() ([]*ExplodedManifest, error) {

b, err := os.ReadFile(filepath.Join(dir, manifestName))
if err != nil {
return nil, fmt.Errorf("failed to read manifest: %w", err)
m.logger.Warn("skipping unreadable manifest",
"path", dir,
"err", err,
)
continue

Check warning on line 515 in go/runtime/bundle/manager.go

View check run for this annotation

Codecov / codecov/patch

go/runtime/bundle/manager.go#L511-L515

Added lines #L511 - L515 were not covered by tests
}

var manifest Manifest
if err = json.Unmarshal(b, &manifest); err != nil {
return nil, fmt.Errorf("failed to parse manifest: %w", err)
m.logger.Warn("skipping malformed manifest",
"path", dir,
"err", err,
)
continue

Check warning on line 524 in go/runtime/bundle/manager.go

View check run for this annotation

Codecov / codecov/patch

go/runtime/bundle/manager.go#L520-L524

Added lines #L520 - L524 were not covered by tests
}

m.logger.Info("manifest loaded",
Expand Down

0 comments on commit 7a3d8fc

Please sign in to comment.