ComplianceAsCode / compliance-operator

Operator providing Kubernetes cluster compliance checks
Apache License 2.0
38 stars 23 forks source link

CMP-2176: Implement `replaces` in bundle CSV #475

Closed rhmdnd closed 8 months ago

rhmdnd commented 11 months ago

The replaces attribute of an operator's CSV helps OLM build relationships between operators, making it easier for users to install older versions of an operator (or know which version supercedes the version they're using).

This commit reintroduces the replaces attribute, since it was being deleted before as a side-effect of an operator-sdk update. It should be safe to include again.

openshift-ci-robot commented 11 months ago

@rhmdnd: This pull request references CMP-2176 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target either version "4.15." or "openshift-4.15.", but it targets "compliance-operator-1.4.0" instead.

In response to [this](https://github.com/ComplianceAsCode/compliance-operator/pull/475): >The `replaces` attribute of an operator's CSV helps OLM build >relationships between operators, making it easier for users to install >older versions of an operator (or know which version supercedes the >version they're using). > >This commit reintroduces the `replaces` attribute, since it was being >deleted before as a side-effect of an operator-sdk update. It should be >safe to include again. > Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
xiaojiey commented 9 months ago

/hold for test

xiaojiey commented 9 months ago

I think the index image generation is more related with downstream(replace the placeholder version with the last released version) not upstream. I was not able to sqlite-based index image with two CO versions. But I was able to create a file-based index image with two CO versions. I think the final result still depends on how release team will handle the index image.

1, mkdir catalog
2, opm generate dockerfile catalog
3, create catalog-basic-veneer.yaml
$ cat catalog-basic-veneer.yaml 
---
schema: olm.package
name: compliance-operator
defaultChannel: stable
---
schema: olm.channel
package: compliance-operator
name: stable
entries:
- name: compliance-operator.v1.1.0
- name: compliance-operator.v1.2.0
  replaces: compliance-operator.v1.1.0
---
schema: olm.bundle
image: quay.io/xx/compliance-operator-bundle:pr-475
---
schema: olm.bundle
image: registry-proxy.engineering.redhat.com/rh-osbs/openshift-compliance-operator-bundle@sha256:97c96ec2481b95e189074b32837945187b4e350ce5e11902c984ae722ff06c9a
4, Generate index.yaml
opm alpha render-template basic catalog-basic-veneer.yaml -o yaml > catalog/index.yaml

5, validate catalog
opm validate catalog

6, build image
sudo docker buildx build . --push --platform linux/amd64 -f catalog.Dockerfile -t quay.io/xx/compliance-operator-catalog:pr-475

7. Verify the index images:
$ opm alpha list bundles quay.io/xx/compliance-operator-catalog:pr-475 compliance-operator
PACKAGE              CHANNEL  BUNDLE                      REPLACES                    SKIPS  SKIP RANGE  IMAGE
compliance-operator  stable   compliance-operator.v1.1.0                                                 registry-proxy.engineering.redhat.com/rh-osbs/openshift-compliance-operator-bundle@sha256:97c96ec2481b95e189074b32837945187b4e350ce5e11902c984ae722ff06c9a
compliance-operator  stable   compliance-operator.v1.2.0  compliance-operator.v1.1.0                     quay.io/xx/compliance-operator-bundle:pr-475
xiaojiey commented 9 months ago

/unhold

xiaojiey commented 9 months ago

/label qe-approved

openshift-ci-robot commented 9 months ago

@rhmdnd: This pull request references CMP-2176 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target either version "4.16." or "openshift-4.16.", but it targets "compliance-operator-1.4.0" instead.

In response to [this](https://github.com/ComplianceAsCode/compliance-operator/pull/475): >The `replaces` attribute of an operator's CSV helps OLM build >relationships between operators, making it easier for users to install >older versions of an operator (or know which version supercedes the >version they're using). > >This commit reintroduces the `replaces` attribute, since it was being >deleted before as a side-effect of an operator-sdk update. It should be >safe to include again. > Instructions for interacting with me using PR comments are available [here](https://prow.ci.openshift.org/command-help?repo=ComplianceAsCode%2Fcompliance-operator). If you have questions or suggestions related to my behavior, please file an issue against the [openshift-eng/jira-lifecycle-plugin](https://github.com/openshift-eng/jira-lifecycle-plugin/issues/new) repository.
rhmdnd commented 8 months ago

/test e2e-aws-parallel

openshift-ci[bot] commented 8 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: rhmdnd, sheriff-rh, Vincent056

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/ComplianceAsCode/compliance-operator/blob/master/OWNERS)~~ [Vincent056,rhmdnd] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment