operator-framework / operator-courier

Build, verify and push operators
Apache License 2.0
41 stars 53 forks source link

operator courier reporting invalid json string for a CRD within the operator CSV #197

Closed maneeshmehra closed 3 years ago

maneeshmehra commented 3 years ago

Operator in reference: mongodb-enterprise-advanced-ibm.v1.6.3

Here is the error Index Image Builder received when trying to add the operator to the OCP v4.5 index:

2020-10-09 09:12:09,342 iib.workers.tasks.utils DEBUG utils.run_cmd Running the command "manifest-tool push from-spec /tmp/iib-hxtbfihx/manifest.yaml" 2020-10-09 09:12:10,839 iib.workers.tasks.legacy INFO legacy._opm_index_export Generating the backported operator for package: mongodb-enterprise-advanced-ibm 2020-10-09 09:12:10,840 iib.workers.tasks.utils DEBUG utils.run_cmd Running the command "opm index export --index quay.io/rh-osbs/iib:19378 --package mongodb-enterprise-advanced-ibm --download-folder mongodb-enterprise-advanced-ibm" 2020-10-09 09:12:27,611 iib.workers.tasks.legacy INFO legacy._verify_package_info Verifying package_name mongodb-enterprise-advanced-ibm 2020-10-09 09:12:27,614 iib.workers.tasks.legacy INFO legacy._push_package_manifest Files are {'file': ('/tmp/iib-i_5vgtc3/mongodb-enterprise-advanced-ibm/manifests.zip', <_io.BufferedReader name='/tmp/iib-i_5vgtc3/mongodb-enterprise-advanced-ibm/manifests.zip'>)} 2020-10-09 09:12:29,479 iib.workers.tasks.legacy ERROR legacy._push_package_manifest Request to OMPS failed: {"error":"PackageValidationError","message":"Failed to push manifest: Resulting bundle is invalid, input yaml is improperly defined.","status":400,"validation_info":{"errors":["metadata.annotations.alm-examples contains invalid json string"],"warnings":[]}}

Upon further investigation, it was determined from OMPS logs that its operator-courier that is failing with the following error: 2020-10-09T13:12:28Z - [16] operatorcourier.verified_manifest - INFO - The source directory is in nested structure. 2020-10-09T13:12:29Z - [16] operatorcourier.verified_manifest - INFO - Parsing version: 1.6.3 INFO: Validating bundle. [tmppyx6sc4q/package.yaml] INFO: Validating custom resource definitions. [tmppyx6sc4q/package.yaml] INFO: Evaluating crd mongodb.mongodb.com [1.6.3/mongodb.mongodb.com.crd.yaml] INFO: Evaluating crd mongodbusers.mongodb.com [1.6.3/mongodbusers.mongodb.com.crd.yaml] INFO: Evaluating crd opsmanagers.mongodb.com [1.6.3/opsmanagers.mongodb.com.crd.yaml] INFO: Validating cluster service versions. [1.6.3/opsmanagers.mongodb.com.crd.yaml] INFO: Evaluating csv mongodb-enterprise-advanced-ibm.v1.6.3 [1.6.3/mongodb-enterprise-advanced-ibm.v1.6.3.clusterserviceversion.yaml] ERROR: metadata.annotations.alm-examples contains invalid json string [1.6.3/mongodb-enterprise-advanced-ibm.v1.6.3.clusterserviceversion.yaml]

sonam1412 commented 3 years ago

latest full logs path: http://external-ci-coldstorage.datahub.redhat.com/cvp/cvp-isv-operator-bundle-image-validation-test/marketplace-ospid-e65ac83b-712c-46d8-9e0a-dd07884e9e45-c0c122d6-fe9c-4170-b11a-bef0a59b2da9/c0c122d6-fe9c-4170-b11a-bef0a59b2da9/operator-catalog-initialization-bundle-image-output.txt

sonam1412 commented 3 years ago

PFA the operator manifest and the CSV manifests.zip

maneeshmehra commented 3 years ago

@sonam1412: Please follow the discussion on this thread in Slack: https://coreos.slack.com/archives/C3VS0LV41/p1602508843004900?thread_ts=1602263573.430400&cid=C3VS0LV41

kevinrizza commented 3 years ago

@sonam1412 As I mentioned in the slack thread, that CSV has a crlf in the middle of the json object, so the validation is correctly throwing an error against that bundle. It seems like whatever saved the bundle may have been doing some incorrect line wrapping or formatting of some kind? I'm attaching a fixed version of the CSV that should work, but no change is needed on the courier.

mongodb-enterprise-advanced-ibm.v1.6.3.clusterserviceversion.zip

lcarva commented 3 years ago

This is a bug in IIB. The yaml library used adds new a line character if the string is longer than so many characters.