Bug 1801875
| Summary: | substitution of default values for ARG step not occurring with some Dockerfiles | ||
|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | Gabe Montero <gmontero> |
| Component: | Containers | Assignee: | Nalin Dahyabhai <nalin> |
| Status: | CLOSED DUPLICATE | QA Contact: | weiwei jiang <wjiang> |
| Severity: | medium | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 4.6 | CC: | adam.kaplan, aos-bugs, bparees, dwalsh, jokerman, nalin, tsweeney, wewang, wzheng |
| Target Milestone: | --- | ||
| Target Release: | 4.6.0 | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | 1801388 | Environment: | |
| Last Closed: | 2020-07-14 14:00:49 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: | |
| Embargoed: | |||
| Bug Depends On: | 1801388 | ||
| Bug Blocks: | 1802202 | ||
|
Description
Gabe Montero
2020-02-11 19:41:13 UTC
Adding Nalin, openshift builds point of contact on the conatiners/buildah team, to the CC list. Ben Parees, Nalin, and myself had slack discussion on this and Ben came up with a simplified reproducer
for an ARG default value not showing up in a FROM reference, which bypasses the golang panic getting fixed
in the blocking BZ to this one.
The reproducing openshift build config is
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: sample-build-docker-args-preset
spec:
source:
dockerfile: |-
FROM centos
ARG foo=centos
FROM $foo
type: Dockerfile
strategy:
dockerStrategy: {}
type: Docker
which results in
I0211 22:06:43.140914 1 builder.go:318] Starting Docker build from build config sample-build-docker-args-preset-17 ...
F0211 22:06:43.209605 1 helpers.go:114] error: build error: error parsing name "$foo": error parsing image name "$foo": invalid reference format
Nalin said he is investigating.
I believe a number of fixes culminating with a couple of fixes in ImageBuilder, https://github.com/openshift/imagebuilder/pull/163 and https://github.com/openshift/imagebuilder/pull/164 has resolved this issue. The plan is to have this fixes in RHEL 8.3. Adam or Nalin, do you have the simplified Dockerfile that I could run against Buildah to validate? Using the Dockerfile in the original report, I'm seeing: https://github.com/openshift/imagebuilder/pull/163 STEP 8: FROM golang:latest AS builder Getting image source signatures Copying blob 496548a8c952 done Copying blob 039b991354af done Copying blob 5a63a0a859d8 done Copying blob 2adae3950d4d done Copying blob 6b823afb12d9 [======================================] 118.0MiB / 118.0MiB Copying blob 376057ac6fa1 done Copying blob 30b9d62bd869 done Copying config 05feda5424 done Writing manifest to image destination Storing signatures STEP 9: ARG VERSION Which corresponds to these lines in the Dockerfile: FROM $GOLANG_CONTAINER AS builder ARG VERSION per recent discussion with Nalin, moving these openshfit build induced buildah items back to OCP/containers I think that most of this should have been sorted out in https://github.com/openshift/builder/pull/132, which has been merged. Opened https://github.com/openshift/builder/pull/162 to pull in the changes Tom mentioned. I should note that this part of comment #2 is rejected by `docker build`, regardless of whether or not `--build-arg foo=...` is passed to it, so it's not an ideal test case: FROM centos ARG foo=centos FROM $foo The ARG above is scoped to the stage in which it's defined, as described in https://github.com/openshift/imagebuilder/pull/151. The example from the bug description can be boiled down to a subtly different example, putting the ARG instruction before the FROM instruction that is treated as the start of the first stage: ARG foo=centos FROM centos FROM $foo The latter example should be expected to work, and that's what we're focusing on here. *** This bug has been marked as a duplicate of bug 1839683 *** |