Skip to content

Add bundle size validation - #163

Closed
bentito wants to merge 3 commits into
operator-framework:masterfrom
bentito:bundle_size_to_large
Closed

Add bundle size validation#163
bentito wants to merge 3 commits into
operator-framework:masterfrom
bentito:bundle_size_to_large

Conversation

@bentito

@bentito bentito commented Oct 7, 2021

Copy link
Copy Markdown
Contributor

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

@openshift-ci

openshift-ci Bot commented Oct 7, 2021

Copy link
Copy Markdown

[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.

Details 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
}

@camilamacedo86 camilamacedo86 Oct 21, 2021

Copy link
Copy Markdown
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?

@camilamacedo86 camilamacedo86 Oct 21, 2021

Copy link
Copy Markdown
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.

2 participants