Description of problem: if a build fails because we could not extract input content from an image, the reason is reported as "genericbuildfailure" whereas if we fail to clone git content we report fetchsourcefailure. We should report a more suitable reason when the image fetch init container fails. Version-Release number of selected component (if applicable): 4.3 How reproducible: always Steps to Reproduce: 1. setup a buildconfig that includes input from an image but make the image inaccessible or the extract path invalid 2. run the build Actual results: see a build failure reason of genericbuildfailure Expected results: a build failure reason that point to the failure that occurred during image content extraction. Additional info: compare: https://github.com/openshift/builder/blob/adc71a7dbf07918033f3b06b75988a71fef5458f/pkg/build/builder/cmd/builder.go#L251-L257 vs: https://github.com/openshift/builder/blob/adc71a7dbf07918033f3b06b75988a71fef5458f/pkg/build/builder/cmd/builder.go#L285-L292 should audit any other init container steps as well to ensure we are reporting reasons+messages for them.
So there are 3 init containers for both source and docker strategy builds: 1) git clone 2) extract image 3) manage dockerfile See https://github.com/openshift/openshift-controller-manager/blob/master/pkg/build/controller/strategy/sti.go#L120-L187 and https://github.com/openshift/openshift-controller-manager/blob/master/pkg/build/controller/strategy/docker.go#L114-L181 Ben covered the first two in his description. For the third, see https://github.com/openshift/builder/blob/master/pkg/build/builder/source.go#L102-L126 Similar to extract image, it does no setting on build status phase/reason/message. And taking inventory of the existing reason/messages at https://github.com/openshift/api/blob/master/build/v1/consts.go#L63-L157 I see nothing that could be used for extract image or manage dockerfile. So I'll craft an openshift/api PR to add the new reason/message constants, and then an openshift/builder PR, with an API vendor bump and associated code changes, to use the new constants.
Verified in version: 4.5.0-0.nightly-2020-03-22-175100 [wewang@wangwen ~]$ oc get builds NAME TYPE FROM STATUS STARTED DURATION statusfail-fetchimagecontentdocker-1 Docker Failed (FetchImageContentFailed) 15 seconds ago 14s
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:2409