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(diff): prune empty channel when old model is empty #884

Conversation

jpower432
Copy link
Contributor

Description of the change:

In this PR, the opm alpha diff command will now prune empty channels when an include config is provided in headsOnly mode.

Motivation for the change:
The motivation for this change to allow the catalog index produced in this instance to pass opm validate and be usable with a cluster.

Reviewer Checklist

  • Implementation matches the proposed design, or proposal is updated to match implementation
  • Sufficient unit test coverage
  • Sufficient end-to-end test coverage
  • Docs updated or added to /docs
  • Commit messages sensible and descriptive

Closes #883

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 13, 2021

Hi @jpower432. Thanks for your PR.

I'm waiting for a operator-framework member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci openshift-ci bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 13, 2021
@estroz
Copy link
Member

estroz commented Dec 14, 2021

/ok-to-test

@openshift-ci openshift-ci bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 14, 2021
@@ -79,6 +79,19 @@ func (g *DiffGenerator) Run(oldModel, newModel model.Model) (model.Model, error)
return nil
}

// Prunes empty channels
pruneEmptyChannels := func() error {
Copy link
Member

Choose a reason for hiding this comment

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

If this is only called once, in-line the code in that spot. Perhaps this could live in Includer.Run() too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved this down to where I was calling it. The only reason I didn't put it in Includer.Run() is because this is only an issue when IncludeAdditively is false I believe.

@codecov
Copy link

codecov bot commented Dec 14, 2021

Codecov Report

Merging #884 (fb65ae2) into master (808de07) will decrease coverage by 0.00%.
The diff coverage is 33.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #884      +/-   ##
==========================================
- Coverage   52.06%   52.06%   -0.01%     
==========================================
  Files         103      103              
  Lines        9069     9072       +3     
==========================================
+ Hits         4722     4723       +1     
- Misses       3440     3441       +1     
- Partials      907      908       +1     
Impacted Files Coverage Δ
alpha/declcfg/diff.go 76.92% <33.33%> (-0.57%) ⬇️

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 808de07...fb65ae2. Read the comment docs.

Fixes operator-framework#883

Signed-off-by: Jennifer Power <barnabei.jennifer@gmail.com>
@jpower432 jpower432 force-pushed the bug/remove-empty-channels-include branch from 008e304 to fb65ae2 Compare December 14, 2021 14:05
Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

/approve
/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 14, 2021
Copy link
Member

@dinhxuanvu dinhxuanvu left a comment

Choose a reason for hiding this comment

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

Looks good.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 14, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dinhxuanvu, estroz, jpower432

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 openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 14, 2021
@openshift-merge-robot openshift-merge-robot merged commit 6b06649 into operator-framework:master Dec 14, 2021
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

opm: diff is not pruning empty channels when an include config is provided
4 participants