Skip to content

Set build status message in case of error - #4872

Merged
openshift-bot merged 1 commit into
openshift:masterfrom
rhcarvalho:issue4362-BC-with-invalid-output.to
Oct 1, 2015
Merged

openshift-bot merged 1 commit into
openshift:masterfrom
rhcarvalho:issue4362-BC-with-invalid-output.to

Conversation

@rhcarvalho

Copy link
Copy Markdown
Contributor

@rhcarvalho

Copy link
Copy Markdown
Contributor Author

It turned out that oc status already handled the case described in the issue:

$ oc status
In project OpenShift Demo Project (demo) on server https://10.0.2.15:8443

service/chain-app1-frontend - 172.30.195.95:8080
  dc/chain-app1-frontend deploys istag/chained-builds-app1:latest <-
    docker build of https://github.com/rhcarvalho/chained-builds-ex.git through bc/chained-builds-app1 
      #1 build new for 4 minutes (can't push to image)
    #1 deployment waiting on image or update

Warnings:
  bc/chained-builds-app1 is pushing to imagestreamtag/chained-builds-app1:latest that is using is/chained-builds-app1, but the administrator has not configured the integrated Docker registry.  (oadm registry)

To see more, use 'oc describe <resource>/<name>'.
You can use 'oc get all' to see a list of other objects.

With this PR, the build.status.message gets updated for any error related to handling new builds:

$ oc get build --template '{{range .items}}{{printf "%s\n" .status.message}}{{end}}'
the referenced output ImageStream demo/chained-builds-app1 does not exist

I don't see the message in the Web Console though.

@rhcarvalho

Copy link
Copy Markdown
Contributor Author

@bparees @mfojtik PTAL

@rhcarvalho

Copy link
Copy Markdown
Contributor Author

Also, the message is not visible via oc describe:

$ oc describe build
Name:           chained-builds-app1-1
Created:        12 minutes ago
Labels:         buildconfig=chained-builds-app1,template=chained-builds
Annotations:    openshift.io/build.number=1
Build Config:   chained-builds-app1
Status:         New
Duration:       waiting for 12m2s
Build Pod:      chained-builds-app1-1-build
Strategy:       Docker
Source Type:    Git
URL:            https://github.com/rhcarvalho/chained-builds-ex.git
ContextDir:     app
Output to:      ImageStreamTag chained-builds-app1:latest
No events.

Should we be triggering an event in addition to setting the status message?

@thoraxe

thoraxe commented Sep 30, 2015

Copy link
Copy Markdown
Contributor

So will I see something other than "new" when I do "oc get build SOMEBUILDID"?

@rhcarvalho

Copy link
Copy Markdown
Contributor Author

@thoraxe not yet. Neither oc describe, oc get nor the Web Console seem to show the status message in the most obvious usages of those.

oc status is already showing a warning.

I think as a result of this PR we definitely should see the error condition with ease.
One way would be to trigger an event. Events are shown in the output of oc describe and in the Web Console. Just not sure if events are the correct approach here, so waiting for feedback.

@bparees

bparees commented Sep 30, 2015

Copy link
Copy Markdown
Contributor

@rhcarvalho describe should definitely be updated to display build.status.message if it's set.

putting it into the default oc get output would probably be too lengthy.

@jwforres should make sure the console gets updated to display build.status.message if it's not currently doing so, on the detailed build display page (not the list of builds page)

@rhcarvalho

Copy link
Copy Markdown
Contributor Author

@bparees how about this (notice the status line):

$ oc describe build chained-builds-app1-2
Name:           chained-builds-app1-2
Created:        40 seconds ago
Labels:         buildconfig=chained-builds-app1,template=chained-builds
Annotations:    openshift.io/build.number=2
Build Config:   chained-builds-app1
Status:         New (the referenced output ImageStream demo/chained-builds-app1 does not exist)
Duration:       waiting for 40s
Build Pod:      chained-builds-app1-2-build
Strategy:       Docker
Source Type:    Git
URL:            https://github.com/rhcarvalho/chained-builds-ex.git
ContextDir:     app
Output to:      ImageStreamTag chained-builds-app1:latest
No events.

