Skip to content

Conversation

@adellape
Copy link
Contributor

@adellape adellape commented Mar 26, 2021

@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 26, 2021
@netlify
Copy link

netlify bot commented Mar 26, 2021

Deploy preview for osdocs ready!

Built with commit 65d1f31

https://deploy-preview-31013--osdocs.netlify.app

@adellape adellape added this to the Next Release milestone Mar 26, 2021
@adellape adellape force-pushed the prune_img_fix branch 2 times, most recently from 24ec038 to 9b6fbe0 Compare March 26, 2021 17:09
@adellape adellape changed the title Fix opm prune -i registry image BZ#1943150: Fix opm prune -i registry image Mar 26, 2021
Copy link
Contributor

@jeana-redhat jeana-redhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One tiny food for thought, LGTM tho

@kuiwang02
Copy link

@adellape I try the upstream and downstream because you set registry-image with different value for upstream and downstream.

For downstream, the command works.

[root@preserve-olm-env operator-registry]#opm index prune -f registry.redhat.io/redhat/redhat-operator-index:v4.7 -p advanced-cluster-management -i registry.redhat.io/openshift4/ose-operator-registry:v4.7 -t quay.io/kuiwang/roi-index:v4.7
INFO[0000] pruning the index                             packages="[advanced-cluster-management]"
INFO[0000] Pulling previous image registry.redhat.io/redhat/redhat-operator-index:v4.7 to get metadata  packages="[advanced-cluster-management]"
INFO[0000] running /usr/bin/podman pull registry.redhat.io/redhat/redhat-operator-index:v4.7  packages="[advanced-cluster-management]"
INFO[0001] running /usr/bin/podman pull registry.redhat.io/redhat/redhat-operator-index:v4.7  packages="[advanced-cluster-management]"
INFO[0002] Getting label data from previous image        packages="[advanced-cluster-management]"
INFO[0002] running podman inspect                        packages="[advanced-cluster-management]"
INFO[0003] running podman create                         packages="[advanced-cluster-management]"
INFO[0003] running podman cp                             packages="[advanced-cluster-management]"
INFO[0008] running podman rm                             packages="[advanced-cluster-management]"
INFO[0009] deleting packages                             pkg=3scale-operator
INFO[0009] packages: [3scale-operator]                   pkg=3scale-operator
INFO[0010] deleting packages                             pkg=amq-broker
INFO[0010] packages: [amq-broker]                        pkg=amq-broker
INFO[0010] deleting packages                             pkg=amq-broker-lts
INFO[0010] packages: [amq-broker-lts]                    pkg=amq-broker-lts
INFO[0010] deleting packages                             pkg=amq-online
INFO[0010] packages: [amq-online]                        pkg=amq-online
...
INFO[0014] deleting packages                             pkg=web-terminal
INFO[0014] packages: [web-terminal]                      pkg=web-terminal
INFO[0014] deleting packages                             pkg=windows-machine-config-operator
INFO[0014] packages: [windows-machine-config-operator]   pkg=windows-machine-config-operator
INFO[0014] Generating dockerfile                         packages="[advanced-cluster-management]"
INFO[0014] writing dockerfile: index.Dockerfile232098483  packages="[advanced-cluster-management]"
INFO[0014] running podman build                          packages="[advanced-cluster-management]"
INFO[0014] [podman build --format docker -f index.Dockerfile232098483 -t quay.io/kuiwang/roi-index:v4.7 .]  packages="[advanced-cluster-management]"

But when I check the draft doc https://deploy-preview-31013--osdocs.netlify.app/openshift-enterprise/latest/operators/admin/olm-restricted-networks.html#olm-pruning-index-image_olm-restricted-networks, I find the command is the following

$ opm index prune \
    -f registry.redhat.io/redhat/redhat-operator-index:vBranch Build \
    -p advanced-cluster-management,jaeger-product,quay-operator \
    [-i registry.redhat.io/openshift4/ose-operator-registry:v4.7] \
    -t <target_registry>:<port>/<namespace>/redhat-operator-index:vBranch Build 

There is vBranch Build. It seem the variable is not replaced.

