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

Add bundle size validation #163

Closed

Conversation

bentito
Copy link
Contributor

@bentito bentito commented Oct 7, 2021

Initial take on adding a validation of the bundle size. Please let me know how it is wrong ;-)

@openshift-ci
Copy link

openshift-ci bot commented Oct 7, 2021

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: bentito
To complete the pull request process, please assign dinhxuanvu after the PR has been reviewed.
You can assign the PR to them by writing /assign @dinhxuanvu in a comment when ready.

The full list of commands accepted by this bot can be found 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 requested review from anik120 and exdx October 7, 2021 22:48
@@ -95,6 +97,14 @@ func validateBundleOperatorHub(bundle *manifests.Bundle, k8sVersion string) erro
return result
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Would that be possible?

Also, note that we need to cover the implementations with unit tests as it is done in _test.go files to ensure the checks.

func checkBundleSize(bundle *manifests.Bundle) BundleChecks {
// Crawl the bundle, mounted at ./bundle, and add up the bytes
checks := BundleChecks{errs: []error{}, warns: []error{}}
bundleDir := "." // pretty sure this isn't right, but how to get bundle path from bundle?
Copy link
Contributor

Choose a reason for hiding this comment

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

The bundle is load here:

func (b *bundleLoader) LoadBundle() error {
errs := make([]error, 0)
if err := filepath.Walk(b.dir, collectWalkErrs(b.LoadBundleWalkFunc, &errs)); err != nil {
errs = append(errs, err)
}
if !b.foundCSV {
errs = append(errs, fmt.Errorf("unable to find a csv in bundle directory %s", b.dir))
} else if b.bundle == nil {
errs = append(errs, fmt.Errorf("unable to load bundle from directory %s", b.dir))
}
return utilerrors.NewAggregate(errs)
}
we can get the size there (ihmo). i do not think we canbundleDir := "."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants