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

Support using a PipelineTask in the Pipeline CRD to run other Pipelines the same way we run a Task (nest pipelines in pipelines) #2134

Open
skaegi opened this issue Mar 2, 2020 · 30 comments
Assignees
Labels
area/roadmap Issues that are part of the project (or organization) roadmap (usually an epic) help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. 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

@skaegi
Copy link
Contributor

skaegi commented Mar 2, 2020

Pipelines group tasks together in a workflow. It would be incredibly useful to be able to re-use that mechanism to create sub-workflows.

Pipelines and Tasks both take Params, Workspaces, and generate Results so with a little work it should be possible to use a PipelineRef in place of a TaskRef when defining a Pipeline Task. For the other aspects required to generate a "sub"-PipelineRun these could be inherited from the parent PipelineRun.

Here's a basic example to illustrate syntax...

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: pipeline-calling-pipeline
spec:
  params:
  - name: best-param-ever
  workspaces:
  - name: pipeline-ws1
  tasks:
  - name: pipeline-in-task-clothing
    pipelineRef:
      name: some-sub-pipeline
    workspaces:
    - name: sub-pipeline-ws0
      workspace: pipeline-ws1
  - name: regular-task
    taskRef:
      name: some-task
    params:
    - name: new-input
      value: $(tasks.pipeline-in-task-clothing.results.some-ouput)
    workspaces:
    - name: src
      workspace: pipeline-ws1
    runAfter:
    - pipeline-in-task-clothing

In a nutshell, other than using pipelineRef in-place of taskRef the definitions behave the same.

@vdemeester
Copy link
Member

/kind feature

@tekton-robot tekton-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 3, 2020
@bobcatfish bobcatfish changed the title Support using a PipelineTask in the Pipeline CRD to run other Pipelines the same way we run a Task Support using a PipelineTask in the Pipeline CRD to run other Pipelines the same way we run a Task (nest pipelines in pipelines) Mar 26, 2020
@bobcatfish bobcatfish self-assigned this Apr 20, 2020
@bobcatfish
Copy link
Collaborator

pipeline-in-task-clothing

image

@jlpettersson
Copy link
Member

Pipelines and Tasks both take Params, Workspaces, and generate Results so with a little work it should be possible to use a PipelineRef in place of a TaskRef when defining a Pipeline Task. For the other aspects required to generate a "sub"-PipelineRun these could be inherited from the parent PipelineRun.

I feel the use case is a bit unclear here. But I do have things that reminds me about this. E.g. The use-case I describe in #2505 (comment) - there I use (or "link") two PipelineRun and reuse the workspace volume.

On the other hand, I will have another use-case that also reminds a bit. But one fundamental difference is that I probably want to have it asynchronous. When talking about "linking" Pipelines or "chain", it may be done synchronous or asynchronous. That is also related to e.g. introducing asynchronous tasks - but I need to think about it more.

@madbence
Copy link

This feature would be really useful for us. eg. right now we have a task that can set the status on a given commit, and a task that can execute unit tests (eg. run npm test, etc.). We'd like to distribute a task/pipeline that can combine these (eg. set the commit to pending, run unit tests, set commit status to success/failure).

nested-pipeline

we'd like to provide to option to use set-status and run-unit-tests in a pipeline, and to be able to use a "higher-level" task, like "run-unit-tests-with-commit-status".

@bobcatfish
Copy link
Collaborator

Thanks for the use case @madbence this looks exactly along the lines we're thinking as well - just to double check, set-status sets the status of something like a GitHub check (or similar using non-GitHub)?

@bobcatfish
Copy link
Collaborator

oh and i forgot to post here some relevant links:

@madbence
Copy link

@bobcatfish exactly, set-status creates a commit status.

@vdemeester
Copy link
Member

cc @mattmoor

@bobcatfish
Copy link
Collaborator

Tekton custom tasks would let us have this feature and more; planning to put this feature on hold until we have custom tasks and then we can decide if we want it as a top level feature or not.

@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
@dbazhal
Copy link

dbazhal commented Sep 10, 2020

Couldn't this issue be done without custom tasks? We're in pain from disability to include pipelines into pipelines :) Problem is that we have to include task "run_pipeline" each time when we want to include pipeline inside pipeline. Each time such "incuded" pipeline fails, there is no easy way to find out why subpipeline failed, or what tasks it contained, etc.

@JPEWdev
Copy link

JPEWdev commented Nov 9, 2020

I also would really like support for running pipelines inside of pipelines. This is really useful for the case were you want some "super pipeline" that runs different variants of the same sub pipeline with different arguments (i.e. like a matrix/parameterized build from most other CI systems), provided that it can run all the sub-pipelines in parallel with different workspaces.

@JPEWdev
Copy link

JPEWdev commented Nov 9, 2020

I also would really like support for running pipelines inside of pipelines. This is really useful for the case were you want some "super pipeline" that runs different variants of the same sub pipeline with different arguments (i.e. like a matrix/parameterized build from most other CI systems), provided that it can run all the sub-pipelines in parallel with different workspaces.

Also I would like to point out that it would only really be useful if the subpipelines could be scheduled on different nodes. My (limited) understanding of tekton is that this might be difficult if the parent pipeline has to specify the workspace

@dbazhal
Copy link

dbazhal commented Nov 9, 2020

Also I would like to point out that it would only really be useful if the subpipelines could be scheduled on different nodes. My (limited) understanding of tekton is that this might be difficult if the parent pipeline has to specify the workspace

agreed. Work with workspaces is sometimes pain, double pain if super-pipeline can't create ws, so Super-pipeline runs 1) task to create ws 2) each sub-pipeline with passing it workspace as argument 3) has to finish with task that deleted ws.

Also, i dont know how it could be done, but it would be better to aggregate sub-pipelines bodies into single pipelinerun. Creating separate pipeline run for each "sub"-pipeline makes it difficult to read logs of each task in each sub-pipeline(even more difficult with openshift tekton pipelines web-interface), it makes sub-pipelines execute slower(running pipelinerun isnt flash-fast itself, and it makes sometimes passing same arguments to each sub-pipeline a lot of copy-paste work.

@bobcatfish bobcatfish added the area/roadmap Issues that are part of the project (or organization) roadmap (usually an epic) label Feb 24, 2021
@HerrmannHinz
Copy link

super helpful. would finally allow us to "chain" pipelines. plz 🙏

jerop added a commit to jerop/experimental that referenced this issue Feb 25, 2021
This is an experimental project to provide support for `Pipelines` in
`Pipelines` to improve the composability and reusability of
[Tekton Pipelines](https:/tektoncd/pipeline).

The functionality is provided by a controller
that implements the `Custom Task` interface.

Its use cases include enabling defining and executing a set of `Tasks`
as a complete unit of execution and decoupling `Pipeline` branches
failures such that a `Task` failure in one branch does not stop
execution of unrelated `Pipeline` branches.

Experimental project is proposed in tektoncd/community#330
Issue is further described in tektoncd/pipeline#2134
jerop added a commit to jerop/experimental that referenced this issue Feb 26, 2021
This is an experimental project to provide support for `Pipelines` in
`Pipelines` to improve the composability and reusability of
[Tekton Pipelines](https:/tektoncd/pipeline).

The functionality is provided by a controller
that implements the `Custom Task` interface.

Its use cases include enabling defining and executing a set of `Tasks`
as a complete unit of execution and decoupling `Pipeline` branches
failures such that a `Task` failure in one branch does not stop
execution of unrelated `Pipeline` branches.

Experimental project is proposed in tektoncd/community#330
Issue is further described in tektoncd/pipeline#2134
jerop added a commit to jerop/experimental that referenced this issue Feb 26, 2021
This is an experimental project to provide support for `Pipelines` in
`Pipelines` to improve the composability and reusability of
[Tekton Pipelines](https:/tektoncd/pipeline).

The functionality is provided by a controller
that implements the `Custom Task` interface.

Its use cases include enabling defining and executing a set of `Tasks`
as a complete unit of execution and decoupling `Pipeline` branches
failures such that a `Task` failure in one branch does not stop
execution of unrelated `Pipeline` branches.

Experimental project is proposed in tektoncd/community#330
Issue is further described in tektoncd/pipeline#2134
tekton-robot pushed a commit to tektoncd/experimental that referenced this issue Feb 26, 2021
This is an experimental project to provide support for `Pipelines` in
`Pipelines` to improve the composability and reusability of
[Tekton Pipelines](https:/tektoncd/pipeline).

The functionality is provided by a controller
that implements the `Custom Task` interface.

Its use cases include enabling defining and executing a set of `Tasks`
as a complete unit of execution and decoupling `Pipeline` branches
failures such that a `Task` failure in one branch does not stop
execution of unrelated `Pipeline` branches.

Experimental project is proposed in tektoncd/community#330
Issue is further described in tektoncd/pipeline#2134
@aelbarkani
Copy link

+1 for this feature, very helpful for reusing pipelines !

@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 Oct 15, 2021
@jerop
Copy link
Member

jerop commented Oct 15, 2021

/lifecycle frozen

TEP-0056: Pipelines in Pipelines
Experimental Project

@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 Oct 15, 2021
@jerop
Copy link
Member

jerop commented Feb 7, 2023

TEP-0056 proposing Pipelines in Pipelines is implementable - we welcome contributions in implementing it

https:/tektoncd/community/blob/main/teps/0056-pipelines-in-pipelines.md

/help-wanted

@jerop jerop added the help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. label Feb 7, 2023
@EmmaMunley
Copy link
Contributor

Happy to start working on implementing TEP-0056.

/assign @EmmaMunley

@ChrisPaul33
Copy link

Hi, there are any updates about the implementation of the feature?

@pritidesai
Copy link
Member

Hi @ChrisPaul33, we have started implementing this feature. What API version are you currently using? Looking for some insight for - #7055 (comment)

@EmmaMunley EmmaMunley removed their assignment Aug 23, 2023
@ChrisPaul33
Copy link

Hello @pritidesai, we are currently using v1beta1.
We are still trying to migrate to Tekton so migrating from v1beta1 to v1 for us won't be a big deal.
I will try my best to look at #7055.

@uqix
Copy link

uqix commented Nov 30, 2023

Is matrix with pipelineRef supported?

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) help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. 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: Todo
Status: In Progress
Development

No branches or pull requests