Skip to content

fix(opm-index-add) Throw error when a bundle is invalid #522

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/registry/input_stream.go
Original file line number Diff line number Diff line change
@@ -142,7 +142,7 @@ func (r *ReplacesInputStream) Next() (*ImageInput, error) {
delete(r.packages, pkg)
}

return image, nil
return image, utilerrors.NewAggregate(errs)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add packageErrs into the errs before return?

Copy link
Member

@njhale njhale Nov 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this fix looks incorrect -- the way this should work is:

  • as long as we find a bundle that works for at least one package, return that "good" bundle and no error
  • if there are no "good" bundles left, return errors from bad bundles
  • if there are no bundles left, we're good, return nil

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've opened #523, which I believe fixes the regression. It also adds a test that fails before/succeeds after the change.

@anik120 PTAL, and let me know if you agree with the fix.

}

// No viable bundle found in the package, can't parse it any further