Skip to content

Consolidate Result spec/status types across Pipeline/Task #2825

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

Open
mattmoor opened this issue Jun 16, 2020 · 14 comments
Open

Consolidate Result spec/status types across Pipeline/Task #2825

mattmoor opened this issue Jun 16, 2020 · 14 comments
Assignees
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@mattmoor
Copy link
Member

This is relevant to duck typed tasks, but I hit this in the context of trying to write some library code that deals with results (both spec/status) in a common way.

Right now the result types are identical, and the spec types only differ in this Value field:

// PipelineResult used to describe the results of a pipeline
type PipelineResult struct {
	// Name the given name
	Name string `json:"name"`
	// Description is a human-readable description of the result
	// +optional
	Description string `json:"description"`
	// Value the expression used to retrieve the value
	Value string `json:"value"`
}

We will want a common type for these to live in our duck type anyways, so we should think about consolidating these shapes.

/assign @imjasonh

@imjasonh
Copy link
Member

Some context I didn't have before this bug: PipelineResult's Value field exists to be able to express some derived result value of the Pipeline, as derived from some of its constituent Tasks' results.

This example for instance:

  ...
  results:
    - name: sum
      description: the sum of all three operands
      value: $(tasks.second-add.results.sum)
    - name: partial-sum
      description: the sum of first two operands
      value: $(tasks.first-add.results.sum)
    - name: all-sum
      description: the sum of everything
      value: $(tasks.second-add.results.sum)-$(tasks.first-add.results.sum)

So when this Pipeline is run, its PipelineRunResults will have values derived from the values of some of its TaskRuns.

@mattmoor
Copy link
Member Author

One thing you can do there is to expose the same shape, but vary the validation.

This is a pretty common pattern for PodSpec, and ObjectReference (as widespread examples)

@bobcatfish
Copy link
Collaborator

I wonder if it would make sense to separate how a pipeline declares it will have results from how the results are set

@vdemeester
Copy link
Member

/kind cleanup

@tekton-robot tekton-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jun 18, 2020
@tekton-robot
Copy link
Collaborator

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.
If this issue is safe to close now please do so with /close.

/lifecycle rotten

Send feedback to tektoncd/plumbing.

@tekton-robot
Copy link
Collaborator

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

/close

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Aug 14, 2020
@tekton-robot
Copy link
Collaborator

@tekton-robot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

/close

Send feedback to tektoncd/plumbing.

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.

@vdemeester
Copy link
Member

/remove-lifecycle rotten
/remove-lifecycle stale
/reopen

@tekton-robot tekton-robot reopened this Aug 17, 2020
@tekton-robot
Copy link
Collaborator

@vdemeester: Reopened this issue.

In response to this:

/remove-lifecycle rotten
/remove-lifecycle stale
/reopen

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.

@tekton-robot tekton-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Aug 17, 2020
@tekton-robot
Copy link
Collaborator

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
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.

/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 Nov 15, 2020
@mattmoor
Copy link
Member Author

/lifecycle frozen

@tekton-robot tekton-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 15, 2020
@abayer
Copy link
Contributor

abayer commented Aug 11, 2022

This is probably worth resurrecting in the context of the various results work that's been underway recently - cc @lbernick @jerop

@Yongxuanzhang
Copy link
Member

Hi @mattmoor, I just want to confirm what we want to do with is issue. Those are the current result types, do we want to merge all of them into 1 type? Or 1 type for pipelinerun&taskrun, and 1 for pipeline&task?

type PipelineResult struct {
	Name string `json:"name"`
	Type ResultsType `json:"type,omitempty"`
	Description string `json:"description"`
	Value ArrayOrString `json:"value"`
}

type PipelineRunResult struct {
	Name string `json:"name"`
	Value ArrayOrString `json:"value"`
}

type TaskResult struct {
	Name string `json:"name"`
	Type ResultsType `json:"type,omitempty"`
	Properties map[string]PropertySpec `json:"properties,omitempty"`
	Description string `json:"description,omitempty"`
}

// TaskRunResult used to describe the results of a task
type TaskRunResult struct {
	Name string `json:"name"`
	Type ResultsType `json:"type,omitempty"`
	Value ArrayOrString `json:"value"`
}

@Yongxuanzhang
Copy link
Member

I can take this if needed. /assign @Yongxuanzhang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
Status: Todo
Development

No branches or pull requests

7 participants