Bug 1827979 - opm index add does not work for release 4.4
Summary: opm index add does not work for release 4.4
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.4
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
: 4.5.0
Assignee: Evan Cordell
QA Contact: kuiwang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-26 06:07 UTC by kuiwang
Modified: 2020-05-19 06:37 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-18 20:06:25 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description kuiwang 2020-04-26 06:07:50 UTC
Description of problem:
when I take opm index add make bundle index image, it fails at "
Error parsing reference: "quay.io/operator-framework/upstream-registry-builder AS builder" is not a valid repository/tag: invalid reference format"

Version-Release number of selected component (if applicable):
the opm is built with latest of release-4.4 branch
--
[root@preserve-olm-env operator-registry]# git branch
  master
* release-4.4
[root@preserve-olm-env operator-registry]# git log
commit ea5c9281cbe897db887e6d0986e62088b2e3bc25
Merge: bde4c90 d526580
Author: OpenShift Merge Robot <openshift-merge-robot.github.com>
Date:   Thu Apr 2 11:35:42 2020 +0200
 
    Merge pull request #225 from openshift-cherrypick-robot/cherry-pick-173-to-release-4.4
   
    [release-4.4] Bug 1816535: fix(index): copy correct opm bin builder path
--

How reproducible:


Steps to Reproduce:
1. make etcd-bundle:0.9.0 and push it to quay
opm alpha bundle build -d /root/kuiwang/community-operators/community-operators/etcd/0.9.0 -t quay.io/kuiwang/etcd-bundle:0.9.0 -c alpha -p etcd
docker push quay.io/kuiwang/etcd-bundle:0.9.0
2. make etcd-bundle:0.9.2 and push it to quay
opm alpha bundle build -d /root/kuiwang/community-operators/community-operators/etcd/0.9.2 -t quay.io/kuiwang/etcd-bundle:0.9.2 -c alpha -p etcd
docker push quay.io/kuiwang/etcd-bundle:0.9.2

3. make etcd-index:0.9.0
opm index add -b quay.io/kuiwang/etcd-bundle:0.9.0 -t quay.io/kuiwang/etcd-index:0.9.0 -c docker
Note: I ever tried to input base image with "-i" option, like -i quay.io/operator-framework/upstream-registry-builder:4.4, -i quay.io/operator-framework/upstream-registry-builder:latest, -i quay.io/operator-framework/upstream-opm-builder:latest and -i quay.io/operator-framework/upstream-opm-builder. All are same error.


Actual results:
Error parsing reference: "quay.io/operator-framework/upstream-registry-builder AS builder" is not a valid repository/tag: invalid reference format  bundles="[quay.io/kuiwang/etcd-bundle:0.9.0]"
Error: error building image: Sending build context to Docker daemon   256 kB
Step 1/9 : FROM quay.io/operator-framework/upstream-registry-builder AS builder
Error parsing reference: "quay.io/operator-framework/upstream-registry-builder AS builder" is not a valid repository/tag: invalid reference format
. exit status 1

Expected results:
the index image is generated correctly.


Additional info:
For the detailed info, please refer to the following:
[root@preserve-olm-env operator-registry]# rm -fr opm
[root@preserve-olm-env operator-registry]# git branch
  master
* release-4.4
[root@preserve-olm-env operator-registry]# git log
commit ea5c9281cbe897db887e6d0986e62088b2e3bc25
Merge: bde4c90 d526580
Author: OpenShift Merge Robot <openshift-merge-robot.github.com>
Date:   Thu Apr 2 11:35:42 2020 +0200
 
    Merge pull request #225 from openshift-cherrypick-robot/cherry-pick-173-to-release-4.4
   
    [release-4.4] Bug 1816535: fix(index): copy correct opm bin builder path
 
commit d52658035a349ed6b287f98c7012084117298553
Author: njhale <njohnhale>
Date:   Wed Feb 5 14:50:41 2020 -0500
 
    fix(index): copy correct opm bin builder path
 
commit bde4c90f44c0f175a9341f2370e2a5876b5070b5
Merge: 5e1fffd 64a607c
Author: OpenShift Merge Robot <openshift-merge-robot.github.com>
Date:   Mon Feb 24 19:40:43 2020 +0100
 
    Merge pull request #192 from openshift-cherrypick-robot/cherry-pick-189-to-release-4.4
   
    Bug 1806529: [release-4.4] Produce binaries without target platform prefixes by default.
 
commit 64a607cfb8f34999de3452357a8b14eaac274dff
Author: Ben Luddy <bluddy>
Date:   Fri Feb 21 19:05:58 2020 -0500
 
    Produce binaries without target platform prefixes by default.
   
    This is aimed at fixing downstream image builds targeting non-amd64
    architectures.
 
commit 5e1fffdee0add67e39c3ecde8801c7e1b247cf70
Merge: 0652a72 3ffc82b
Author: OpenShift Merge Robot <openshift-merge-robot.github.com>
Date:   Thu Feb 20 20:18:05 2020 -0500
 
    Merge pull request #184 from openshift-cherrypick-robot/cherry-pick-183-to-release-4.4
   
    [release-4.4] Bug 1805409: fix(docker): add entrypoint
 
commit 3ffc82b7d1bdedc67834494eeafa1873d192af9e
Author: Evan <cordell.evan>
Date:   Thu Feb 20 12:03:49 2020 -0500
 
    fix(docker): add entrypoint
 
commit 0652a729aa32fc5b217cbddb11ea7c90af1532da
Merge: e517d18 147c4b8
Author: OpenShift Merge Robot <openshift-merge-robot.github.com>
Date:   Fri Jan 31 09:00:42 2020 -0800
 
[root@preserve-olm-env operator-registry]# go build ./cmd/opm/
[root@preserve-olm-env operator-registry]# cd -
/root/kuiwang/community-operators/community-operators/etcd/0.9.0
[root@preserve-olm-env 0.9.0]# cd ..
[root@preserve-olm-env etcd]# opm alpha bundle build -d /root/kuiwang/community-operators/community-operators/etcd/0.9.0 -t quay.io/kuiwang/etcd-bundle:0.9.0 -c alpha -p etcd
INFO[0000] Building annotations.yaml                    
INFO[0000] Building Dockerfile                          
INFO[0000] Building bundle image                        
Sending build context to Docker daemon 24.58 kB
Step 1/9 : FROM scratch
 --->
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1 registry+v1
 ---> Running in 904d74e138a4
 ---> 6ece31d211ea
Removing intermediate container 904d74e138a4
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1 manifests/
 ---> Running in f56f1d4e1b80
 ---> 5bba6e62fb5f
Removing intermediate container f56f1d4e1b80
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1 metadata/
 ---> Running in bfba80eb8e55
 ---> 0e279c33d13e
Removing intermediate container bfba80eb8e55
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1 etcd
 ---> Running in 695d22fa606c
 ---> 0d6f7e2b23ef
Removing intermediate container 695d22fa606c
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1 alpha
 ---> Running in d16342b76fc9
 ---> 0a20cbdd885c
Removing intermediate container d16342b76fc9
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1 alpha
 ---> Running in aa2aa270e404
 ---> 28e4bba460bb
Removing intermediate container aa2aa270e404
Step 8/9 : COPY /*.yaml /manifests/
 ---> fe4be487d4b8
Removing intermediate container 096766f6702b
Step 9/9 : COPY /metadata/annotations.yaml /metadata/annotations.yaml
 ---> aeb3b76a6993
Removing intermediate container a20cfd139680
Successfully built aeb3b76a6993
[root@preserve-olm-env etcd]# cat 0.9.0/Dockerfile
FROM scratch
 
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=etcd
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
 
COPY /*.yaml /manifests/
COPY /metadata/annotations.yaml /metadata/annotations.yaml
[root@preserve-olm-env etcd]# cat 0.9.0/metadata/annotations.yaml
annotations:
  operators.operatorframework.io.bundle.channel.default.v1: alpha
  operators.operatorframework.io.bundle.channels.v1: alpha
  operators.operatorframework.io.bundle.manifests.v1: manifests/
  operators.operatorframework.io.bundle.mediatype.v1: registry+v1
  operators.operatorframework.io.bundle.metadata.v1: metadata/
  operators.operatorframework.io.bundle.package.v1: etcd
[root@preserve-olm-env etcd]# docker push quay.io/kuiwang/etcd-bundle:0.9.0
The push refers to a repository [quay.io/kuiwang/etcd-bundle]
3f4fe714a03e: Pushed
96d99bb27d0e: Pushed
0.9.0: digest: sha256:f86e009451518766c237a3421ec40a95120979659ef5f9ca73463e04292d1f40 size: 732
[root@preserve-olm-env etcd]#
[root@preserve-olm-env etcd]# opm alpha bundle build -d /root/kuiwang/community-operators/community-operators/etcd/0.9.2 -t quay.io/kuiwang/etcd-bundle:0.9.2 -c alpha -p etcd
INFO[0000] Building annotations.yaml                    
INFO[0000] Building Dockerfile                          
INFO[0000] Building bundle image                        
Sending build context to Docker daemon  25.6 kB
Step 1/9 : FROM scratch
 --->
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1 registry+v1
 ---> Using cache
 ---> 6ece31d211ea
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1 manifests/
 ---> Using cache
 ---> 5bba6e62fb5f
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1 metadata/
 ---> Using cache
 ---> 0e279c33d13e
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1 etcd
 ---> Using cache
 ---> 0d6f7e2b23ef
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1 alpha
 ---> Using cache
 ---> 0a20cbdd885c
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1 alpha
 ---> Using cache
 ---> 28e4bba460bb
Step 8/9 : COPY /*.yaml /manifests/
 ---> 5edc6e0ff33a
Removing intermediate container abbb4cd25206
Step 9/9 : COPY /metadata/annotations.yaml /metadata/annotations.yaml
 ---> eb9d141e09a3
Removing intermediate container a65fe8fb4b7c
Successfully built eb9d141e09a3
[root@preserve-olm-env etcd]# cat 0.9.2/Dockerfile
FROM scratch
 
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=etcd
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
 
COPY /*.yaml /manifests/
COPY /metadata/annotations.yaml /metadata/annotations.yaml
[root@preserve-olm-env etcd]# cat 0.9.2/metadata/annotations.yaml
annotations:
  operators.operatorframework.io.bundle.channel.default.v1: alpha
  operators.operatorframework.io.bundle.channels.v1: alpha
  operators.operatorframework.io.bundle.manifests.v1: manifests/
  operators.operatorframework.io.bundle.mediatype.v1: registry+v1
  operators.operatorframework.io.bundle.metadata.v1: metadata/
  operators.operatorframework.io.bundle.package.v1: etcd
[root@preserve-olm-env etcd]# docker push quay.io/kuiwang/etcd-bundle:0.9.2
The push refers to a repository [quay.io/kuiwang/etcd-bundle]
8845247622af: Pushed
422930b056ac: Pushed
0.9.2: digest: sha256:133025a24e6375b28899cbefd50154065fdf6f140c80931b82ae1dab55b0d6c8 size: 732
[root@preserve-olm-env etcd]# opm index add -b quay.io/kuiwang/etcd-bundle:0.9.0 -t quay.io/kuiwang/etcd-index:0.9.0 -c docker
INFO[0000] building the index                            bundles="[quay.io/kuiwang/etcd-bundle:0.9.0]"
INFO[0000] running docker pull                           img="quay.io/kuiwang/etcd-bundle:0.9.0"
INFO[0000] running docker save                           img="quay.io/kuiwang/etcd-bundle:0.9.0"
INFO[0000] loading Bundle quay.io/kuiwang/etcd-bundle:0.9.0  img="quay.io/kuiwang/etcd-bundle:0.9.0"
INFO[0000] found annotations file searching for csv      dir=bundle_tmp343745937 file=bundle_tmp343745937/metadata load=annotations
INFO[0000] skipping hidden file                          dir=bundle_tmp343745937 file=.wh..wh..opq find=csv
INFO[0000] found csv, loading bundle                     dir=bundle_tmp343745937 file=bundle_tmp343745937/manifests load=bundle
INFO[0000] skipping hidden file                          dir=bundle_tmp343745937/manifests file=.wh..wh..opq load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp343745937/manifests file=etcdbackups.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp343745937/manifests file=etcdclusters.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp343745937/manifests file=etcdoperator.v0.9.0.clusterserviceversion.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp343745937/manifests file=etcdrestores.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0000] Generating dockerfile                         bundles="[quay.io/kuiwang/etcd-bundle:0.9.0]"
INFO[0000] writing dockerfile: index.Dockerfile804088811  bundles="[quay.io/kuiwang/etcd-bundle:0.9.0]"
INFO[0000] running docker build                          bundles="[quay.io/kuiwang/etcd-bundle:0.9.0]"
INFO[0000] [docker build -f index.Dockerfile804088811 -t quay.io/kuiwang/etcd-index:0.9.0 .]  bundles="[quay.io/kuiwang/etcd-bundle:0.9.0]"
ERRO[0000] Sending build context to Docker daemon   256 kB
Step 1/9 : FROM quay.io/operator-framework/upstream-registry-builder AS builder
Error parsing reference: "quay.io/operator-framework/upstream-registry-builder AS builder" is not a valid repository/tag: invalid reference format  bundles="[quay.io/kuiwang/etcd-bundle:0.9.0]"
Error: error building image: Sending build context to Docker daemon   256 kB
Step 1/9 : FROM quay.io/operator-framework/upstream-registry-builder AS builder
Error parsing reference: "quay.io/operator-framework/upstream-registry-builder AS builder" is not a valid repository/tag: invalid reference format
. 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 6 Ben Luddy 2020-04-27 19:13:06 UTC
> "quay.io/operator-framework/upstream-registry-builder AS builder" is not a valid repository/tag

This sounds like a problem with parsing multi-stage FROM. What version of Docker is installed on your machine? Docker client and daemon versions 17.05 are the earliest that support multi-stage builds.

Comment 7 kuiwang 2020-04-28 00:42:12 UTC
Hi Bluddy,

 here is the version of docker:
--
[root@preserve-olm-env bin]# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-161.git64e9980.el7_8.x86_64
 Go version:      go1.10.3
 Git commit:      64e9980/1.13.1
 Built:           Tue Mar  3 09:15:29 2020
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-161.git64e9980.el7_8.x86_64
 Go version:      go1.10.3
 Git commit:      64e9980/1.13.1
 Built:           Tue Mar  3 09:15:29 2020
 OS/Arch:         linux/amd64
 Experimental:    false
--

But it maybe is not related to multi-stage FROM because the opm 4.5 has not this issue and its Docker file is the following which includes "FROM quay.io/operator-framework/upstream-opm-builder AS builder"

the docker file of 4.5
--
FROM quay.io/operator-framework/upstream-opm-builder AS builder

FROM scratch
LABEL operators.operatorframework.io.index.database.v1=./index.db
COPY database ./
COPY --from=builder /bin/opm /opm
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
EXPOSE 50051
ENTRYPOINT ["/opm"]
CMD ["registry", "serve", "--database", "index.db"]
--

the docker file of 4.4.
--
FROM quay.io/operator-framework/upstream-registry-builder AS builder

FROM scratch
LABEL operators.operatorframework.io.index.database.v1=./index.db
COPY database ./
COPY --from=builder /build/bin/opm /opm
COPY --from=builder /bin/grpc_health_probe /bin/grpc_health_probe
EXPOSE 50051
ENTRYPOINT ["/opm"]
CMD ["registry", "serve", "--database", "index.db"]
--

Comment 8 Evan Cordell 2020-05-07 14:46:22 UTC
I think we want to check a couple of things:

- does the downstream opm (found in the operator-registy image in the release payload) for 4.4 have a similar issue?
- do we need docs for a dev preview feature? if so, they should indicate that you should use `opm index` commands with a `--binary-image` flag to use downstream base images, not the upstream-registry-builder mentioned here.

Comment 9 kuiwang 2020-05-08 09:10:58 UTC
HI Evan,

  There is a same issue. With downstream opm, I tried both with "-i" to use downstream base image (./opm index add -b quay.io/kuiwang/etcd-bundle:vd0.9.0 -t quay.io/kuiwang/etcd-index:vd0.9.0 -c docker -i registry.redhat.io/openshift4/ose-operator-registry:v4.4)
and without "-i" to use default base image (./opm index add -b quay.io/kuiwang/etcd-bundle:vd0.9.0 -t quay.io/kuiwang/etcd-index:vd0.9.0 -c docker).
  Both met same issue.

here is the detailed:
[root@preserve-olm-env opm-4.4]# ./opm alpha bundle build -d /root/kuiwang/community-operators/community-operators/etcd/0.9.0 -t quay.io/kuiwang/etcd-bundle:vd0.9.0 -c alpha -p etcd
INFO[0000] Building annotations.yaml                    
INFO[0000] Building Dockerfile                          
INFO[0000] Building bundle image                        
Sending build context to Docker daemon 24.58 kB
Step 1/9 : FROM scratch
 ---> 
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1 registry+v1
 ---> Using cache
 ---> 8cd96a9c7aca
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1 manifests/
 ---> Using cache
 ---> e7c240c1844f
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1 metadata/
 ---> Using cache
 ---> ad55f2fbedf2
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1 etcd
 ---> Using cache
 ---> 59fe7bbeef05
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1 alpha
 ---> Using cache
 ---> 536fa6b051ee
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1 alpha
 ---> Using cache
 ---> dba69940246d
Step 8/9 : COPY /*.yaml /manifests/
 ---> 7994b59b802a
Removing intermediate container 334a4d1d806e
Step 9/9 : COPY /metadata/annotations.yaml /metadata/annotations.yaml
 ---> d7836b6b382b
Removing intermediate container 54551ebc8255
Successfully built d7836b6b382b
[root@preserve-olm-env opm-4.4]# docker image ls
REPOSITORY                                                                      TAG                 IMAGE ID            CREATED             SIZE
quay.io/kuiwang/etcd-bundle                                                     vd0.9.0             d7836b6b382b        12 seconds ago      18.4 kB
registry-proxy.engineering.redhat.com/rh-osbs/openshift-ose-operator-registry   v4.4                84f22f20211e        12 hours ago        446 MB
quay.io/yuhui12/etcd-index                                                      0.9.0               e4f7ca8289fd        25 hours ago        57 MB
registry-proxy.engineering.redhat.com/etcd/etcd-index                           0.9.0               e4f7ca8289fd        25 hours ago        57 MB
quay.io/yuhui12/etcd-bundle                                                     0.9.0               29c4a0adedee        26 hours ago        18.4 kB
localhost:5000/jiazha/upstream-opm-builder                                      latest              6ff688cecdcc        6 days ago          56.8 MB
quay.io/jiazha/upstream-opm-builder                                             v1                  6ff688cecdcc        6 days ago          56.8 MB
quay.io/olm/upstream-opm-builder                                                latest              6ff688cecdcc        6 days ago          56.8 MB
quay.io/olm/upstream-opm-builder                                                v1                  6ff688cecdcc        6 days ago          56.8 MB
quay.io/operator-framework/upstream-opm-builder                                 latest              6ff688cecdcc        6 days ago          56.8 MB
quay.io/operator-framework/upstream-opm-builder                                 <none>              f8275c28458d        8 days ago          56.8 MB
quay.io/kuiwang/etcd-bundle                                                     1826766             9a74e5122324        8 days ago          18.6 kB
registry.redhat.io/openshift4/ose-operator-registry                             v4.4                e0a9eca3cd52        11 days ago         443 MB
registry.redhat.io/openshift4/ose-cluster-logging-operator                      <none>              1330878bdb26        3 weeks ago         309 MB
docker.io/registry                                                              latest              708bc6af7e5e        3 months ago        25.8 MB
[root@preserve-olm-env opm-4.4]# docker login quay.io
Username: kuiwang
Password: 
Login Succeeded
[root@preserve-olm-env opm-4.4]# docker push quay.io/kuiwang/etcd-bundle:vd0.9.0
The push refers to a repository [quay.io/kuiwang/etcd-bundle]
5763a6dea0ac: Pushed 
b0037be7b6fc: Pushed 
vd0.9.0: digest: sha256:a94fe55e8050dd6b0ee4055c5bbe873da6cad174e2ae50046b4d7e625f04b2f1 size: 732
[root@preserve-olm-env opm-4.4]# ./opm alpha bundle build -d /root/kuiwang/community-operators/community-operators/etcd/0.9.2 -t quay.io/kuiwang/etcd-bundle:vd0.9.2 -c alpha -p etcd
INFO[0000] Building annotations.yaml                    
INFO[0000] Building Dockerfile                          
INFO[0000] Building bundle image                        
Sending build context to Docker daemon  25.6 kB
Step 1/9 : FROM scratch
 ---> 
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1 registry+v1
 ---> Using cache
 ---> 8cd96a9c7aca
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1 manifests/
 ---> Using cache
 ---> e7c240c1844f
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1 metadata/
 ---> Using cache
 ---> ad55f2fbedf2
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1 etcd
 ---> Using cache
 ---> 59fe7bbeef05
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1 alpha
 ---> Using cache
 ---> 536fa6b051ee
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1 alpha
 ---> Using cache
 ---> dba69940246d
Step 8/9 : COPY /*.yaml /manifests/
 ---> 8dbee2cbbfef
Removing intermediate container 807ec50da73a
Step 9/9 : COPY /metadata/annotations.yaml /metadata/annotations.yaml
 ---> c00f93179d60
Removing intermediate container c639c4d9d279
Successfully built c00f93179d60
[root@preserve-olm-env opm-4.4]# docker push quay.io/kuiwang/etcd-bundle:vd0.9.2
The push refers to a repository [quay.io/kuiwang/etcd-bundle]
2eace7a12c45: Pushed 
01f052e45af7: Pushed 
vd0.9.2: digest: sha256:2d8640ae199f1c3ef7c2d73f1286914107fe8c4b122a22e2c07d2f47e438bd32 size: 732
[root@preserve-olm-env opm-4.4]# ./opm index add -b quay.io/kuiwang/etcd-bundle:vd0.9.0 -t quay.io/kuiwang/etcd-index:vd0.9.0 -c docker
INFO[0000] building the index                            bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
INFO[0000] running docker pull                           img="quay.io/kuiwang/etcd-bundle:vd0.9.0"
INFO[0000] running docker save                           img="quay.io/kuiwang/etcd-bundle:vd0.9.0"
INFO[0000] loading Bundle quay.io/kuiwang/etcd-bundle:vd0.9.0  img="quay.io/kuiwang/etcd-bundle:vd0.9.0"
INFO[0000] found annotations file searching for csv      dir=bundle_tmp291332300 file=bundle_tmp291332300/metadata load=annotations
INFO[0000] skipping hidden file                          dir=bundle_tmp291332300 file=.wh..wh..opq find=csv
INFO[0000] found csv, loading bundle                     dir=bundle_tmp291332300 file=bundle_tmp291332300/manifests load=bundle
INFO[0000] skipping hidden file                          dir=bundle_tmp291332300/manifests file=.wh..wh..opq load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp291332300/manifests file=etcdbackups.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp291332300/manifests file=etcdclusters.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp291332300/manifests file=etcdoperator.v0.9.0.clusterserviceversion.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp291332300/manifests file=etcdrestores.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0000] Generating dockerfile                         bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
INFO[0000] writing dockerfile: index.Dockerfile954269150  bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
INFO[0000] running docker build                          bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
INFO[0000] [docker build -f index.Dockerfile954269150 -t quay.io/kuiwang/etcd-index:vd0.9.0 .]  bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
ERRO[0001] Sending build context to Docker daemon 49.39 MB
Step 1/9 : FROM quay.io/operator-framework/upstream-registry-builder AS builder
Error parsing reference: "quay.io/operator-framework/upstream-registry-builder AS builder" is not a valid repository/tag: invalid reference format  bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
Error: error building image: Sending build context to Docker daemon 49.39 MB
Step 1/9 : FROM quay.io/operator-framework/upstream-registry-builder AS builder
Error parsing reference: "quay.io/operator-framework/upstream-registry-builder AS builder" is not a valid repository/tag: invalid reference format
. 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

[root@preserve-olm-env opm-4.4]# ./opm index add -b quay.io/kuiwang/etcd-bundle:vd0.9.0 -t quay.io/kuiwang/etcd-index:vd0.9.0 -c docker -i registry.redhat.io/openshift4/ose-operator-registry:v4.4
INFO[0000] building the index                            bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
INFO[0000] running docker pull                           img="quay.io/kuiwang/etcd-bundle:vd0.9.0"
INFO[0000] running docker save                           img="quay.io/kuiwang/etcd-bundle:vd0.9.0"
INFO[0000] loading Bundle quay.io/kuiwang/etcd-bundle:vd0.9.0  img="quay.io/kuiwang/etcd-bundle:vd0.9.0"
INFO[0000] found annotations file searching for csv      dir=bundle_tmp714853323 file=bundle_tmp714853323/metadata load=annotations
INFO[0000] skipping hidden file                          dir=bundle_tmp714853323 file=.wh..wh..opq find=csv
INFO[0000] found csv, loading bundle                     dir=bundle_tmp714853323 file=bundle_tmp714853323/manifests load=bundle
INFO[0000] skipping hidden file                          dir=bundle_tmp714853323/manifests file=.wh..wh..opq load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp714853323/manifests file=etcdbackups.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp714853323/manifests file=etcdclusters.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp714853323/manifests file=etcdoperator.v0.9.0.clusterserviceversion.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp714853323/manifests file=etcdrestores.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0000] Generating dockerfile                         bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
INFO[0000] writing dockerfile: index.Dockerfile022304309  bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
INFO[0000] running docker build                          bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
INFO[0000] [docker build -f index.Dockerfile022304309 -t quay.io/kuiwang/etcd-index:vd0.9.0 .]  bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
ERRO[0001] Sending build context to Docker daemon 49.39 MB
Step 1/9 : FROM registry.redhat.io/openshift4/ose-operator-registry:v4.4 AS builder
Error parsing reference: "registry.redhat.io/openshift4/ose-operator-registry:v4.4 AS builder" is not a valid repository/tag: invalid reference format  bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
Error: error building image: Sending build context to Docker daemon 49.39 MB
Step 1/9 : FROM registry.redhat.io/openshift4/ose-operator-registry:v4.4 AS builder
Error parsing reference: "registry.redhat.io/openshift4/ose-operator-registry:v4.4 AS builder" is not a valid repository/tag: invalid reference format
. 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 10 Evan Cordell 2020-05-18 20:06:25 UTC
It looks like you're using a very old version of docker (1.13)

1.13 was released in jan 2017: https://www.docker.com/blog/whats-new-in-docker-1-13/

multistage builds were released in july 2017: https://www.docker.com/blog/multi-stage-builds/

We don't intend to support versions of docker that are that old. I don't believe this is reproducible with new docker versions, so I'm closing it. Please re-open if you find an issue on newer releases.

Comment 11 kuiwang 2020-05-19 06:37:04 UTC
OK. change docker to 19.03.9. LGTM.

--
[root@preserve-olm-env operator-registry]# docker version
Client: Docker Engine - Community
 Version:           19.03.9
 API version:       1.40
 Go version:        go1.13.10
 Git commit:        9d988398e7
 Built:             Fri May 15 00:25:27 2020
 OS/Arch:           linux/amd64
 Experimental:      false

Server: Docker Engine - Community
 Engine:
  Version:          19.03.9
  API version:      1.40 (minimum version 1.12)
  Go version:       go1.13.10
  Git commit:       9d988398e7
  Built:            Fri May 15 00:24:05 2020
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.2.13
  GitCommit:        7ad184331fa3e55e52b890ea95e65ba581ae3429
 runc:
  Version:          1.0.0-rc10
  GitCommit:        dc9208a3303feef5b3839f4323d9beb36df0a9dd
 docker-init:
  Version:          0.18.0
  GitCommit:        fec3683


[root@preserve-olm-env operator-registry]# git branch
  master
* release-4.4
[root@preserve-olm-env operator-registry]# git log
commit ea5c9281cbe897db887e6d0986e62088b2e3bc25
Merge: bde4c90 d526580
Author: OpenShift Merge Robot <openshift-merge-robot.github.com>
Date:   Thu Apr 2 11:35:42 2020 +0200

    Merge pull request #225 from openshift-cherrypick-robot/cherry-pick-173-to-release-4.4
    
    [release-4.4] Bug 1816535: fix(index): copy correct opm bin builder path


[root@preserve-olm-env operator-registry]# ./opm alpha bundle build -d /root/kuiwang/community-operators/community-operators/etcd/0.9.0 -t quay.io/kuiwang/etcd-bundle:vd0.9.0 -c alpha -p etcd
INFO[0000] Building annotations.yaml                    
INFO[0000] Building Dockerfile                          
INFO[0000] Building bundle image                        
Sending build context to Docker daemon  24.58kB
Step 1/9 : FROM scratch
 ---> 
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
 ---> Running in 4cf1d644c020
Removing intermediate container 4cf1d644c020
 ---> 0856994f9645
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
 ---> Running in 088bf0425b0c
Removing intermediate container 088bf0425b0c
 ---> feef9776442c
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
 ---> Running in 5b540b5f3ef5
Removing intermediate container 5b540b5f3ef5
 ---> 7a2b730060fa
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1=etcd
 ---> Running in 78f224756439
Removing intermediate container 78f224756439
 ---> f71392efdce4
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1=alpha
 ---> Running in b1b1012c4297
Removing intermediate container b1b1012c4297
 ---> a0b560da3b7a
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
 ---> Running in d9060c12d982
Removing intermediate container d9060c12d982
 ---> 8a6e7997a297
Step 8/9 : COPY /*.yaml /manifests/
 ---> 95ad3d8164d5
Step 9/9 : COPY /metadata/annotations.yaml /metadata/annotations.yaml
 ---> 16b760af88ae
Successfully built 16b760af88ae
Successfully tagged quay.io/kuiwang/etcd-bundle:vd0.9.0
[root@preserve-olm-env operator-registry]# ./opm alpha bundle build -d /root/kuiwang/community-operators/community-operators/etcd/0.9.2 -t quay.io/kuiwang/etcd-bundle:vd0.9.2 -c alpha -p etcd
INFO[0000] Building annotations.yaml                    
INFO[0000] Building Dockerfile                          
INFO[0000] Building bundle image                        
Sending build context to Docker daemon   25.6kB
Step 1/9 : FROM scratch
 ---> 
Step 2/9 : LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
 ---> Using cache
 ---> 0856994f9645
Step 3/9 : LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
 ---> Using cache
 ---> feef9776442c
Step 4/9 : LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
 ---> Using cache
 ---> 7a2b730060fa
Step 5/9 : LABEL operators.operatorframework.io.bundle.package.v1=etcd
 ---> Using cache
 ---> f71392efdce4
Step 6/9 : LABEL operators.operatorframework.io.bundle.channels.v1=alpha
 ---> Using cache
 ---> a0b560da3b7a
Step 7/9 : LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
 ---> Using cache
 ---> 8a6e7997a297
Step 8/9 : COPY /*.yaml /manifests/
 ---> 79d7c1ac3de6
Step 9/9 : COPY /metadata/annotations.yaml /metadata/annotations.yaml
 ---> f5d9881950f6
Successfully built f5d9881950f6
Successfully tagged quay.io/kuiwang/etcd-bundle:vd0.9.2
[root@preserve-olm-env operator-registry]# docker image ls
REPOSITORY                                            TAG                 IMAGE ID            CREATED              SIZE
quay.io/kuiwang/etcd-bundle                           vd0.9.2             f5d9881950f6        6 seconds ago        19.7kB
quay.io/kuiwang/etcd-bundle                           vd0.9.0             16b760af88ae        26 seconds ago       18.4kB
quay.io/olmqe/marketplace-operator                    latest              25cdb6fe6af2        53 seconds ago       280MB
<none>                                                <none>              09cfa76fe23a        About a minute ago   1.42GB
openshift/origin-release                              golang-1.13         12472647b4ee        6 hours ago          1.05GB
registry.svc.ci.openshift.org/openshift/release       golang-1.10         eae4d37ce64f        6 hours ago          994MB
<none>                                                <none>              07a415dec26e        7 days ago           1.18GB
<none>                                                <none>              e0a9eca3cd52        3 weeks ago          443MB
registry                                              latest              708bc6af7e5e        3 months ago         25.8MB
registry.svc.ci.openshift.org/openshift/origin-v4.0   base                f779ab8af41a        13 months ago        224MB
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/etcd-bundle:vd0.9.0
The push refers to repository [quay.io/kuiwang/etcd-bundle]
4b946e596d0d: Pushed 
dfe7c354e6bc: Pushed 
vd0.9.0: digest: sha256:c8c9660bb4d89ffdeec649440587f8020e5fbb97c15eb30293901ce0a90ab388 size: 732
[root@preserve-olm-env operator-registry]# docker push quay.io/kuiwang/etcd-bundle:vd0.9.2
The push refers to repository [quay.io/kuiwang/etcd-bundle]
381bceaf1c3d: Pushed 
beceed768758: Pushed 
vd0.9.2: digest: sha256:398e92eec086fa59a85f75ab61bb5808745abe43995ee3cab7504100a3c1a62c size: 732
[root@preserve-olm-env operator-registry]# ./opm index add -b quay.io/kuiwang/etcd-bundle:vd0.9.0 -t quay.io/kuiwang/etcd-index:vd0.9.0 -c docker
INFO[0000] building the index                            bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
INFO[0000] running docker pull                           img="quay.io/kuiwang/etcd-bundle:vd0.9.0"
INFO[0000] running docker save                           img="quay.io/kuiwang/etcd-bundle:vd0.9.0"
INFO[0000] loading Bundle quay.io/kuiwang/etcd-bundle:vd0.9.0  img="quay.io/kuiwang/etcd-bundle:vd0.9.0"
INFO[0000] found annotations file searching for csv      dir=bundle_tmp615703895 file=bundle_tmp615703895/metadata load=annotations
INFO[0000] found csv, loading bundle                     dir=bundle_tmp615703895 file=bundle_tmp615703895/manifests load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp615703895/manifests file=etcdbackups.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp615703895/manifests file=etcdclusters.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp615703895/manifests file=etcdoperator.v0.9.0.clusterserviceversion.yaml load=bundle
INFO[0000] loading bundle file                           dir=bundle_tmp615703895/manifests file=etcdrestores.etcd.database.coreos.com.crd.yaml load=bundle
INFO[0000] Generating dockerfile                         bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
INFO[0000] writing dockerfile: index.Dockerfile353138081  bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
INFO[0000] running docker build                          bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"
INFO[0000] [docker build -f index.Dockerfile353138081 -t quay.io/kuiwang/etcd-index:vd0.9.0 .]  bundles="[quay.io/kuiwang/etcd-bundle:vd0.9.0]"


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