diff --git a/changelog/fragments/validation-bug-bump-api-2.yaml b/changelog/fragments/validation-bug-bump-api-2.yaml new file mode 100644 index 00000000000..640d9faacf7 --- /dev/null +++ b/changelog/fragments/validation-bug-bump-api-2.yaml @@ -0,0 +1,5 @@ +entries: + - description: > + Fix bug in `bundle validate` that erroneously causes errors when a CRD manifest contains versions + not present in a bundled CSV by bumping the api library version. + kind: bugfix diff --git a/go.mod b/go.mod index 3b4a8ee50ce..69da0bd7dbd 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/mitchellh/mapstructure v1.1.2 github.com/onsi/ginkgo v1.12.0 github.com/onsi/gomega v1.9.0 - github.com/operator-framework/api v0.3.7-0.20200602203552-431198de9fc2 + github.com/operator-framework/api v0.3.8 github.com/operator-framework/operator-registry v1.12.6-0.20200611222234-275301b779f8 github.com/pborman/uuid v1.2.0 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index c607f763c09..9dc1180111b 100644 --- a/go.sum +++ b/go.sum @@ -735,6 +735,8 @@ github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFSt github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/operator-framework/api v0.3.7-0.20200602203552-431198de9fc2 h1:2KtDe3jI6ftXGj5M875WVvv6pBIk4K9DyrwPuE+XfOc= github.com/operator-framework/api v0.3.7-0.20200602203552-431198de9fc2/go.mod h1:Xbje9x0SHmh0nihE21kpesB38vk3cyxnE6JdDS8Jo1Q= +github.com/operator-framework/api v0.3.8 h1:tJykTCmwGKZBsPVTCfxbwz6nTF6dzmKydWJtC40erc8= +github.com/operator-framework/api v0.3.8/go.mod h1:Xbje9x0SHmh0nihE21kpesB38vk3cyxnE6JdDS8Jo1Q= github.com/operator-framework/operator-registry v1.12.6-0.20200611222234-275301b779f8 h1:F3zzxoBJJANdKMxmSOi5z/HWiVT+gwOdhROkEwDWD2M= github.com/operator-framework/operator-registry v1.12.6-0.20200611222234-275301b779f8/go.mod h1:loVINznYhgBIkmv83kU4yee88RS0BBk+hqOw9r4bhJk= github.com/otiai10/copy v1.2.0 h1:HvG945u96iNadPoG2/Ja2+AUJeW5YuFQMixq9yirC+k= diff --git a/internal/scorecard/alpha/tests/olm.go b/internal/scorecard/alpha/tests/olm.go index e34c22682d8..8f6407e62ea 100644 --- a/internal/scorecard/alpha/tests/olm.go +++ b/internal/scorecard/alpha/tests/olm.go @@ -88,6 +88,8 @@ func BundleValidationTest(dir string) scapiv1alpha2.ScorecardTestResult { if err != nil { r.State = scapiv1alpha2.FailState r.Errors = append(r.Errors, err.Error()) + r.Log = buf.String() + return r } objs := []interface{}{bundle, bundle.CSV} @@ -97,7 +99,7 @@ func BundleValidationTest(dir string) scapiv1alpha2.ScorecardTestResult { for _, crd := range bundle.V1beta1CRDs { objs = append(objs, crd) } - validationResults := apivalidation.AllValidators.Validate(objs...) + validationResults := apivalidation.DefaultBundleValidators.Validate(objs...) for _, result := range validationResults { for _, e := range result.Errors { r.Errors = append(r.Errors, e.Error()) diff --git a/internal/scorecard/plugins/olm_tests.go b/internal/scorecard/plugins/olm_tests.go index d4f84751980..dea6be17013 100644 --- a/internal/scorecard/plugins/olm_tests.go +++ b/internal/scorecard/plugins/olm_tests.go @@ -199,7 +199,7 @@ func (t *BundleValidationTest) Run(ctx context.Context) *schelpers.TestResult { for _, crd := range bundle.V1beta1CRDs { objs = append(objs, crd) } - validationResults := apivalidation.AllValidators.Validate(objs...) + validationResults := apivalidation.DefaultBundleValidators.Validate(objs...) for _, result := range validationResults { for _, e := range result.Errors { res.Errors = append(res.Errors, &e)