Bug 1816535

Summary: No '/build/bin/opm' found in quay.io/operator-framework/upstream-registry-builder image
Product: OpenShift Container Platform Reporter: Jian Zhang <jiazha>
Component: OLMAssignee: Nick Hale <nhale>
OLM sub component: OLM QA Contact: Jian Zhang <jiazha>
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: medium CC: bandrade, ecordell, nhale, yhui
Version: 4.4   
Target Milestone: ---   
Target Release: 4.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1816832 (view as bug list) Environment:
Last Closed: 2020-05-13 22:01:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On: 1816832    
Bug Blocks: 1815761    

Description Jian Zhang 2020-03-24 09:02:25 UTC
Description of problem:
Get the below error when building a index image by using opm:
Step 5/9 : COPY --from=builder /build/bin/opm /opm
COPY failed: stat /var/lib/docker/overlay2/818953ed30b2905534b1e2e8ce18254d84e7cbadee4e60b82c93ff50b9d79067/merged/build/bin/opm: no such file or directory  bundles="[quay.io/jiazha/learn-operator-bundle:v0.0.3]"
Error: error building image: Sending build context to Docker daemon  155.6MB

Version-Release number of selected component (if applicable):
Operator-registry release-4.4 branch

How reproducible:
always

Steps to Reproduce:
1. Build the `opm` binary.
mac:operator-registry jianzhang$ git checkout release-4.4
Switched to branch 'release-4.4'
mac:operator-registry jianzhang$ go build ./cmd/opm

2. Build a bundled image and push it to Quay:
mac:operator-registry jianzhang$ ./opm alpha bundle build -d /Users/jianzhang/goproject/src/github.com/example-inc/learn-operator/manifests/learn/0.0.3 -t quay.io/jiazha/learn-operator-bundle:v0.0.3 --package learn-operator --channels alpha --default alpha --overwrite
...
Successfully tagged quay.io/jiazha/learn-operator-bundle:v0.0.3
mac:operator-registry jianzhang$ docker push quay.io/jiazha/learn-operator-bundle:v0.0.3
The push refers to repository [quay.io/jiazha/learn-operator-bundle]
...

3. Build an index image for it.
mac:operator-registry jianzhang$ ./opm index add -c docker -b quay.io/jiazha/learn-operator-bundle:v0.0.3 -t quay.io/jiazha/learn-operator-index:v0.0.3
...

Actual results:
Get the `no such file or directory` errors:
...
INFO[0011] [docker build -f index.Dockerfile150290223 -t quay.io/jiazha/learn-operator-index:v0.0.3 .]  bundles="[quay.io/jiazha/learn-operator-bundle:v0.0.3]"
ERRO[0016] Sending build context to Docker daemon  155.6MB
Step 1/9 : FROM quay.io/operator-framework/upstream-registry-builder AS builder
 ---> 4dcb7a288493
Step 2/9 : FROM scratch
 ---> 
Step 3/9 : LABEL operators.operatorframework.io.index.database.v1=./index.db
 ---> Running in 3b75867c5fc9
Removing intermediate container 3b75867c5fc9
 ---> 4fa44d294706
Step 4/9 : COPY index_tmp550330798 ./
 ---> 4f6678adcd28
Step 5/9 : COPY --from=builder /build/bin/opm /opm
COPY failed: stat /var/lib/docker/overlay2/818953ed30b2905534b1e2e8ce18254d84e7cbadee4e60b82c93ff50b9d79067/merged/build/bin/opm: no such file or directory  bundles="[quay.io/jiazha/learn-operator-bundle:v0.0.3]"
Error: error building image: Sending build context to Docker daemon  155.6MB
Step 1/9 : FROM quay.io/operator-framework/upstream-registry-builder AS builder
...

Expected results:
It works well.

Additional info:
I tried it with another `opm` image: its tag is v1.6.1, didn't get this `no such file or directory` error, but got other errors: "unexpected EOF".
mac:operator-registry jianzhang$ ./opm index add -c docker -b quay.io/jiazha/learn-operator-bundle:v0.0.3 -t quay.io/jiazha/learn-operator-index:v0.0.3 -i quay.io/operator-framework/upstream-registry-builder:v1.6.1
INFO[0000] building the index                            bundles="[quay.io/jiazha/learn-operator-bundle:v0.0.3]"
INFO[0000] running docker pull                           img="quay.io/jiazha/learn-operator-bundle:v0.0.3"
INFO[0009] running docker save                           img="quay.io/jiazha/learn-operator-bundle:v0.0.3"
INFO[0009] loading Bundle quay.io/jiazha/learn-operator-bundle:v0.0.3  img="quay.io/jiazha/learn-operator-bundle:v0.0.3"
INFO[0009] found annotations file searching for csv      dir=bundle_tmp996601155 file=bundle_tmp996601155/metadata load=annotations
INFO[0009] found csv, loading bundle                     dir=bundle_tmp996601155 file=bundle_tmp996601155/manifests load=bundle
INFO[0009] loading bundle file                           dir=bundle_tmp996601155/manifests file=learn-operator.v0.0.3.clusterserviceversion.yaml load=bundle
INFO[0009] loading bundle file                           dir=bundle_tmp996601155/manifests file=learn.crd.yaml load=bundle
INFO[0009] Generating dockerfile                         bundles="[quay.io/jiazha/learn-operator-bundle:v0.0.3]"
INFO[0009] writing dockerfile: index.Dockerfile432055405  bundles="[quay.io/jiazha/learn-operator-bundle:v0.0.3]"
INFO[0009] running docker build                          bundles="[quay.io/jiazha/learn-operator-bundle:v0.0.3]"
INFO[0009] [docker build -f index.Dockerfile432055405 -t quay.io/jiazha/learn-operator-index:v0.0.3 .]  bundles="[quay.io/jiazha/learn-operator-bundle:v0.0.3]"
ERRO[0182] Sending build context to Docker daemon  155.6MB
Step 1/9 : FROM quay.io/operator-framework/upstream-registry-builder:v1.6.1 AS builder
v1.6.1: Pulling from operator-framework/upstream-registry-builder
c9b1b535fdd9: Pulling fs layer
cbb0d8da1b30: Pulling fs layer
d909eff28200: Pulling fs layer
568dff2a5e9e: Pulling fs layer
0aed2559ef8d: Pulling fs layer
c4142f2a66f9: Pulling fs layer
0d91d5745d3a: Pulling fs layer
32c4492d947e: Pulling fs layer
b1106a2a72ea: Pulling fs layer
489385390664: Pulling fs layer
d649e24c4081: Pulling fs layer
4be42dc69493: Pulling fs layer
3eed18d66c7e: Pulling fs layer
f4f6b7f14702: Pulling fs layer
e63f6cf18835: Pulling fs layer
568dff2a5e9e: Waiting
0aed2559ef8d: Waiting
c4142f2a66f9: Waiting
0d91d5745d3a: Waiting
32c4492d947e: Waiting
b1106a2a72ea: Waiting
489385390664: Waiting
d649e24c4081: Waiting
4be42dc69493: Waiting
3eed18d66c7e: Waiting
f4f6b7f14702: Waiting
e63f6cf18835: Waiting
d909eff28200: Verifying Checksum
d909eff28200: Download complete
error pulling image configuration: Get https://d3uo42mtx6z2cr.cloudfront.net/sha256/bb/bb4715e06ba1f207325076496d77c65d9fd8721860d0b55a6b330821b19ce8b4?Expires=1585030430&Signature=Yd~aBwMmO-csJruCtxW3ZC4omT7jQlbuTXgxUDlryrmmTEFSr9b~ENfgjoxaAqdQXpf93pzkX6FJfhARyPcIrSr3RRNW1I7MmTnZiGz6ZVDUw981nWg97scitQ6Pwfnf5r6XRBHlOieVTrFwMsLxPxhM5hldkgIy9uwF7PoCkhcIO2X5dygSPzzpmyfNdP18O1CXn2FZimA4HDPtiSEFVjSyTgimacMURWhNVG6ntiE72HSV-fnWjyU5Dfv1UgImu1ZC5h~67hicnkBDKUm0dXLqCKxkrLXW1Ovs8sB32p4oaGE-p2A4JZ~OWxtnicsOufp~SLODbAcUw6MsHzPBkQ__&Key-Pair-Id=APKAJ67PQLWGCSP66DGA: unexpected EOF  bundles="[quay.io/jiazha/learn-operator-bundle:v0.0.3]"
Error: error building image: Sending build context to Docker daemon  155.6MB
Step 1/9 : FROM quay.io/operator-framework/upstream-registry-builder:v1.6.1 AS builder
v1.6.1: Pulling from operator-framework/upstream-registry-builder
c9b1b535fdd9: Pulling fs layer
cbb0d8da1b30: Pulling fs layer
d909eff28200: Pulling fs layer
568dff2a5e9e: Pulling fs layer
0aed2559ef8d: Pulling fs layer
c4142f2a66f9: Pulling fs layer
0d91d5745d3a: Pulling fs layer
32c4492d947e: Pulling fs layer
b1106a2a72ea: Pulling fs layer
489385390664: Pulling fs layer
d649e24c4081: Pulling fs layer
4be42dc69493: Pulling fs layer
3eed18d66c7e: Pulling fs layer
f4f6b7f14702: Pulling fs layer
e63f6cf18835: Pulling fs layer
568dff2a5e9e: Waiting
0aed2559ef8d: Waiting
c4142f2a66f9: Waiting
0d91d5745d3a: Waiting
32c4492d947e: Waiting
b1106a2a72ea: Waiting
489385390664: Waiting
d649e24c4081: Waiting
4be42dc69493: Waiting
3eed18d66c7e: Waiting
f4f6b7f14702: Waiting
e63f6cf18835: Waiting
d909eff28200: Verifying Checksum
d909eff28200: Download complete
error pulling image configuration: Get https://d3uo42mtx6z2cr.cloudfront.net/sha256/bb/bb4715e06ba1f207325076496d77c65d9fd8721860d0b55a6b330821b19ce8b4?Expires=1585030430&Signature=Yd~aBwMmO-csJruCtxW3ZC4omT7jQlbuTXgxUDlryrmmTEFSr9b~ENfgjoxaAqdQXpf93pzkX6FJfhARyPcIrSr3RRNW1I7MmTnZiGz6ZVDUw981nWg97scitQ6Pwfnf5r6XRBHlOieVTrFwMsLxPxhM5hldkgIy9uwF7PoCkhcIO2X5dygSPzzpmyfNdP18O1CXn2FZimA4HDPtiSEFVjSyTgimacMURWhNVG6ntiE72HSV-fnWjyU5Dfv1UgImu1ZC5h~67hicnkBDKUm0dXLqCKxkrLXW1Ovs8sB32p4oaGE-p2A4JZ~OWxtnicsOufp~SLODbAcUw6MsHzPBkQ__&Key-Pair-Id=APKAJ67PQLWGCSP66DGA: unexpected EOF
. exit status 1
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
  -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] (default "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
  -d, --out-dockerfile string   if generating the dockerfile, this flag is used to (optionally) specify a dockerfile name
      --permissive              allow registry load errors
  -t, --tag string              custom tag for container image being built

Comment 3 Jian Zhang 2020-04-03 10:23:30 UTC
Build the `opm` with the release-4.4 branch. It works well when using the default builder image. LGTM, verify it.
mac:operator-registry jianzhang$ ./opm index add -c docker -b quay.io/olmqe/etcd-bundle:0.9.0 -t quay.io/olmqe/etcd-index:0.9.0
INFO[0000] building the index                            bundles="[quay.io/olmqe/etcd-bundle:0.9.0]"
INFO[0000] running docker pull                           img="quay.io/olmqe/etcd-bundle:0.9.0"
INFO[0006] running docker save                           img="quay.io/olmqe/etcd-bundle:0.9.0"
INFO[0006] loading Bundle quay.io/olmqe/etcd-bundle:0.9.0  img="quay.io/olmqe/etcd-bundle:0.9.0"
INFO[0006] found annotations file searching for csv      dir=bundle_tmp475374827 file=bundle_tmp475374827/metadata load=annotations
INFO[0006] found csv, loading bundle                     dir=bundle_tmp475374827 file=bundle_tmp475374827/manifests load=bundle
INFO[0006] loading bundle file                           dir=bundle_tmp475374827/manifests file=etcdbackups.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0006] loading bundle file                           dir=bundle_tmp475374827/manifests file=etcdclusters.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0006] loading bundle file                           dir=bundle_tmp475374827/manifests file=etcdoperator.v0.9.0.clusterserviceversion.yaml load=bundle
INFO[0006] loading bundle file                           dir=bundle_tmp475374827/manifests file=etcdrestores.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0006] Generating dockerfile                         bundles="[quay.io/olmqe/etcd-bundle:0.9.0]"
INFO[0006] writing dockerfile: index.Dockerfile085677141  bundles="[quay.io/olmqe/etcd-bundle:0.9.0]"
INFO[0006] running docker build                          bundles="[quay.io/olmqe/etcd-bundle:0.9.0]"
INFO[0006] [docker build -f index.Dockerfile085677141 -t quay.io/olmqe/etcd-index:0.9.0 .]  bundles="[quay.io/olmqe/etcd-bundle:0.9.0]"

Comment 5 errata-xmlrpc 2020-05-13 22:01:28 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, 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:0581