Repository navigation
Include status reason in oc get build output - #4909
Conversation
|
This is an example output of |
|
[test] |
|
Hrm... That's probably too long. What are the pod limits? Also, it all On Oct 2, 2015, at 8:10 AM, Rodolfo Carvalho [email protected] This is an example output of oc get build: $ oc get build — |
I thought of that as well. I have tried limiting to e.g. 60 chars, but then you'll get partial information and have to figure out where to get the full message: We do show the full message in "oc describe".
Pods don't seem to have any explicit limits on output width of the columns. I discussed earlier today with @bparees an alternative to show a marker like a * after the status if there's any message, but then we discarded this idea since build.status.message doesn't imply error condition, and will leave users wondering what New*, Complete*, etc mean. Having a ShortErrorMessage for builds would require adding a new field and make sure it stays in sync with build.status.message. Didn't seem very promising. The current approach will show with all words what is wrong. For most builds the MESSAGE column will be empty, so it won't be cluttering the output. WDYT?
Couldn't find where we define those? |
|
Hrm, we designed for 80 and 120 (-o wide). If we can predict the other On Oct 2, 2015, at 2:54 PM, Rodolfo Carvalho [email protected] That's probably too long. I thought of that as well. I have tried limiting to e.g. 60 chars, but then $ oc get build We do show the full message in "oc describe". What are the pod limits? Pods don't seem to have I discussed earlier today with @bparees https://github.com/bparees an Having a ShortErrorMessage for builds would require adding a new field and The current approach will show with all words what is wrong. For most WDYT? it all has to be limited to our standard char width for regular and wide Couldn't find where we define those? — |
|
Pods today change the status field with more info. I think that's a good On Oct 2, 2015, at 2:54 PM, Rodolfo Carvalho [email protected] That's probably too long. I thought of that as well. I have tried limiting to e.g. 60 chars, but then $ oc get build We do show the full message in "oc describe". What are the pod limits? Pods don't seem to have I discussed earlier today with @bparees https://github.com/bparees an Having a ShortErrorMessage for builds would require adding a new field and The current approach will show with all words what is wrong. For most WDYT? it all has to be limited to our standard char width for regular and wide Couldn't find where we define those? — |
e5f4e72 to
2e0c8fa
Compare
@smarterclayton I'm going with your preferred way, adding a new Seems that in |
|
@smarterclayton @bparees PTAL |
There was a problem hiding this comment.
i'd prefer to see all these as constants defined in a single location
There was a problem hiding this comment.
There should be one set of constants in build/api
2e0c8fa to
317d8d2
Compare
317d8d2 to
b083f0a
Compare
|
Comments addressed, PTAL. |
|
needs squashing |
b083f0a to
cb84a10
Compare
|
squashed |
There was a problem hiding this comment.
len(build.Status.Reason) == 0
There was a problem hiding this comment.
π ~/go/src/github.com/openshift/origin grep -R '== 0' pkg/ | wc -l
896
π ~/go/src/github.com/openshift/origin grep -R '== ""' pkg/ | wc -l
66
consistency?
There was a problem hiding this comment.
Isn't grep losing context in this case?
AFAIK the idiomatic way to check if a string is the empty string in Go is to do that obvious comparison.
https://groups.google.com/d/msg/golang-nuts/7Ks1iq2s7FA/GOujoyeYsOcJ
That post dates back to 2010, and for already some years the compiler is good enough that there's no significant difference in compiled code.
There was a problem hiding this comment.
It's a convention we follow in our codebase to not compare against empty strings.
There was a problem hiding this comment.
We use len(str) == 0 as our empty string check everywhere
There was a problem hiding this comment.
I'm interested to know why do we do it that way?
There was a problem hiding this comment.
Convention. We picked one pattern and enforced it.
On Oct 11, 2015, at 3:34 PM, Rodolfo Carvalho [email protected]
wrote:
In pkg/build/controller/factory/factory.go
#4909 (comment):
@@ -95,6 +96,10 @@ func (factory _BuildControllerFactory) Create() controller.RunnableController {
build := obj.(_buildapi.Build)
err := buildController.HandleBuild(build)
if err != nil {
// Set default Reason.if build.Status.Reason == "" {
I'm interested to know why do we do it that way?
—
Reply to this email directly or view it on GitHub
https://github.com/openshift/origin/pull/4909/files#r41714498.
|
two small nits, LGTM otherwise... would love to see some tests for this ;-) |
|
@rhcarvalho Bump |
|
continuous-integration/openshift-jenkins/test SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pull_requests_origin/6054/) |
de31810 to
463f0f9
Compare
|
@rhcarvalho looks better imho :-) |
There was a problem hiding this comment.
do we really need these constants defined in the public api?
There was a problem hiding this comment.
IIRC it was motivated by this comment: #4909 (comment).
I followed the pattern for what we do in similar cases. If Build.Status.Reason is of some specific type, then I think the constants should be exported.
We can also have it be a plain string, but then the compiler wouldn't help us ensure the reason is one of a known set of "constants defined in a single location".
There was a problem hiding this comment.
i don't have any problem with there being constants for it, i agree there should be i, i just don't see why you need to define the same constants 3 times. I would think it would be sufficient to define them in the internal types.go and be done with it, given how it's being used.
There was a problem hiding this comment.
I share the same feeling about declaring it 3 times. But that's how we do it for all other constants: they are declared in api/types.go, api/v1/types.go and api/v1beta3/types.go.
I don't have the answer for why we do it that way.
It was already some time since I wrote that code, but one thing I remember is that it affects conversion code. Maybe we don't want to have interdependency among the api packages.
There was a problem hiding this comment.
If I remove the constant from api/v1/types.go, then will have to write in that file:
// BuildStatus contains the status of a build
type BuildStatus struct {
// Phase is the point in the build lifecycle.
Phase BuildPhase `json:"phase"`
// Cancelled describes if a cancelling event was triggered for the build.
Cancelled bool `json:"cancelled,omitempty"`
// Reason is a brief CamelCase string that describes any failure and is meant for machine parsing and tidy display in the CLI.
Reason api.StatusReason `json:"reason,omitempty" description:"brief CamelCase string describing a failure, meant for machine parsing and tidy display in the CLI"`
...It doesn't seem right to me to make a versioned api depend on an unversioned, internal type.
Unless we make the Reason field of type string, which has the disadvantage of losing the type checking.
There was a problem hiding this comment.
you can define the type without defining the actual constants.
There was a problem hiding this comment.
(03:36:56 PM) claytonc: bparees: i'm just going to hazard a guess, but if you're talking about constants, we should only put constants in internal unless they're different
(03:36:59 PM) claytonc: and since constants shouldn't change
(03:37:06 PM) claytonc: we should always just add new constants to the internal api
(03:37:13 PM) claytonc: regarding the structs
(03:37:20 PM) claytonc: you should add them to the v1beta3 structs and convertsions
(03:37:31 PM) bparees: claytonc: yeah i was only talking about the constants.
|
question about constants in the api, last two commits should be squashed, and then lgtm. |
463f0f9 to
a21de26
Compare
|
@bparees regarding the API changes, I'd ask for @smarterclayton's API review on that (and the rest of API changes). @smarterclayton is it alright to have those exported constants in the API? |
|
i'm less concerned about whether it's "alright" and more concerned about what purpose it serves. |
a21de26 to
a582538
Compare
|
@bparees I've removed the constants from api/v1 and api/v1beta3 as you wanted. I think it is in disparity with the other constants in all other cases I've seen. For example, the constants for api/v1 BuildPhase are not referenced anywhere (according to my go oracle...). But cleaning that up is another endeavor I'm not taking now :D |
|
lgtm and i'm taking #4909 (comment) as an api sign off from @smarterclayton |
|
[merge] |
|
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/3722/) (Image: devenv-rhel7_2521) |
|
Yes, is fine. |
|
[test] |
|
Looks like the merge failed because of a test flake in test/cmd/newapp.sh:24? |
And include status reason in oc get build output. Useful to find at a glance potential errors with existing builds. Also, clear build reason and message on phase change. Message is a human-readable message indicating details about why the build has this status, but we were never clearing the message after status changes.
a582538 to
785cdc8
Compare
|
Evaluated for origin test up to 785cdc8 |
|
@bparees @smarterclayton I rebased against master to get rid of the first commit that was merged in #5275. This is the merge job that failed yesterday: https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/3718/consoleFull |
|
[merge] |
|
Evaluated for origin merge up to 785cdc8 |
Merged by openshift-bot
Useful to find at a glance potential errors with existing builds.
Follow up on #4872