Bug 1880501 - Operator teams cannot repush to stage in the pipeline without manual intervention from RCM engineering
Summary: Operator teams cannot repush to stage in the pipeline without manual interven...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.6
Hardware: Unspecified
OS: Unspecified
urgent
urgent
Target Milestone: ---
: 4.6.0
Assignee: lgallett
QA Contact: Jian Zhang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-09-18 17:09 UTC by lgallett
Modified: 2020-10-27 16:43 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-10-27 16:42:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github operator-framework operator-registry pull 448 0 None closed Bug 1880501: Adding overwrite-latest flag to index add 2020-12-01 14:53:13 UTC
Red Hat Product Errata RHBA-2020:4196 0 None None None 2020-10-27 16:43:15 UTC

Description lgallett 2020-09-18 17:09:34 UTC
Description of problem:

Pipeline users have, in the past, been able to re-push to stage should anything in stage fail QE validation. This is not possible today without the help of an RCM engineer manually removing all bundles from stage for that particular package and adding back all the bundles except the one the team is attempting to repush.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 2 Jian Zhang 2020-09-24 09:40:53 UTC
1, Compile the latest opm.
[root@preserve-olm-env operator-registry]# make build
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/appregistry-server ./cmd/appregistry-server
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/configmap-server ./cmd/configmap-server
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/initializer ./cmd/initializer
GOFLAGS="-mod=vendor" go build  -tags "json1" -o bin/registry-server ./cmd/registry-server
GOFLAGS="-mod=vendor" go build -ldflags "-X 'github.com/operator-framework/operator-registry/cmd/opm/version.gitCommit=f634a5a' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.opmVersion=v1.12.5-145-gf634a5a' -X 'github.com/operator-framework/operator-registry/cmd/opm/version.buildDate=2020-09-24T09:07:43Z'"  -tags "json1" -o bin/opm ./cmd/opm

[root@preserve-olm-env operator-registry]# opm version
Version: version.Version{OpmVersion:"v1.12.5-145-gf634a5a", GitCommit:"f634a5a", BuildDate:"2020-09-24T09:07:43Z", GoOs:"linux", GoArch:"amd64"}

2, test without the `--overwrite-latest` flag, it failed as expected.
[root@preserve-olm-env data]# opm index add -b quay.io/olmqe/etcd-bundle:0.9.2-share -f quay.io/olmqe/etcd-index:share -t quay.io/olmqe/etcd-index:share -c docker
INFO[0000] building the index                            bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0000] Pulling previous image quay.io/olmqe/etcd-index:share to get metadata  bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0000] running /usr/bin/docker pull quay.io/olmqe/etcd-index:share  bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0003] running /usr/bin/docker pull quay.io/olmqe/etcd-index:share  bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0003] Getting label data from previous image        bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0003] running docker inspect                        bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0003] running docker create                         bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0004] running docker cp                             bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0004] running docker rm                             bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0004] running /usr/bin/docker pull quay.io/olmqe/etcd-bundle:0.9.2-share  bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0005] running docker create                         bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0005] running docker cp                             bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0005] running docker rm                             bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0006] Could not find optional dependencies file     dir=bundle_tmp118208434 file=bundle_tmp118208434/metadata load=annotations
INFO[0006] found csv, loading bundle                     dir=bundle_tmp118208434 file=bundle_tmp118208434/manifests load=bundle
INFO[0006] loading bundle file                           dir=bundle_tmp118208434/manifests file=etcdbackups.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0006] loading bundle file                           dir=bundle_tmp118208434/manifests file=etcdclusters.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0006] loading bundle file                           dir=bundle_tmp118208434/manifests file=etcdoperator.v0.9.2.clusterserviceversion.yaml load=bundle
INFO[0006] loading bundle file                           dir=bundle_tmp118208434/manifests file=etcdrestores.etcd.database.coreos.com.crd.yaml load=bundle
ERRO[0006] permissive mode disabled                      bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]" error="Bundle already added that provides package and csv"
Error: Bundle already added that provides package and csv
Usage:
  opm index add [flags]

Examples:
...

