Skip to content

gen-csv should find out the latest CSV version #2267

@aliok

Description

@aliok

Feature Request

Is your feature request related to a problem? Please describe.

Assume this tree:

$ tree deploy/
deploy/
└── olm-catalog
    └── knative-eventing-operator
        ├── 0.9.0
        │   ├── 300-eventing-v1alpha1-knativeeventing-crd.yaml
        │   └── knative-eventing-operator.v0.9.0.clusterserviceversion.yaml
        ├── 0.10.0
        │   ├── eventing_v1alpha1_knativeeventing_crd.yaml
        │   └── knative-eventing-operator.v0.10.0.clusterserviceversion.yaml
        └── knative-eventing-operator.package.yaml

and assume I want to generate the CSV for version 0.11.0.

Currently I have to do this:

operator-sdk olm-catalog gen-csv            \
  --from-version  0.10.0                    \
  --csv-version   0.11.0                    \
  [...]

I have to find out the from-version myself and feed it to operator-sdk olm-catalog gen-csv, which is not easy (details at the bottom).

Describe the solution you'd like

I would like to have a call like this:

operator-sdk olm-catalog gen-csv            \
  --from-latest-version                     \
  --csv-version   0.11.0                    \
  [...]

and operator-sdk should figure out the --from-version for me.

--from-latest-version (just made it up) is the important thing here! I suggest creating a flag like that.

Outcome would be:

$ tree deploy/
deploy/
└── olm-catalog
    └── knative-eventing-operator
        ├── 0.9.0
        │   ├── 300-eventing-v1alpha1-knativeeventing-crd.yaml
        │   └── knative-eventing-operator.v0.9.0.clusterserviceversion.yaml
        ├── 0.10.0
        │   ├── eventing_v1alpha1_knativeeventing_crd.yaml
        │   └── knative-eventing-operator.v0.10.0.clusterserviceversion.yaml
        ├── 0.11.0
        │   ├── eventing_v1alpha1_knativeeventing_crd.yaml
        │   └── knative-eventing-operator.v0.11.0.clusterserviceversion.yaml
        └── knative-eventing-operator.package.yaml

Additional info
In our project, we want to call gen-csv subcommand with a Bash script.
However, finding out the previous version and passing it as --from-version is hard with Bash. That is because of semver complexities. For example, 0.10.0 is a greater version than 0.9.0, but not when you simply sort nested directory names. So, alphabetic sorting won't work.

However, if the CLI would do that for me, that would be great! CLI could simply use https://github.com/coreos/go-semver.

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.needs discussionolm-integrationIssue relates to the OLM integration

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions