Bug 1801388
| Summary: | Panic in openshift/builder imagebuilder processing dockerfile ARG step | |||
|---|---|---|---|---|
| Product: | OpenShift Container Platform | Reporter: | Gabe Montero <gmontero> | |
| Component: | Build | Assignee: | Gabe Montero <gmontero> | |
| Status: | CLOSED ERRATA | QA Contact: | wewang <wewang> | |
| Severity: | medium | Docs Contact: | ||
| Priority: | unspecified | |||
| Version: | 4.4 | CC: | adam.kaplan, ansverma, aos-bugs, maupadhy, rkshirsa, wzheng | |
| Target Milestone: | --- | |||
| Target Release: | 4.4.0 | |||
| Hardware: | Unspecified | |||
| OS: | Unspecified | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | Bug Fix | ||
| Doc Text: |
Cause: Dockerfile parsing in openshift/builder was not initializing a map need for processing any ARG steps
Consequence: OpenShift Docker Strategy Builds where the Dockerfile had an ARG step would panic and fail prior to invoking buildah.
Fix: Initialized the map related to ARG step processing so golang would not panic on a nil reference.
Result: OpenShift Docker Strategy Builds where the Dockerfile has an ARG step will not panic prior to invoking buildah.
|
Story Points: | --- | |
| Clone Of: | ||||
| : | 1801875 (view as bug list) | Environment: | ||
| Last Closed: | 2020-05-04 11:35: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: | ||
| Embargoed: | ||||
| Bug Depends On: | ||||
| Bug Blocks: | 1801875, 1832975 | |||
|
Description
Gabe Montero
2020-02-10 18:54:28 UTC
Reproduced with a unit test based on the Dockerfile and build config from https://github.com/openshift/builder/issues/129 Have fix in hand (one liner) ... just cleaning up / simplifying the unit test Note to QE, we have a simplified reproducer:
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
So at least the panic does not occur.
Bug https://bugzilla.redhat.com/show_bug.cgi?id=1801875 has been opened against buildah so that we do not get
F0211 22:06:43.209605 1 helpers.go:114] error: build error: error parsing name "$foo": error parsing image name "$foo": invalid reference format
Sorry one tweak to Ben's reproducer in #Comment 3 To get the panic, the dockerfile contents should just be ARG foo=centos FROM $foo The `FROM centos` was added to work around the panic in constructing a simple reproducer for https://bugzilla.redhat.com/show_bug.cgi?id=1801875 Thanks Gabe, I can reproduce the bug about Arg problem, and verified in
4.4.0-0.nightly-2020-02-13-192852
Steps:
1. Use bc to create build
apiVersion: build.openshift.io/v1
kind: BuildConfig
metadata:
name: sample-build-docker-args-preset
spec:
source:
dockerfile: |-
ARG foo=ab
FROM centos
type: Dockerfile
strategy:
dockerStrategy: {}
type: Docker
2. Using old cluster version,will have error
http://pastebin.test.redhat.com/836101
3. Using the latest version, the error is fixed.
[wewang@wangwen ~]$ oc get builds
NAME TYPE FROM STATUS STARTED DURATION
sample-build-docker-args-preset-1 Docker Dockerfile Complete 8 minutes ago 20s
FYI, About the following 2 scenarios still failed with "error: build error: error parsing name "$foo": error parsing image name "$foo": invalid reference format" in current latest cluster, will test them when https://bugzilla.redhat.com/show_bug.cgi?id=1801875 is fixed. Scenario 1: source: dockerfile: |- ARG foo=centos FROM $foo type: Dockerfile Scenario 2: dockerfile: |- FROM centos ARG foo=centos FROM $foo type: Dockerfile Already had a bug to track about Comment 7: https://bugzilla.redhat.com/show_bug.cgi?id=1802202 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 |