Bug 1695622

Summary: Buildah error message on failed dockerfile build contains unnecessary information
Product: OpenShift Container Platform Reporter: Adam Kaplan <adam.kaplan>
Component: ContainersAssignee: Tom Sweeney <tsweeney>
Status: CLOSED ERRATA QA Contact: weiwei jiang <wjiang>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.1.0CC: adam.kaplan, aos-bugs, bparees, dwalsh, gblomqui, jokerman, mmccomas, mpatel, nalin
Target Milestone: ---   
Target Release: 4.1.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-04 10:47:00 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: 1694867    

Description Adam Kaplan 2019-04-03 13:12:11 UTC
Description of problem: If buildah build-using-dockerfile fails during a step, the resulting error message is not clear:

1 helpers.go:119] error: build error: error building at step {Env:[OPENSHIFT_BUILD_NAME=src-cache-origin-master-7 OPENSHIFT_BUILD_NAMESPACE=ci VERSION=1.10.3 GOCACHE=/go/.cache GOARM=5 GOPATH=/go GOROOT=/usr/local/go PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/go/bin OPENSHIFT_BUILD_SOURCE=https://github.com/openshift/release.git OPENSHIFT_BUILD_REFERENCE=master OPENSHIFT_BUILD_COMMIT=211cc73fadfdb150cf35d2edd5261898f004023e BUILD_LOGLEVEL=5 CLONEREFS_OPTIONS={"git_user_email":"ci-robot","git_user_name":"ci-robot","log":"/dev/null","refs":[{"org":"openshift","repo":"origin","base_ref":"master","base_sha":"0b751606e93258614555c506f9b3aaffefc57723","path_alias":"github.com/openshift/origin"}],"src_root":"/go"}] Command:add Args:[./clonerefs /clonerefs] Flags:[] Attrs:map[] Message:ADD ./clonerefs /clonerefs Original:ADD ./clonerefs /clonerefs}: error evaluating symlinks "/tmp/build/inputs/clonerefs": lstat /app: no such file or directory


Version-Release number of selected component (if applicable): 1.7.1


How reproducible: Always


Steps to Reproduce:
1. Create a dockerfile that will fail due to an error in an ADD statement
2. Run the build
3. Look at the output

Actual results: Error thrown (and reported in OpenShift builds) contains extraneous information that is not actionable


Expected results: An actionable error message, such as "error building step ADD: error evaluating symlinks "/tmp/build/inputs/clonerefs": lstat /app: no such file or directory"


Additional info: See also https://bugzilla.redhat.com/show_bug.cgi?id=1694867

Comment 1 Ben Parees 2019-04-03 13:48:09 UTC
As an additional suggestion:  dump what is currently being dumped if the loglevel is verbose.  When it's info, cut it down to something like what Adam proposed.

Comment 2 Tom Sweeney 2019-04-04 18:20:29 UTC
PR with proposed fix:

https://github.com/containers/buildah/pull/1482

Test:
# buildah bud -t tom -f ~/Dockerfile.badadd .
STEP 1: FROM alpine
STEP 2: ADD reallybadfile /tmp
error building at STEP "ADD reallybadfile /tmp": no files found matching "/root/tsweeney/workspaces/buildah/src/github.com/containers/buildah/reallybadfile": no such file or directory

Comment 4 Tom Sweeney 2019-05-03 13:58:02 UTC
Yes, this fix was part of the 1.8.1 bump that is with https://github.com/openshift/builder/pull/67.  I don't think that PR has merged yet.

Comment 6 Tom Sweeney 2019-05-06 16:57:32 UTC
Just as a quick follow up, the PR with is fixed has merged now.  (https://github.com/openshift/builder/pull/67)

Comment 7 weiwei jiang 2019-05-07 07:38:55 UTC
Checked with bumped version v1.8.2, and work well now.

# ../../containers/buildah/buildah --version            
buildah version 1.8.2 (image-spec 1.0.0, runtime-spec 1.0.0)
# ../../containers/buildah/buildah bud -f ./Dockerfile .
STEP 1: FROM busybox:latest
STEP 2: ADD not_existing_file .
error building at STEP "ADD not_existing_file .": no files found matching "/home/wjiang/go/src/github.com/openshift/origin/not_existing_file": no such file or directory
ERRO[0000] exit status 1

Comment 9 errata-xmlrpc 2019-06-04 10:47:00 UTC
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-2019:0758