Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1869525

Summary: validation error: CRD.spec.version does not match CSV.spec.crd.owned.version
Product: OpenShift Container Platform Reporter: Francesco Romani <fromani>
Component: OLMAssignee: Evan Cordell <ecordell>
OLM sub component: OperatorHub QA Contact: yhui
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: bluddy
Version: 4.6   
Target Milestone: ---   
Target Release: 4.6.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-27 16:28:38 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Francesco Romani 2020-08-18 08:23:06 UTC
Description of problem:
Trying to validate a bundle yields the error per subect:
{"error":"PackageValidationError","message":"Failed to push manifest: Resulting bundle is invalid, input yaml is improperly defined.","status":400,"validation_info":{"errors":["CRD.spec.version does not match CSV.spec.crd.owned.version"],"warnings":["csv metadata.annotations.createdAt not defined","csv spec.icon not defined","csv metadata.annotations.createdAt not defined","csv spec.icon not defined","csv metadata.annotations.createdAt not defined","csv spec.icon not defined"]}}

Our CSV looks like this:
https://github.com/openshift-kni/performance-addon-operators/blob/master/deploy/olm-catalog/performance-addon-operator/4.6.0/performance-addon-operator.v4.6.0.clusterserviceversion.yaml#L52
note two CRD versions here

Our CRD looks like this:
https://github.com/openshift-kni/performance-addon-operators/blob/master/deploy/olm-catalog/performance-addon-operator/4.6.0/performance.openshift.io_performanceprofiles_crd.yaml#L13
note two versions here

Comment 2 Francesco Romani 2020-08-18 09:44:01 UTC
Proposed fix: https://github.com/operator-framework/operator-courier/pull/194

Comment 4 yhui 2020-08-20 15:30:56 UTC
Version:
[root@preserve-olm-env yhui]# operator-courier -v
2.1.9
There is no sub-command `operator-courier validate` in this version. Get the help information of `operator-courier` as follows.

[root@preserve-olm-env bug]# operator-courier -h
usage: operator-courier [-h] [-v] [--verbose] {verify,push,nest,flatten} ...

Build, verify and push operator bundles into external app registry

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         Show the current version of operator-courier
  --verbose             Provide detailed logs

subcommands:
  {verify,push,nest,flatten}
    verify              Create a bundle and test it for correctness.
    push                Create a bundle, test it, and push it to an app
                        registry.
    nest                Take a flat to-be-bundled directory and version nest
                        it.
    flatten             Create a flat directory from versioned operator bundle
                        yaml files.
[root@preserve-olm-env bug]# operator-courier verify -h
usage: operator-courier verify [-h] [--ui_validate_io]
                               [--validation-output VALIDATION_OUTPUT]
                               source_dir

Build and verify an operator bundle to test

positional arguments:
  source_dir            Path of your directory of yaml files to bundle. Either
                        set this or use the files argument for bundle data.

optional arguments:
  -h, --help            show this help message and exit
  --ui_validate_io      Validate bundle for operatorhub.io UI. To visually
                        confirm that your operator will be displayed
                        correctly, please visit https://operatorhub.io/preview
                        and paste your operator CSV.
  --validation-output VALIDATION_OUTPUT
                        A file to write validation warnings and errors to in
                        JSON format
Choose `operator-courier verify` to verify the bug.

Test procedure:
1, Get the manifest bundle: http://pkgs.devel.redhat.com/cgit/containers/performance-addon-operator-dev-operator-metadata/tree/?h=rhaos-4.6-rhel-8
[root@preserve-olm-env bug]# ls
container.yaml     cvp-owners.yml  fetch_manifests       rebuild.changelog        source-repos           update_manifests
container.yaml.in  Dockerfile      get_pullspec.py       render_templates         store_manifest.py      versions.stored
content_sets.yml   Dockerfile.in   performance-operator  replace_csv_pullspec.py  translate_pullspec.py  versions.wanted

2, Verify the bundle.
[root@preserve-olm-env bug]# operator-courier verify performance-operator/
WARNING: csv metadata.annotations.createdAt not defined [4.4.0/performance-addon-operator.v4.4.0.clusterserviceversion.yaml]
WARNING: csv spec.icon not defined [4.4.0/performance-addon-operator.v4.4.0.clusterserviceversion.yaml]
WARNING: csv metadata.annotations.createdAt not defined [4.5.0/performance-addon-operator.v4.5.0.clusterserviceversion.yaml]
WARNING: csv spec.icon not defined [4.5.0/performance-addon-operator.v4.5.0.clusterserviceversion.yaml]
WARNING: csv metadata.annotations.createdAt not defined [4.6.0/performance-addon-operator.v4.6.0.clusterserviceversion.yaml]
WARNING: csv spec.icon not defined [4.6.0/performance-addon-operator.v4.6.0.clusterserviceversion.yaml]

There is no error as per bug title. Verify the bug.

Comment 7 errata-xmlrpc 2020-10-27 16:28:38 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (OpenShift Container Platform 4.6 GA Images), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4196