3, test with the `--overwrite-latest` flag, it works well.
[root@preserve-olm-env data]# opm index add --overwrite-latest -b quay.io/olmqe/etcd-bundle:0.9.2-share -f quay.io/olmqe/etcd-index:share -t quay.io/olmqe/etcd-index:share -c docker 
INFO[0000] building the index                            bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0000] Pulling previous image quay.io/olmqe/etcd-index:share to get metadata  bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0000] running /usr/bin/docker pull quay.io/olmqe/etcd-index:share  bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0000] running /usr/bin/docker pull quay.io/olmqe/etcd-index:share  bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0001] Getting label data from previous image        bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0001] running docker inspect                        bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0001] running docker create                         bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0001] running docker cp                             bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0001] running docker rm                             bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0002] running /usr/bin/docker pull quay.io/olmqe/etcd-bundle:0.9.2-share  bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0002] running docker create                         bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0002] running docker cp                             bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0002] running docker rm                             bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0002] Could not find optional dependencies file     dir=bundle_tmp374992414 file=bundle_tmp374992414/metadata load=annotations
INFO[0002] found csv, loading bundle                     dir=bundle_tmp374992414 file=bundle_tmp374992414/manifests load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp374992414/manifests file=etcdbackups.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp374992414/manifests file=etcdclusters.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp374992414/manifests file=etcdoperator.v0.9.2.clusterserviceversion.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp374992414/manifests file=etcdrestores.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0002] Could not find optional dependencies file     dir=bundle_tmp374992414 file=bundle_tmp374992414/metadata load=annotations
INFO[0002] found csv, loading bundle                     dir=bundle_tmp374992414 file=bundle_tmp374992414/manifests load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp374992414/manifests file=etcdbackups.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp374992414/manifests file=etcdclusters.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp374992414/manifests file=etcdoperator.v0.9.2.clusterserviceversion.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp374992414/manifests file=etcdrestores.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0002] Could not find optional dependencies file     dir=bundle_tmp374992414 file=bundle_tmp374992414/metadata load=annotations
INFO[0002] found csv, loading bundle                     dir=bundle_tmp374992414 file=bundle_tmp374992414/manifests load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp374992414/manifests file=etcdbackups.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp374992414/manifests file=etcdclusters.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp374992414/manifests file=etcdoperator.v0.9.2.clusterserviceversion.yaml load=bundle
INFO[0002] loading bundle file                           dir=bundle_tmp374992414/manifests file=etcdrestores.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0003] Generating dockerfile                         bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0003] writing dockerfile: index.Dockerfile950704396  bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0003] running docker build                          bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"
INFO[0003] [docker build -f index.Dockerfile950704396 -t quay.io/olmqe/etcd-index:share .]  bundles="[quay.io/olmqe/etcd-bundle:0.9.2-share]"

3, But, I'm not sure why we hide this `--overwrite-latest` flag intentionally. For me, I think it's difficult for the user to find this flag if we hide it in the help info. Change the status to ASSIGNED.

[root@preserve-olm-env data]# opm index add --help
Add operator bundles to an index.

 This command will add the given set of bundle images (specified by the --bundles option) to an index image (provided by the --from-index option).

Usage:
  opm index add [flags]

Examples:
  # Create an index image from scratch with a single bundle image
  opm index add --bundles quay.io/operator-framework/operator-bundle-prometheus@sha256:a3ee653ffa8a0d2bbb2fabb150a94da6e878b6e9eb07defd40dc884effde11a0 --tag quay.io/operator-framework/monitoring:1.0.0
  
  # Add a single bundle image to an index image
  opm index add --bundles quay.io/operator-framework/operator-bundle-prometheus:0.15.0 --from-index quay.io/operator-framework/monitoring:1.0.0 --tag quay.io/operator-framework/monitoring:1.0.1
  
  # Add multiple bundles to an index and generate a Dockerfile instead of an image
  opm index add --bundles quay.io/operator-framework/operator-bundle-prometheus:0.15.0,quay.io/operator-framework/operator-bundle-prometheus:0.22.2 --generate

Flags:
  -i, --binary-image opm        container image for on-image opm command
  -u, --build-tool string       tool to build container images. One of: [docker, podman]. Defaults to podman. Overrides part of container-tool.
  -b, --bundles strings         comma separated list of bundles to add
  -c, --container-tool string   tool to interact with container images (save, build, etc.). One of: [docker, podman]
  -f, --from-index string       previous index to add to
      --generate                if enabled, just creates the dockerfile and saves it to local disk
  -h, --help                    help for add
      --mode string             graph update mode that defines how channel graphs are updated. One of: [replaces, semver, semver-skippatch] (default "replaces")
  -d, --out-dockerfile string   if generating the dockerfile, this flag is used to (optionally) specify a dockerfile name
      --permissive              allow registry load errors
  -p, --pull-tool string        tool to pull container images. One of: [none, docker, podman]. Defaults to none. Overrides part of container-tool.
  -t, --tag string              custom tag for container image being built

Global Flags:
      --skip-tls   skip TLS certificate verification for container image registries while pulling bundles or index

Comment 3 lgallett 2020-09-24 13:05:31 UTC
HI @jian thank you for your response. This bug addresses a gap in the release pipeline of operators where operator owners need the ability to overwrite the contents of the stage index image. This flag is only to support the pipeline and is not a flag intended to be widely used as we have a 4.7 enhancement that addresses this use case for the wider users of opm. Given the timeline for 4.6 GA and the urgent need for such a command we could not wait for the enhancement to be implemented. Please let me know if you have more questions - I would like to close this bug asap.

Comment 4 Jian Zhang 2020-09-25 02:51:30 UTC
Hi Lance,

Thanks for you explanation. I got it, verify it based on on comment 2, 3.

Comment 7 errata-xmlrpc 2020-10-27 16:42:58 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


Note You need to log in before you can comment on or make changes to this bug.