I'll create an event as well and we can see how it looks.

@rhcarvalho
rhcarvalho force-pushed the issue4362-BC-with-invalid-output.to branch from a80ae54 to 45f5fd7 Compare October 1, 2015 07:30
@bparees

bparees commented Oct 1, 2015

Copy link
Copy Markdown
Contributor

can you put status at the bottom?

@rhcarvalho

Copy link
Copy Markdown
Contributor Author

With an event:

$ oc describe build
Name:           chained-builds-app1-1
Created:        About a minute ago
Labels:         buildconfig=chained-builds-app1,template=chained-builds
Annotations:    openshift.io/build.number=1
Build Config:   chained-builds-app1
Status:         New (Build failed with error demo/chained-builds-app1-1: the referenced output ImageStream demo/chained-builds-app1 does not exist)
Duration:       waiting for 1m36s
Build Pod:      chained-builds-app1-1-build
Strategy:       Docker
Source Type:    Git
URL:            https://github.com/rhcarvalho/chained-builds-ex.git
ContextDir:     app
Output to:      ImageStreamTag chained-builds-app1:latest
Events:
  FirstSeen     LastSeen        Count   From                    SubobjectPath   Reason          Message
  ─────────     ────────        ─────   ────                    ─────────────   ──────          ───────
  1m            0s              109     {build-controller }                     controllerError Build error: Build failed with error demo/chained-builds-app1-1: the referenced output ImageStream demo/chained-builds-app1 does not exist

This does show in the Browse>Events tab of the Web Console, but not in the Overview nor Browse>Builds tabs.

The event is (re)generated at ~1 event/second, but that may not be a big deal since we're grouping the events and just incrementing the counter.

@bparees would you still want the status at the bottom? It would read like this:

$ oc describe build
Name:           chained-builds-app1-1
Created:        About a minute ago
Labels:         buildconfig=chained-builds-app1,template=chained-builds
Annotations:    openshift.io/build.number=1
Build Config:   chained-builds-app1
Duration:       waiting for 1m36s
Build Pod:      chained-builds-app1-1-build
Strategy:       Docker
Source Type:    Git
URL:            https://github.com/rhcarvalho/chained-builds-ex.git
ContextDir:     app
Output to:      ImageStreamTag chained-builds-app1:latest
Status:         *New* (Build failed with error demo/chained-builds-app1-1: the referenced output ImageStream demo/chained-builds-app1 does not exist)
Events:
  FirstSeen     LastSeen        Count   From                    SubobjectPath   Reason          Message
  ─────────     ────────        ─────   ────                    ─────────────   ──────          ───────
  1m            0s              109     {build-controller }                     controllerError Build error: Build failed with error demo/chained-builds-app1-1: the referenced output ImageStream demo/chained-builds-app1 does not exist

@rhcarvalho
rhcarvalho force-pushed the issue4362-BC-with-invalid-output.to branch from 45f5fd7 to 84e81ae Compare October 1, 2015 09:01
@rhcarvalho

Copy link
Copy Markdown
Contributor Author

[test]

@openshift-bot

Copy link
Copy Markdown
Contributor

@bparees

bparees commented Oct 1, 2015

Copy link
Copy Markdown
Contributor

yeah i think i still prefer the bottom.

@rhcarvalho
rhcarvalho force-pushed the issue4362-BC-with-invalid-output.to branch from 84e81ae to 040ed9f Compare October 1, 2015 09:54
@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin test up to 040ed9f

@rhcarvalho

Copy link
Copy Markdown
Contributor Author

@bparees PTAL

Now we have this in case a build completes successfully:

