-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Introducing InternalTektonResultType as a ResultType #3138
Conversation
Hi @Peaorl. Thanks for your PR. I'm waiting for a tektoncd member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
/kind feature |
de825d0
to
d1efa81
Compare
/ok-to-test |
The following is the coverage report on the affected files.
|
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.
Looking good! I left a few comments but I don't think there are any major blockers from my pov.
d1efa81
to
d59e41a
Compare
The following is the coverage report on the affected files.
|
d59e41a
to
8bc0337
Compare
The following is the coverage report on the affected files.
|
8bc0337
to
755f3ff
Compare
The following is the coverage report on the affected files.
|
755f3ff
to
1d38854
Compare
The following is the coverage report on the affected files.
|
1d38854
to
c6f1b5c
Compare
The following is the coverage report on the affected files.
|
While migrating unit tests from Another thing I noticed in the same test is that the description has a termination message with a result that does not follow the struct format of a I am wondering, is this behavior intentional? On master, no test case catches this behavior. Lastly, ResourceRef is now a pointer. This ensures that an empty |
@@ -123,10 +123,10 @@ type PipelineResourceResult struct { | |||
Key string `json:"key"` | |||
Value string `json:"value"` | |||
ResourceName string `json:"resourceName,omitempty"` | |||
// This field should be deprecated and removed in the next API version. | |||
// The field ResourceName should be deprecated and removed in the next API version. |
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.
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.
You're right, it should actually be ResourceRef.
c6f1b5c
to
ce6b61a
Compare
The following is the coverage report on the affected files.
|
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.
While migrating unit tests from pkg/reconciler/taskrun/taskrun_test.go to pkg/pod/status/status.go I encountered one test case I don't fully understand.
I believe this test case aims to check whether a taskrun status is set to false if the corresponding task fails.
Nevertheless, this test case does not actually execute a function and the function it presumably would call is not responsible for setting the taskrun status. The described podStatus is also not set to fail.
In this PR I changed the test such that if a task (pod) fails it's checked whether the taskrun status is set accordingly.
Good catch. I think the idea of the original test was to confirm that a failed Task does not generate any Results. But as you say this test didn't actually call any functions and didn't test anything 😨
Another thing I noticed in the same test is that the description has a termination message with a result that does not follow the struct format of a PipelineResourceResult. For example, the key name does not exist as PipelineResourceResult field.
On master and also in this PR, such "results" get dropped from the taskrun termination message.
Once the termination message is unmarshalled into PipelineResourceResults, JSON objects that don't adhere to the PipelineResourceResult structure are dropped without error by the unmarshal function.
digest
and name
were fields used in the alpha API that have since been removed. Have a look through the git history of pkg/apis/pipeline/v1alpha1/resource_types.go
, for example, and you'll spot those field names. I think the best course of action is what you've done - removing the old test and codifying the behavior in a new test.
Lastly, ResourceRef is now a pointer. This ensures that an empty resourceRef field is not marshalled back into the termination message (zero values like a nil pointer are not marshalled) as is the case on master currently.
👍 I think this is totally fine.
I left some small nits but no blockers from my perspective! /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sbwsg 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 |
ce6b61a
to
cc22620
Compare
The following is the coverage report on the affected files.
|
/remove-label cleanup |
/kind feature |
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.
Mostly lgtm, just a few style/readability comments. 👍
cc22620
to
ebb25cc
Compare
In light of tektoncd#3087 the need for a ResultType that is not exposed as a TaskRunResult or PipelineResourceResult arises. In tektoncd#3087, a Step can emit a result indicating a Step timeout has occurred. This is a result that should not be exposed hence the need for a new ResultType called InternalTektonResultType. This commit ensures results of this type are filtered out. Introducing an InternalTektonResultType ensures a future proof solution to internal results that should not be exposed. Aside from the example in tektoncd#3087, a present candidate is the result written out by a Step containing a "StartedAt" key. Currently this result is filtered out with a specific function. Marking it as an InternalTektonResultType now allows for this result to automatically be filtered out. Additionally this commit brings about refactoring (and sometimes renaming) of functions related to converting pod statuses to taskrun statuses from pkg/reconciler/taskrun/taskrun.go to pkg/pod/status/status.go. This is accompanied with moving unit test cases from taskrun_test.go to status_test.go.
ebb25cc
to
20568a1
Compare
The following is the coverage report on the affected files.
|
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
Changes
This PR introduces a new TektonResultType namely 'InternalTektonResultType'.
Currently
TaskRunResultType
,PipelineResourceResultType
andUnknownResultType
exist as a ResultType for aPipelineResourceResult
.All results that conform to one of these
ResultTypes
are normally exposed as either as a task or resource result.In light of #3087 the need for a
ResultType
that is not exposed arises.In #3087, a
Step
can emit a result indicating aStep
timeout has occurred.This is a result that should not be exposed hence the need for a new
ResultType
namedInternalTektonResultType
.This PR ensures results of this type are filtered out.
Introducing an
InternalTektonResultType
ensures a future proof solution to internal results that should not be exposed as a TaskRun or PipelineResource result.Aside from the example in #3087, a present candidate is the result written out by a Step containing a "StartedAt" key.
Up until now this result is filtered out by a specific function.
Marking it as an
InternalTektonResultType
now allows for this result to automatically be filtered out.Up until this PR
Sidecars
can write results.Since this is not explicitly documented it's unclear whether this is intended behavior.
In this PR it's ensured only
Steps
can write results.Additionally this commit brings about refactoring/moving (and sometimes renaming) of functions related to converting
Pod
statuses toTaskRun
statuses frompkg/reconciler/taskrun/taskrun.go
topkg/pod/status/status.go
.This is accompanied with moving unit tests from
taskrun_test.go
tostatus_test.go
.Submitter Checklist
These are the criteria that every PR should meet, please check them off as you
review them:
See the contribution guide for more details.
Double check this list of stuff that's easy to miss:
cmd
dir, please updatethe release Task to build and release this image.
Reviewer Notes
If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.
Release Notes