+++ This bug was initially created as a clone of Bug #1842982 +++ Description of problem: If a Dockerfile used in Docker strategy builds has build args that precede the first FROM statement, the build arg is dropped from the generated Dockerfile. Version-Release number of selected component (if applicable): 4.4 How reproducible: Always Steps to Reproduce: 1. Create a Docker strategy build with a BuildConfig that has ARG instructions that precede the first FROM statement: ``` apiVersion: build.openshift.io/v1 kind: BuildConfig metadata: name: dropped-build-arg spec: source: dockerfile: |- ARG foo=centos FROM registry.redhat.io/ubi8/ubi:latest RUN echo "hello from ubi!" FROM $foo RUN echo "hello from $foo" type: Dockerfile strategy: dockerStrategy: {} type: Docker 2. Start the build Actual results: Build will fail - no such image $foo Expected results: Build should succeed. Additional info:
Now latest payload is 4.5.0-0.nightly-2020-07-29-230326, should wait newer payload with the pr merged.
Verified in version: 4.5.0-0.nightly-2020-07-30-020337 Steps: 1. Create a bc: ``` apiVersion: build.openshift.io/v1 kind: BuildConfig metadata: name: dropped-build-arg spec: source: dockerfile: |- ARG foo=centos FROM registry.redhat.io/ubi8/ubi:latest RUN echo "hello from ubi!" FROM $foo RUN echo "hello from $foo" type: Dockerfile strategy: dockerStrategy: {} type: Docker ``` 2. Start build with bc, build complete
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.5 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:3188