$ oc describe build
Name:           chained-builds-app1-1
Created:        31 seconds ago
Labels:         buildconfig=chained-builds-app1,template=chained-builds
Annotations:    openshift.io/build.number=1
Build Config:   chained-builds-app1
Started:        2015-10-01 10:12:48 +0000 UTC
Finished:       2015-10-01 10:13:09 +0000 UTC
Duration:       21s
Build Pod:      chained-builds-app1-1-build
Strategy:       Docker
Source Type:    Git
URL:            https://github.com/rhcarvalho/chained-builds-ex.git
ContextDir:     app
Output to:      ImageStreamTag chained-builds-app1:latest
Push Secret:    builder-dockercfg-v2wks
Status:         Complete
Events:
  FirstSeen     LastSeen        Count   From                            SubobjectPath                           Reason          Message
  ─────────     ────────        ─────   ────                            ─────────────                           ──────          ───────
  31s           31s             1       {scheduler }                                                            Scheduled       Successfully assigned chained-builds-app1-1-build to openshiftdev.local
  31s           31s             1       {kubelet openshiftdev.local}    implicitly required container POD       Pulled          Container image "openshift/origin-pod:latest" already present on machine
  31s           31s             1       {kubelet openshiftdev.local}    implicitly required container POD       Created         Created with docker id ef4754865d0e
  31s           31s             1       {kubelet openshiftdev.local}    implicitly required container POD       Started         Started with docker id ef4754865d0e
  31s           31s             1       {kubelet openshiftdev.local}    spec.containers{docker-build}           Pulled          Container image "openshift/origin-docker-builder:latest" already present on machine
  30s           30s             1       {kubelet openshiftdev.local}    spec.containers{docker-build}           Created         Created with docker id ce91e61ff37d
  30s           30s             1       {kubelet openshiftdev.local}    spec.containers{docker-build}           Started         Started with docker id ce91e61ff37d
  9s            9s              1       {kubelet openshiftdev.local}    implicitly required container POD       Killing         Killing with docker id ef4754865d0e

And this for the error case:

$ oc describe build
Name:           chained-builds-app1-1
Created:        4 seconds ago
Labels:         buildconfig=chained-builds-app1,template=chained-builds
Annotations:    openshift.io/build.number=1
Build Config:   chained-builds-app1
Duration:       waiting for 4s
Build Pod:      chained-builds-app1-1-build
Strategy:       Docker
Source Type:    Git
URL:            https://github.com/rhcarvalho/chained-builds-ex.git
ContextDir:     app
Output to:      ImageStreamTag chained-builds-app1:latest
Status:         New (the referenced output ImageStream demo/chained-builds-app1 does not exist)
Events:
  FirstSeen     LastSeen        Count   From                    SubobjectPath   Reason                  Message
  ─────────     ────────        ─────   ────                    ─────────────   ──────                  ───────
  4s            0s              16      {build-controller }                     HandleBuildError        Build demo/chained-builds-app1-1 has error: the referenced output ImageStream demo/chained-builds-app1 does not exist

@bparees

bparees commented Oct 1, 2015

Copy link
Copy Markdown
Contributor

lgtm 👍
[merge]

@openshift-bot

Copy link
Copy Markdown
Contributor

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/3452/) (Image: devenv-fedora_2439)

@openshift-bot

Copy link
Copy Markdown
Contributor

Evaluated for origin merge up to 040ed9f

openshift-bot pushed a commit that referenced this pull request Oct 1, 2015
@openshift-bot
openshift-bot merged commit 1fe90e8 into openshift:master Oct 1, 2015
@smarterclayton

Copy link
Copy Markdown
Contributor

Needs a test case - preferably integration, but I'd accept extended

@rhcarvalho
rhcarvalho deleted the issue4362-BC-with-invalid-output.to branch October 1, 2015 11:47
@thoraxe

thoraxe commented Oct 1, 2015

Copy link
Copy Markdown
Contributor

So when I do oc get build am I still going to see New?

@bparees

bparees commented Oct 1, 2015

Copy link
Copy Markdown
Contributor

@thoraxe yes the build is going to stay in the new state, it can't go to pending until we can create the pod and we can't create the pod until we can resolve the imagestream.

@smarterclayton

Copy link
Copy Markdown
Contributor

We should consider showing the status message (while in new) like pods can.

Also, can you set a "Reason" on status like pods that is a machine readable
Constant? That's easier to show in dense columns - like WaitingForImage

On Oct 1, 2015, at 9:20 PM, Ben Parees [email protected] wrote:

@thoraxe https://github.com/thoraxe yes the build is going to stay in the
new state, it can't go to pending until we can create the pod and we can't
create the pod until we can resolve the imagestream.

—
Reply to this email directly or view it on GitHub
#4872 (comment).

@thoraxe

thoraxe commented Oct 1, 2015

Copy link
Copy Markdown
Contributor

@bparees I think there's some confusion.

This issue is linked form https://bugzilla.redhat.com/show_bug.cgi?id=1262883

That BZ describes the situation where oc get build shows a build as New even though it is failed and will never complete because it cannot be scheduled. All of the commentary in this issue so far has been regarding oc describe which already gave you information in the events. So, it's good that we're getting more explicit info, but it doesn't address the original BZ which is regarding oc get build.

@smarterclayton suggested that, like oc get pod we might want to include more status information. Currently just saying New is really misleading.

And what happens in the UI in this case?

@jwforres

jwforres commented Oct 1, 2015

Copy link
Copy Markdown
Member

There is a separate issue open for any console changes
#4886 if you have opinions on
where this new info should show up then add comments there.

On Thu, Oct 1, 2015 at 4:48 PM, Erik M Jacobs [email protected]
wrote:

@bparees https://github.com/bparees I think there's some confusion.

This issue is linked form
https://bugzilla.redhat.com/show_bug.cgi?id=1262883

That BZ describes the situation where oc get build shows a build as New
even though it is failed and will never complete because it cannot be
scheduled. All of the commentary in this issue so far has been regarding oc
describe which already gave you information in the events. So, it's good
that we're getting more explicit info, but it doesn't address the original
BZ which is regarding oc get build.

@smarterclayton https://github.com/smarterclayton suggested that, like oc
get pod we might want to include more status information. Currently just
saying New is really misleading.

And what happens in the UI in this case?

—
Reply to this email directly or view it on GitHub
#4872 (comment).

@rhcarvalho

Copy link
Copy Markdown
Contributor Author

That BZ describes the situation where oc get build shows a build as New even though it is failed and will never complete because it cannot be scheduled.

@thoraxe, as per @bparees's comment on BZ, that build is not failed, because as long as you have more resources available the build pod will be created.

What I understood is that, in that case described in BZ, the build will have status New until you either manually cancel the build, there are resources available to start your pod, or we give up retrying, whatever happens first.

@rhcarvalho

Copy link
Copy Markdown
Contributor Author

@thoraxe I'll do a follow up to add more descriptive info to oc get build as well, as per @smarterclayton's comment.

@thoraxe

thoraxe commented Oct 2, 2015

Copy link
Copy Markdown
Contributor

Right, but the issue is that only some commands give you the info you need to understand the problem. But it looks like #4909 is the fix.

Would MESSAGE be something like the referenced output ImageStream demo/chained-builds-app1 does not exist ?

In the case of the referenced bugzilla, where the most recent event was Error creating: Pod "ruby-example-3-build" is forbidden: Limited to 3 pods, what MESSAGE would we see?

@rhcarvalho

Copy link
Copy Markdown
Contributor Author

@thoraxe yes, you'll see what you expect. The output would be similar to this:

$ oc get build
NAME                    TYPE      FROM      STATUS    STARTED   MESSAGE
chained-builds-app1-1   Docker    Git       Pending             failed to create build pod: Pod "chained-builds-app1-1-build" is forbidden: Must make a non-zero request for memory since it is tracked by quota.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants