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

Pipeline Results #1950

Closed
ghost opened this issue Jan 27, 2020 · 5 comments
Closed

Pipeline Results #1950

ghost opened this issue Jan 27, 2020 · 5 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. maybe-next-milestone For consideration when planning the next milestone

Comments

@ghost
Copy link

ghost commented Jan 27, 2020

Expected Behavior

A Pipeline should be able to declare a list of results that should be emitted by any executed Tasks of that Pipeline.

Actual Behavior

At the moment the results of Tasks in a Pipeline will be buried in the TaskRuns' Status fields.

Steps to Reproduce the Problem

  1. Run a Pipeline that uses Tasks that emit results.
  2. Notice that the created PipelineRun does not include any of those tasks' results in its Status.

Additional Info

Task Results were introduced in issue #1273

Here's an example of the kind of YAML we'd like to be able to support, as proposed by @skaegi in #1273. Notice that the Pipeline declares the results that it will emit and uses variable substitution to indicate which tasks those pipeline results come from:

apiVersion: tekton.dev/v1alpha1
kind: Task
metadata:
  name: add
spec:
  params:
    - name: first
      description: the first operand
    - name: second
      description: the second operand
  results:
    - name: sum
      description: the sum of the first and second operand
  steps:
    - name: add
      image: alpine
      env:
        - name: OP1
          value: $(params.first)
        - name: OP2
          value: $(params.second)        
      command: ["/bin/sh", "-c"]
      args:
        - echo $((${OP1}+${OP2})) | tee /workspace/results/sum;
---
apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
  name: sum-three 
spec:
  params:
    - name: first
      description: the first operand
    - name: second
      description: the second operand
    - name: third
      description: the third operand      
  tasks:
    - name: first-add
      taskRef:
        name: add-task
      params:
        - name: first
          value: $(params.first)
        - name: second
          value: $(params.second)
    - name: second-add
      runAfter: [first-add]
      taskRef:
        name: add-task
      params:
        - name: first
          value: $(tasks.first-add.results.sum)
        - name: second
          value: $(params.third)
  results:
    - name: sum
      description: the sum of all three operands
      value: $(tasks.second-add.results.sum)
@ghost ghost added kind/feature Categorizes issue or PR as related to a new feature. maybe-next-milestone For consideration when planning the next milestone labels Jan 27, 2020
@othomann
Copy link
Contributor

othomann commented Mar 5, 2020

I have a patch for this one. Works pretty well. The only thing I am not sure is how to add a test case that checks pipeline runs get results.

@othomann
Copy link
Contributor

othomann commented Mar 6, 2020

@sbwsg @bobcatfish I opened PR #2178 for this issue. Let me know there what you think.

@ghost ghost mentioned this issue Apr 6, 2020
3 tasks
@ghost
Copy link
Author

ghost commented Apr 6, 2020

Marking as closed, since #2178 is now merged.

@ghost ghost closed this as completed Apr 6, 2020
@bobcatfish
Copy link
Collaborator

Thanks for linking to this from #2178 @sbwsg - I'm still not 100% clear on what the use cases are for this, is it possible to get a CI/CD example for this one even though we've finished working on it?

In the example above, it seems like the information in the pipeline level result will be available in the status of the pipeline overall with or without pipeline level results.

Task level results seemed to fill 2 needs:

  1. Passing values between Tasks in a Pipeline
  2. Providing info for other tools to audit (e.g. what commit ID was actually pulled when master was specified)

It seems like Pipeline level results are doing something like (2) but the values are available even without them - is this required for UI use cases?

@ghost
Copy link
Author

ghost commented Apr 8, 2020

I'm going to rope in @skaegi here to hopefully provide a bit more meaningful info because I don't have particularly concrete use-cases. I think you're right that we haven't documented them at all for this feature.

I think UI is one potential use-case but as you mentioned the results in the TaskRun statuses already appear in the PipelineRun status.

Another potential use I see at the moment relates to the tentative ideas we have for Pipelines-runnning-Pipelines: the results of a sub-pipeline could be passed on to subsequent tasks / sub-pipelines. This still doesn't really totally justify the inclusion of this feature now though.

This issue was closed.
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. maybe-next-milestone For consideration when planning the next milestone
Projects
None yet
Development

No branches or pull requests

2 participants