For upstream, the command does not work because the quay.io/operator-framework/upstream-community-operators:latest seems has problem

[root@preserve-olm-env operator-registry]# opm index prune -f quay.io/operator-framework/upstream-community-operators:latest -p etcd -i quay.io/openshift/origin-operator-registry:4.7.0 -t quay.io/kuiwang/community-index:v4.7
INFO[0000] pruning the index                             packages="[etcd]"
INFO[0000] Pulling previous image quay.io/operator-framework/upstream-community-operators:latest to get metadata  packages="[etcd]"
INFO[0000] running /usr/bin/podman pull quay.io/operator-framework/upstream-community-operators:latest  packages="[etcd]"
INFO[0001] running /usr/bin/podman pull quay.io/operator-framework/upstream-community-operators:latest  packages="[etcd]"
INFO[0002] Getting label data from previous image        packages="[etcd]"
INFO[0002] running podman inspect                        packages="[etcd]"
Error: index image quay.io/operator-framework/upstream-community-operators:latest missing label operators.operatorframework.io.index.database.v1
Usage:
  opm index prune [flags]

Flags:
  -i, --binary-image opm        container image for on-image opm command
  -c, --container-tool string   tool to interact with container images (save, build, etc.). One of: [docker, podman] (default "podman")
  -f, --from-index string       index to prune
      --generate                if enabled, just creates the dockerfile and saves it to local disk
  -h, --help                    help for prune
  -d, --out-dockerfile string   if generating the dockerfile, this flag is used to (optionally) specify a dockerfile name
  -p, --packages strings        comma separated list of packages to keep
      --permissive              allow registry load errors
  -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

[root@preserve-olm-env operator-registry]# 

@adellape
Copy link
Contributor Author

@kuiwang02 Thanks for reviewing. The "Branch Build" part is just in the preview build. It will get replaced with the version for the related branch (for example 4.7 for enterprise-4.7) in the published version after it's cherry picked.

I'll check out the other tags for the upstream image.

@kuiwang02
Copy link

@adellape OK, got it. Thanks.
wait for the new updated.

@adellape
Copy link
Contributor Author

@kuiwang02 I've checked with the Operator Framework team and confirmed the upstream index image should be quay.io/operatorhubio/catalog:latest. I've updated this PR to reflect that for the OKD version of the docs.

$ opm index prune -f quay.io/operatorhubio/catalog:latest -p etcd -i quay.io/openshift/origin-operator-registry:4.7.0 -t quay.io/adellape/catalog:v4.7
INFO[0000] pruning the index                             packages="[etcd]"
INFO[0000] Pulling previous image quay.io/operatorhubio/catalog:latest to get metadata  packages="[etcd]"
INFO[0000] running /usr/bin/podman pull quay.io/operatorhubio/catalog:latest  packages="[etcd]"
INFO[0001] running /usr/bin/podman pull quay.io/operatorhubio/catalog:latest  packages="[etcd]"
INFO[0003] Getting label data from previous image        packages="[etcd]"
INFO[0003] running podman inspect                        packages="[etcd]"
INFO[0003] running podman create                         packages="[etcd]"
INFO[0004] running podman cp                             packages="[etcd]"
INFO[0004] running podman rm                             packages="[etcd]"
...
INFO[0018] Generating dockerfile                         packages="[etcd]"
INFO[0018] writing dockerfile: index.Dockerfile902679728  packages="[etcd]"
INFO[0018] running podman build                          packages="[etcd]"
INFO[0018] [podman build --format docker -f index.Dockerfile902679728 -t quay.io/adellape/catalog:v4.7 .]  packages="[etcd]"

@kuiwang02
Copy link

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 31, 2021
@adellape adellape merged commit 471da24 into openshift:master Mar 31, 2021
@adellape adellape deleted the prune_img_fix branch March 31, 2021 21:44
@adellape adellape added peer-review-done Signifies that the peer review team has reviewed this PR and removed peer-review-needed Signifies that the peer review team needs to review this PR labels Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

branch/enterprise-4.6 branch/enterprise-4.7 branch/enterprise-4.8 lgtm Indicates that a PR is ready to be merged. peer-review-done Signifies that the peer review team has reviewed this PR size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants