Bug 1809862 - builds do not report lastlogsnippet from init containers
Summary: builds do not report lastlogsnippet from init containers
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Build
Version: 4.4
Hardware: Unspecified
OS: Unspecified
Target Milestone: ---
: 4.5.0
Assignee: Gabe Montero
QA Contact: wewang
Depends On:
TreeView+ depends on / blocked
Reported: 2020-03-04 03:37 UTC by Ben Parees
Modified: 2020-07-13 17:18 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Cause: build error handling was only attaching the last few lines of error logs to the build if the failure occurred in a build pod continer, and not if the failure occurred a build pod init container Consequence: build errors occurring in the init containers, like extraction of source from git, were harder to diagnose without some of the error logs attached to the build object Fix: the build controller was updated to attach error logs when failures occur in the init containers Result: build failures like malformed git URLs are much easier for users to diagnose now.
Clone Of:
Last Closed: 2020-07-13 17:17:56 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Github openshift openshift-controller-manager pull 77 None closed Bug 1809862: report lastlogsnippet from init containers on failed/errored builds 2020-06-30 15:21:29 UTC
Github openshift origin pull 24727 None closed Bug 1809862: log snippet test; failed git clone within init container 2020-06-30 15:21:28 UTC
Red Hat Product Errata RHBA-2020:2409 None None None 2020-07-13 17:18:17 UTC

Description Ben Parees 2020-03-04 03:37:52 UTC
Description of problem:
if the build fails during an init container we do not grab the last failure log message from the init container and put it in the build's logsnippet.  We only do it for the "main" container:


We should also be doing this if we fail in an init container.

How reproducible:

Steps to Reproduce:
1. run a build that fails in an init container such as by providing an invalid git url
2. oc describe the build

Actual results:
logSnippet is empty

Expected results:
logSnippet contains the last log line of the init container that failed from pod.status.initContainerStatuses[n].state.terminated.message

Comment 3 wewang 2020-03-23 09:20:59 UTC
Verified in version:

[wewang@wangwen Downloads]$ oc get builds
NAME           TYPE     FROM   STATUS                       STARTED          DURATION
ruby-hello-1   Source   Git    Failed (FetchSourceFailed)   11 seconds ago   10s

Comment 4 Ben Parees 2020-03-23 20:37:57 UTC
I can't tell from the verification report, were you able to confirm that the LogSnippet value was populated in the build yaml and that it showed some sort of error message from the git clone operation?

Comment 5 wewang 2020-03-24 07:13:14 UTC
Oh, yes I should paste build yaml, here is content of build:
 $oc get build -n wewang -o yaml
    logSnippet: |-
      Cloning "https://github.com/openshift/ruby-hello-world1" ...
      error: failed to fetch requested repository "https://github.com/openshift/ruby-hello-world1" with provided credentials
    message: Failed to fetch the input source.

Comment 6 Ben Parees 2020-03-24 15:04:37 UTC
Perfect, thanks!

Comment 8 errata-xmlrpc 2020-07-13 17:17:56 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.


Note You need to log in before you can comment on or make changes to this bug.