Skip to content
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

fix(indexing): respect strict mode #523

Merged

Conversation

njhale
Copy link
Member

@njhale njhale commented Nov 19, 2020

Keep packages in the input stream regardless of errors attempting to add
bundles of that package to an index. This prevents invalid bundles from
being elided before all valid bundles have been exhausted, and fixes a
regression that effectively broke strict (non-permissive) mode.

Supersedes #522

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: njhale

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 19, 2020
@codecov
Copy link

codecov bot commented Nov 19, 2020

Codecov Report

Merging #523 (f3e7b15) into master (fded0bf) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #523      +/-   ##
==========================================
- Coverage   49.42%   49.41%   -0.02%     
==========================================
  Files          90       90              
  Lines        6286     6284       -2     
==========================================
- Hits         3107     3105       -2     
  Misses       2485     2485              
  Partials      694      694              
Impacted Files Coverage Δ
pkg/registry/populator.go 63.02% <ø> (ø)
pkg/registry/input_stream.go 77.27% <100.00%> (-0.67%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fded0bf...09239b7. Read the comment docs.

@njhale
Copy link
Member Author

njhale commented Nov 19, 2020

/retest

Copy link
Contributor

@anik120 anik120 left a comment

Choose a reason for hiding this comment

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

@njhale looking good, had a couple of comments and a nit

@@ -90,7 +90,7 @@ func (r *ReplacesInputStream) canAdd(bundle *Bundle, packageGraph *Package) erro

if replaces != "" && !packageGraph.HasCsv(replaces) {
// We can't add this until a replacement exists
return fmt.Errorf("Invalid bundle %s, bundle specifies a non-existent replacement %s", bundle.Name, replaces)
return fmt.Errorf("Invalid bundle %s, replaces nonexistent bundle %s", bundle.Name, replaces)
Copy link
Contributor

Choose a reason for hiding this comment

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

This feels more like a personal choice and unrelated to the fix the PR is trying to address.

Copy link
Member Author

Choose a reason for hiding this comment

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

sure, but the existing wording doesn't make sense.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we feel that was we can probably open another housekeeping PR that's titled fix log message. I'm just not sure if changing log message goes with respect strict mode

Copy link
Member Author

Choose a reason for hiding this comment

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

I feel strongly that we shouldn't tax CI for trivial changes. I think the k8s docs also suggest that trival changes should go into larger PRs for that project.

@@ -147,7 +147,6 @@ func (r *ReplacesInputStream) Next() (*ImageInput, error) {

// No viable bundle found in the package, can't parse it any further
if len(packageErrs) > 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this check anymore? Cant we just append the errors regardless?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yup, looks like that would work for the edge cases: https://play.golang.org/p/_SNa9QLWEhQ

@@ -196,7 +196,6 @@ func (i *DirectoryPopulator) loadManifests(imagesToAdd []*ImageInput, imagesToRe
errs = append(errs, err)
break
}

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Seems like some noise in a file not being touched by this PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

I did this on purpose, didn't like the extra space; I'm pretty sure I introduced this in the previous patch too.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd put forth the same argument as this comment, but if you feel strongly about it anyway it's a small PR so I guess it's not worth delaying this PR because of this.

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
Keep packages in the input stream regardless of errors attempting to add
bundles of that package to an index. This prevents invalid bundles from
being elided before all valid bundles have been exhausted, and fixes a
regression that effectively broke strict (non-permissive) mode.
delete(r.packages, pkg)
errs = append(errs, packageErrs...)
}
// No viable bundle found in the package, can't parse it any further, so return any errors
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Is this comment still relevant?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes

@anik120
Copy link
Contributor

anik120 commented Nov 19, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 19, 2020
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 03865b2 into operator-framework:master Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants