-
Notifications
You must be signed in to change notification settings - Fork 112
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
Surface error results to BuildRun #901
Conversation
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 few thoughts on the API. Once those are addressed (either accepted or denied), I will make another pass with a complete review.
cmd/git/main.go
Outdated
resultErrorMessage string | ||
resultErrorReason string |
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.
Two thoughts here:
- If these are coming from the taskrun, how about
taskRunErrorMessage
andtaskRunErrorReason
. - Instead of just surfacing the errors, why not surface a generic
taskRunMessage
andtaskRunReason
, maybe an additionaltaskRunReasonType
and then you can surface errors or success messages?
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.
Yes they are coming from TaskRun. However, the git command itself is not aware of Tekton. From its point of view it is just supplied with two filesystem paths.
If it is not a concern then I can introduce the name changes.
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.
For the second thought. Please see #901 (comment)
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.
I'd name them resultFileErrorMessage
and resultFileErrorReason
. And +1 that the term Tekton should not appear here.
cmd/git/main.go
Outdated
|
||
} | ||
|
||
return typeUndef, &ExitError{Code: 110, Message: "Unsupported type of credentials provided, either SSH private key or username/password is supported"} | ||
} | ||
|
||
func writeErrorResults(failure *git2.ErrorResult) (err error) { | ||
if flagValues.resultErrorReason == "" || flagValues.resultErrorMessage == "" { |
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.
Should this be &&
instead of ||
?
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.
Having ||
forces to supply a non-empty reason and message to the user. So we have to ask whether only a reason or a message is sufficient. I felt like both are necessary.
|
||
// Failure contains error details that are collected and surfaced from TaskRun | ||
// +optional | ||
Failure *Failure `json:"failure,omitempty"` |
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.
Again, some kind of generic TaskRunResults
instead of just Failure
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.
I don't agree with a generic TaskRun result. Do you see a specific use-case for the API changes? We have already introduced build related results in a recent PR with strong typing (Output and Source results). Additionally, there is a proposal for strategy authors to provide generic results (see Strategy Results Proposal from ship 0023).
From an API design point of view, I think it is more pleasing to have a dedicated field for errors, because its presence is enough to derive that an error occurred in the build. There would be no need to process generic results and look for hints of failure/error.
91ce776
to
f63cf05
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.
New files are missing copyright headers, please add them.
cmd/git/main.go
Outdated
resultErrorMessage string | ||
resultErrorReason string |
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.
I'd name them resultFileErrorMessage
and resultFileErrorReason
. And +1 that the term Tekton should not appear here.
Added WIP, as things like docs are missing but should be included for a complete PR. |
64a11d1
to
68d2f57
Compare
According to ship 0024, this commit adds a mechanism to surface errors from TaskRun steps. The errors are published under `status.failure` in BuildRun iff underlying TaskRun has failed. Adds `pkg/reconciler/buildrun/resources/failures.go`, `pkg/reconciler/buildrun/resources/failures_test.go` that contains logic for extracting error reason and message. Modifies `pkg/reconciler/buildrun/resources/taskrun.go` by adding two new generic results for errors.
- Parser that processes git stdout - Git cmd line tool now uses error results to surface detailed reason and message
This commit extracts the login in `conditions.go` that searches for the failed pod and its container. It merges the information of the error location (pod and container) into the error results. Fix tests
Reduces cyclic complexity in git_error_parser. Renames cmd line argument for `cmd/git`. Adds more error classes to achieve a 1 to 1 mapping from reason to message. Shortens long error messages for git errors. Adds copyright headers to new files. Extracts failure related task specs into `failureDetails` file.
68d2f57
to
6041ffc
Compare
@dalbar: The label(s) In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
6041ffc
to
6fa23f1
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.
A few smaller items.
86b4879
to
5a4641c
Compare
5a4641c
to
830d526
Compare
830d526
to
e9d4b3d
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.
/approve
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: SaschaSchwarze0 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.
/hold
Thank you @dalbar for this pretty significant contribution. There are a lot of commits here that affect multiple, independent components, which makes it difficult for me personally to review. I have concerns with some particulars - like the git error parser - that will likely bog down this review and prevent other important pieces from merging.
It also looks like we are still actively discussing the implementation in shipwright-io/community#37
Is it possible to split this into multiple pull requests? A pull request with just the API and controller changes would be simpler to review the current PR that also includes changes to our git step runner.
e9d4b3d
to
c817232
Compare
c817232
to
b1499ce
Compare
That is a valid point. I have to rewrite the e2e-test and can then proceed with the split. |
Changes
This PR provides a mechanism to surface errors in the build process into BuildRun objects granting more visibility into without being Tekton/Implementation specific. To achieve this goal, we introduce two new generic results
shp-error-reason
andshp-error-message
, that a TaskRun can emit and a BuildRun can pick up.Additionally, it implements a parser and interpreter for git errors in stdout that is used to deliver a use-case and PoC for the error surfacing.
Initial implementation for ship 24.
/kind feature
Submitter Checklist
Release Note