Skip to content

[BUG] opm diff: opm alpha diff does not prune empty channels in latest mode #957

@jpower432

Description

@jpower432

Description

When using opm alpha diff with an include config in latest mode, if the versions specified are higher than all of the bundle versions in existing channels, the channels are included in the FBC with no bundles attatched. In headsOnly mode, these channels are pruned.

How to Reproduce

cat include.yaml
packages:
  - name: cluster-logging
    versions: 
    - '5.4.1-24'

Latest mode code path:

1. opm alpha diff registry.redhat.io/redhat/redhat-operator-index:v4.10 -i include.yaml --debug > catalog/index.json
2. opm validate catalog
FATA[0000] invalid index:
└── invalid package "cluster-logging":
    ├── invalid channel "stable-5.2":
    │   └── channel must contain at least one bundle
    └── invalid channel "stable-5.3":
        └── channel must contain at least one bundle 

HeadsOnly code path:

1. ./bin/opm alpha diff registry.redhat.io/redhat/redhat-operator-index:v4.10 -i include.yaml --debug > catalog/index.json --headsOnly
2. opm validate catalog

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions