-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Build Status fields #536
Refactor Build Status fields #536
Conversation
f755f07
to
f19e541
Compare
8e813d8
to
007e96b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like I wrote in the other comment, it is a tough call. At the moment, I like the idea of harmonizing the validations, because we touch the code anyway. Always harder to do it later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK @qu1queee I've at least done, at least I hope, a better job of applying my idea to the precise spots in the code which are relevant.
Hopefully it is at least clearer than it was before.
I've talked with @adambkaplan and he is going to chime in on the enhancement vs. tech debt discussion point, and based on how that goes, short term implications for this change as well as perhaps and we move forward with similar changes.
Also, @otaviof agreed to take a look at this suggestion as well, to provide another voice on whether what I'm suggesting makes sense, and whether or not he agrees it is a stylistic improvement.
Then we can go from there.
thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qu1queee hopefully @gabemontero's follow up comments clarify what his is going after. What he is describing is a refactoring opportunity - we have several disjoint functions that validate the Build object in some form or fashion. Rather than have separate functions with their own signatures and quirks, we can use this opportunity to reduce complexity by conforming the validation functions to a shared interface.
David Copeland coined the term "slop" for code that we know is messy when we write it [1]. We could mark this a tech debt issue to address later, but experience dictates that these items are rarely, if ever, cleaned up. Better to refactor to cleaner code when the opportunity presents itself.
[1] https://naildrivin5.com/blog/2012/10/05/making-it-right-technical-debt-vs-slop.html
@adambkaplan please see this PR changes in detail. You are citing an article around "slop code/technical debt" that states
this PR is not the above, PR speaks for itself. We are not adding these disjoint functions in this PR, these functions were already there, so I'm struggling to understand why you will quote an article around slop code, when this PR didn't write that code. I'm not against improving the existing code, please see my previous comment(and I quote myself again):
I'm against not having a full understanding on the scope of this PR and trying to request a change that can easily be tackle as a follow-up, follow-up where I would be more than happy to see new authors(I certainly can spend time on such stylistic details, but more contributions are welcome). If we go with this line of thinking, then why not to address also in this PR some of the go cycle reports for the |
type BuildReason string | ||
|
||
const ( | ||
// SucceedStatus indicates that all validations Succeeded |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A nit comment, we should add a new line after each attribute, following the other attributes described in the same package.
Adding support for secrets differenciation errors in a Build Definition of one-word camelCase constants for Build validations Adding support for Status.Reason and Status.Message fields Ensure usage of Build constants to populate the Status.Reason Ensure appropiate message for the Status.Message Signed-off-by: Zoe <xigxjn@cn.ibm.com>
This add support for the new Status.Message field in Build. This refactors the previous usage of Status.Reason field, to ensure it matches the new camel-case constants. The above applies to both unit and integration tests. Signed-off-by: Zoe <xigxjn@cn.ibm.com>
Done via operator-sdk Signed-off-by: Zoe <xigxjn@cn.ibm.com>
Signed-off-by: Zoe <xigxjn@cn.ibm.com>
Introduce a table that explains the `Status.Reason` one-word validation in detail. Signed-off-by: Zoe <xigxjn@cn.ibm.com>
1725668
to
f60605c
Compare
This introduces a new Interface that hosts a common func() to execute validations. Each different validation implements the above interface in order to trigger a validation. At the moment we have five different validations.
/retest |
My input has been addressed @qu1queee - thanks ! I'll /approve and then leave it to the other reviewers here to lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gabemontero The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
This fixes #463 and #494
Note: this a follow-up based on the discussions in #463 , we are not longer introducing error codes, but rather an enhancement in the Build Status fields based on the feedback on that issue.
This should conclude a set of enhancements we have been doing in both Build/BuildRun Status fields. This PR proposes an enhancement on the Build Status fields. This will provide more clarity for users on why a validation happened and will also standardize the
Status.Reason
via the usage of a one-word camelCase constant. We also introduce a distinction on which type of referenced secret is missing, previously we were only highlighting if one or multiple secrets were missing, but we didn´t make any references to where in the Build definition was this secret used.The following are examples of some of the validation scenarios on how the new fields will be populated.
All validations succeeded
spec.source secret is missing
spec.output secret is missing
multiple secrets are missing
ClusterBuildStrategy is missing