+++ This bug was initially created as a clone of Bug #1843232 +++ One of our tests is a multistage build FROM scratch as test USER 1001 FROM %[1]s COPY --from=test /usr/bin/curl /test/ COPY --from=%[1]s /bin/echo /test/ COPY --from=%[1]s /bin/ping /test/ where %[1]s is "image-registry.openshift-image-registry.svc:5000/openshift/tools:latest" This fails with STEP 5: COPY --from=image-registry.openshift-image-registry.svc:5000/openshift/tools:latest /bin/echo /test/ error: build error: error building at STEP "COPY --from=image-registry.openshift-image-registry.svc:5000/openshift/tools:latest /bin/echo /test/": the stage "image-registry.openshift-image-registry.svc:5000/openshift/tools:latest" has not been built which is not correct. --from implies image OR stage by name. I tried to run FROM scratch as test USER 1001 FROM %[1]s as other COPY --from=test /usr/bin/curl /test/ COPY --from=%[1]s /bin/echo /test/ COPY --from=%[1]s /bin/ping /test/ and it still failed. There was an attempted fix in https://github.com/containers/buildah/pull/2321, but it either didn't make it into 4.5/master or may not cover the whole problem. Marked as 4.5, this needs to be fixed and backported potentially to 4.4. --- Additional comment from Adam Kaplan on 2020-06-03 13:59:18 EDT --- Targeting 4.6.0 - this is not a release blocker. Per Clayton's note, backport is requested to 4.5.z and 4.4.z --- Additional comment from Adam Kaplan on 2020-06-05 14:00:55 EDT --- This did not make it to 4.5/master - this merged in buildah master, but is not available in a v1.14.z stream. Openshift/builder currently uses buildah v1.14.2 [1]. Moving this to the Containers team so that we get this backported to buildah v1.14.z, and cloning to ensure this gets into builds. [1] https://github.com/openshift/builder/blob/release-4.5/go.mod
Upstream PR at: https://github.com/containers/buildah/pull/2401 working on the vendoring into openshift/builder which is proving problematic.
Verified in version: 4.5.0-0.nightly-2020-08-06-215703 Steps: 1. Using Dockerfile as follow to build,build complete ``` FROM docker.io/library/busybox AS build RUN rm -f /bin/paste USER 1001 COPY --from=docker.io/library/busybox /bin/paste /test/ ``` 2. Using Dockerfile as follow to build,build complete ``` FROM docker.io/library/busybox AS test RUN rm -f /bin/nl FROM docker.io/library/alpine AS final COPY --from=docker.io/library/busybox /bin/nl /test/ ``` 3. Using Dockerfile as follow to build,build failed ``` FROM busybox AS test USER 1001 FROM busybox AS build COPY --from=test /bin/cut /test/ COPY --from=build /bin/cp /test/ COPY --from=busybox /bin/paste /test/ ``` [root@wangwen work]# oc logs -f build/test-3 STEP 3: FROM busybox AS build STEP 4: COPY --from=test /bin/cut /test/ STEP 5: COPY --from=build /bin/cp /test/ error: build error: COPY --from=build: no stage or image found with that name
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.5.6 bug fix update), 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:3330