Skip to content
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

Implementation details for results emitting in TEP-0076 #4805

Closed
Yongxuanzhang opened this issue Apr 27, 2022 · 3 comments
Closed

Implementation details for results emitting in TEP-0076 #4805

Yongxuanzhang opened this issue Apr 27, 2022 · 3 comments
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@Yongxuanzhang
Copy link
Member

Feature request

This is part of #4723 area 2.

Right now the results are written to /tekton/results/resultname file, and the content will be read and stored as string in v1beta1.PipelineResourceResult 's value, later it will be written to termination message.

To support array and later object type for results. I suggest we change the type of
v1beta1.PipelineResourceResult.Value from string to v1beta1.ArrayOrString, and when we read the bytes from results file we can check and unmarshal them into v1beta1.ArrayOrString.

The pro of this is that the json marshal and unmarshal will be easier when handling results data.

This can be done here

for _, resultFile := range e.Results {
if resultFile == "" {
continue
}
fileContents, err := ioutil.ReadFile(filepath.Join(pipeline.DefaultResultPath, resultFile))
if os.IsNotExist(err) {
continue
} else if err != nil {
return err
}
// if the file doesn't exist, ignore it
output = append(output, v1beta1.PipelineResourceResult{
Key: resultFile,
Value: string(fileContents),
ResultType: v1beta1.TaskRunResultType,
})

For later json schema validation, as suggested by @ywluogg, we can validate later here, since we can easily get the taskspec.

pipeline/pkg/pod/status.go

Lines 224 to 232 in 68f2a66

for _, r := range results {
switch r.ResultType {
case v1beta1.TaskRunResultType:
taskRunResult := v1beta1.TaskRunResult{
Name: r.Key,
Value: r.Value,
}
taskResults = append(taskResults, taskRunResult)
filteredResults = append(filteredResults, r)

Use case

@Yongxuanzhang Yongxuanzhang added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 27, 2022
@Yongxuanzhang
Copy link
Member Author

/assign

@tekton-robot
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale with a justification.
Stale issues rot after an additional 30d of inactivity and eventually close.
If this issue is safe to close now please do so with /close with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/lifecycle stale

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 26, 2022
@Yongxuanzhang
Copy link
Member Author

Already done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

2 participants