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

Design and implement Pipeline Results for pipeline with finally tasks #2710

Closed
pritidesai opened this issue May 29, 2020 · 18 comments
Closed
Assignees
Labels
area/roadmap Issues that are part of the project (or organization) roadmap (usually an epic) kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.

Comments

@pritidesai
Copy link
Member

A new field finally is being introduced to PipelineSpec at the same level as Tasks, Params, and Workspaces. The finally field is a list of one or more PipelineTasks similar to Tasks that provide a guarantee that they are executed only once all PipelineTasks under tasks have completed regardless if that is because of success or error.

This new type is getting added with PR #2650 and functionality with PR #2661

While designing and implementing finally, task results were deferred to next iteration. Issue #2557 is tracking task results and in this issue, we will keep track of adding pipeline results to the pipeline with finally.

@pritidesai
Copy link
Member Author

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label May 29, 2020
@bobcatfish
Copy link
Collaborator

@pritidesai has created a WIP design at Task Results with finally

@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 15, 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
@vdemeester
Copy link
Member

/remove-lifecycle stale
/cc @pritidesai @jerop

@tekton-robot tekton-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 16, 2020
@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 Feb 14, 2021
@pritidesai
Copy link
Member Author

Reopening as this feature is not implemented yet. And will be a good feature to have finally task produce some kind of result and have it as part of the pipeline.

@pritidesai
Copy link
Member Author

/remove-lifecycle stale

@tekton-robot tekton-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 16, 2021
@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 May 17, 2021
@jerop
Copy link
Member

jerop commented May 17, 2021

/lifecycle frozen

may be useful even for pipelines in pipelines for the results from finally tasks to be passed to pipeline results

@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 May 17, 2021
@jerop
Copy link
Member

jerop commented Feb 17, 2022

Is the idea here that a Pipeline's Result can reference a Finally Task's Result using a variable $(finally.<pipeline-task-name>.results.<result-name>)?

Was curious to see what happens if a Pipeline's Result references a Finally Task's Result using a variable $(tasks.<pipeline-task-name>.results.<result-name>) - and found that it worked, is that expected behavior? If so, can we document this and close this issue? If not, can we fix it and provide the finally results in pipeline level, or do users depend on the existing behavior?

Example

Modified the Pipeline in the provided example as such:

# Pipeline to clone repo into shared workspace and cleanup the workspace after done
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: clone-cleanup-workspace
spec:
  results:
    - name: initialized
      value: $(tasks.check-git-commit.results.init)
  workspaces:
    # common workspace where git repo is cloned and needs to be cleanup after done
    - name: git-source
  tasks:
    # Clone app repo to workspace
    - name: clone-app-repo
      taskRef:
        name: git-clone-from-catalog
      params:
        - name: url
          value: https://github.com/tektoncd/community.git
        - name: subdirectory
          value: application
      workspaces:
        - name: output
          workspace: git-source
  finally:
    # Cleanup workspace
    - name: cleanup
      taskRef:
        name: cleanup-workspace
      workspaces:
        - name: source
          workspace: git-source
    - name: check-git-commit
      params:
        - name: commit
          value: $(tasks.clone-app-repo.results.commit)
      taskSpec:
        params:
          - name: commit
        results:
          - name: init
        steps:
          - name: check-commit-initialized
            image: alpine
            script: |
              if [[ ! $(params.commit) ]]; then
                exit 1
              fi
              printf true | tee /tekton/results/init

And this was the created PipelineRun, with the Finally Task's Result passed on to the Pipeline:

$ tkn pr describe -L
Name:              write-and-cleanup-workspace
Namespace:         default
Pipeline Ref:      clone-cleanup-workspace
Service Account:   default
Timeout:           1h0m0s
Labels:
 tekton.dev/pipeline=clone-cleanup-workspace

🌡️  Status

STARTED          DURATION     STATUS
42 seconds ago   26 seconds   Succeeded

📦 Resources

 No resources

⚓ Params

 No params

📝 Results

 NAME            VALUE
 ∙ initialized   true

📂 Workspaces

 NAME           SUB PATH   WORKSPACE BINDING
 ∙ git-source   ---        VolumeClaimTemplate

🗂  Taskruns

 NAME                                             TASK NAME          STARTED          DURATION     STATUS
 ∙ write-and-cleanup-workspace-check-git-commit   check-git-commit   24 seconds ago   7 seconds    Succeeded
 ∙ write-and-cleanup-workspace-cleanup            cleanup            24 seconds ago   8 seconds    Succeeded
 ∙ write-and-cleanup-workspace-clone-app-repo     clone-app-repo     42 seconds ago   18 seconds   Succeeded

⏭️  Skipped Tasks

 No Skipped Tasks

@jerop jerop added the area/roadmap Issues that are part of the project (or organization) roadmap (usually an epic) label Feb 17, 2022
@vsinghai
Copy link
Contributor

/assign @vsinghai

@vsinghai
Copy link
Contributor

This feature has been proposed in TEP-0116: Referencing Finally Task Results in Pipeline Results.

@jerop
Copy link
Member

jerop commented Aug 11, 2022

@jerop jerop closed this as completed Aug 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/roadmap Issues that are part of the project (or organization) roadmap (usually an epic) kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness.
Projects
Status: Done
Development

No branches or pull requests

6 participants