-
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
[TEP-0076]Add type for results #4779
Conversation
The following is the coverage report on the affected files.
|
@ywluogg is this the right direction for first step? |
The following is the coverage report on the affected files.
|
/assign @ywluogg |
@Yongxuanzhang: GitHub didn't allow me to assign the following users: ywluogg. Note that only tektoncd members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time. 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. |
pkg/apis/pipeline/v1beta1/results.go
Outdated
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. |
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 see params for the similar file is called params_types.go. Maybe it worths being consistent with params?
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 this is also something I'm not sure. I thought files ended with "_types" should have a crd in it.
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.
That's a pretty good consideration. I think TaskResult is actually similar to ParamsSpec:
type ParamSpec struct { |
type Param struct { |
Maybe we can move those structs into a centralized file results_types.go.
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.
yeah that would also work, I can do it and see how other ppl think of it
pkg/apis/pipeline/v1beta1/results.go
Outdated
|
||
// ResultsType indicates the type of a result; | ||
// Used to distinguish between a single string and an array of strings. | ||
type ResultsType 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.
Maybe it should start having an interface for ResultType and ParamsType, as they ultimately need to be in ArrayOrString:
type ArrayOrString struct { |
Pinging others @dibyom @vdemeester for more opinions
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.
Any reason for not moving them to ArrayOrString
"now", as, from the API perspective (consumption) it doesn't change too much, all current API usage will still work because string
is still supported.
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.
Good point! I would suggest to add a TODO for changing this to have ResultType also in scope
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
The following is the coverage report on the affected files.
|
/test pull-tekton-pipeline-integration-tests |
/test pull-tekton-pipeline-integration-tests |
/test pull-tekton-pipeline-alpha-integration-tests |
1 similar comment
/test pull-tekton-pipeline-alpha-integration-tests |
The following is the coverage report on the affected files.
|
5736fec
to
3e10239
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dibyom, ywluogg 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 |
d044d78
to
4b30812
Compare
The following is the coverage report on the affected files.
|
/test pull-tekton-pipeline-integration-tests |
/test pull-tekton-pipeline-alpha-integration-tests |
1 similar comment
/test pull-tekton-pipeline-alpha-integration-tests |
} | ||
// Validate the result type | ||
validType := false | ||
for _, allowedType := range AllResultsTypes { |
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.
nit: we've used sets.String elsewhere in the codebase, might be helpful here https://pkg.go.dev/k8s.io/apimachinery@v0.23.6/pkg/util/sets
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.
yeah I was using map before, and I see param type is using a list. 😄 I will change it to sets.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.
emmm maybe I'm wrong, looks like I cannot use sets.String
here, because sets.String
is using string
as key but we're using ResultsType
The following code will throw error
var AllResultsTypes = sets.String{ResultsTypeString:{}}
This commit is the first step of TEP-0076, to support array and object in resutls we need to add type for TaskResult and TaskRunResult first. Before this commit we don't have the Type for these results.
4b30812
to
c8f3fb5
Compare
The following is the coverage report on the affected files.
|
/lgtm |
/test pull-tekton-pipeline-alpha-integration-tests |
This commit fixes the string result type validation, PR tektoncd#4779 adds result type and asumes that the default type should be string via mutating webhook. PR tektoncd#4818 adds the validation for this. However, resources that did already exist in etcd didn't get the default. So this commit relaxes this validation.
This commit fixes the string result type validation, PR tektoncd#4779 adds result type and asumes that the default type should be string via mutating webhook. PR tektoncd#4818 adds the validation for this. However, resources that did already exist in etcd didn't get the default. So this commit relaxes this validation.
This commit fixes the string result type validation, PR tektoncd#4779 adds result type and asumes that the default type should be string via mutating webhook. PR tektoncd#4818 adds the validation for this. However, resources that did already exist in etcd didn't get the default. So this commit relaxes the validation for empty result type.
This commit fixes the string result type validation, PR tektoncd#4779 adds result type and asumes that the default type should be string via mutating webhook. PR tektoncd#4818 adds the validation for this. However, resources that did already exist in etcd didn't get the default. So this commit relaxes the validation for empty result type.
This commit fixes the string result type validation, PR #4779 adds result type and asumes that the default type should be string via mutating webhook. PR #4818 adds the validation for this. However, resources that did already exist in etcd didn't get the default. So this commit relaxes the validation for empty result type.
This commit fixes the string result type validation, PR tektoncd#4779 adds result type and asumes that the default type should be string via mutating webhook. PR tektoncd#4818 adds the validation for this. However, resources that did already exist in etcd didn't get the default. So this commit relaxes the validation for empty result type. Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
This commit fixes the string result type validation, PR #4779 adds result type and asumes that the default type should be string via mutating webhook. PR #4818 adds the validation for this. However, resources that did already exist in etcd didn't get the default. So this commit relaxes the validation for empty result type. Signed-off-by: Andrea Frittoli <andrea.frittoli@uk.ibm.com>
This commit fixes the string result type validation, PR tektoncd#4779 adds result type and asumes that the default type should be string via mutating webhook. PR tektoncd#4818 adds the validation for this. However, resources that did already exist in etcd didn't get the default. So this commit relaxes the validation for empty result type.
This commit fixes the string result type validation, PR #4779 adds result type and asumes that the default type should be string via mutating webhook. PR #4818 adds the validation for this. However, resources that did already exist in etcd didn't get the default. So this commit relaxes the validation for empty result type.
Changes
This commit is the first step of TEP-0076, to support array and object
in resutls we need to add type for TaskResult and TaskRunResult first.
Before this commit we don't have the Type for these results.
Besides, for we move the
TaskResult
andTaskRunResult
into the centralizedresult_types.go
, so it will be consistent withpararm_types.go
Submitter Checklist
As the author of this PR, please check off the items in this checklist:
functionality, content, code)
(if there are no user facing changes, use release note "NONE")
Release Notes