-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 Task looping syntax inside Pipelines #2050
Comments
As long as we don't have Tekton dynamically creating Pipelines I'm all for this. I'd like to see this more like a Python "list comprehension" vs. a looping construct that allows for parts of Pipelines to execute in loops. |
re: comprehension -- yes, that's where my head is at too |
I also would like a feature like this but at the Task Step level where the input is an array, and for each element in the array it explodes out into n steps. |
To me ansible loops syntax look pretty nice. As very weak, but example, it could be used to run task for multiple cluster resources.
|
This type of fan-out tasks will also require syntax / logic for tasks to:
Conditions may be attached to the task. Do we run the condition N times? Ideally if we had a way to determine whether the condition depends on the param that generates the fan-out - we could run the condition one, but in general we will need to run it once for each instance of the task. |
In my use case, I don't need access to the results or outputs, I'm just relying on the success or failure of the task. So maybe there's room for a first iteration of this facility that doesn't have all the bells and whistles, but allows a simple fan out |
Even though there are cases that do not require results, I think it would be good to have support as part of the general solution since it makes it consistent with the Task interface. Another decision we have to make here is around supporting parallel vs sequential task running. It might make a lot of sense here if we adopted the semantics of
This is borrowing a lot from what was spec'ed in Javascript Map and Reduce which in turn borrowed heavily from the ideas in Python. |
Couple questions that spring to mind:
What I particularly like about this is it seems we could statically generate the entire Pipeline plan from this format. Does that sound right? If so that in turn leads me to think we could explore this in an experimental tool/library external to the controller initially. If we wrote this as a library then it could be reusable in |
Pre-generation only works if tasks are only allowed to iterate on statically-defined arrays and not on the results of previous tasks. This seems like a key decision that has to be made. |
Yes that's correct re: runAfter (although it really would be nice to have a higher order framing concept) The idea was definitely that the structure can be statically generated at "TaskRun" time however the array might come from a previous TaskRun result so the structure cannot always be created before the pipeline run. (and repeating what @GregDritschler also said!) |
I believe Argo Workflow supports looping, recursion, etc. It might be useful to explore how it's done there for ideas, although I'm not sure if it satisfies everyones' use cases. |
I take back my earlier comment that static Pipeline generation wouldn't allow iterating on task results. If we assume that iterating on task results means "iterate on the results of a previous task which itself was iterated", then both tasks have the same number of iterations. Therefore it would be possible to generate the pipeline tasks and appropriately map the result references. I came up with a starting list of functional considerations for task iteration, independently of how it may end up being implemented.
|
@jcmcken yes Argo has full featured looping and recursion support - @Tomcli can point to some implementation details there |
Thanks @GregDritschler for the detailed analysis - is this being discussed in any workgroup meeting on Tekton side? |
@animeshsingh There was a discussion this past Monday, mainly around whether there are sufficient CI/CD use cases to justify doing it in Tekton. That's where it stands for now. |
I wanted to write about my use case. There is kaniko |
@GregDritschler above is an exact example - dynamic parallel steps needed to complete a task based on the output of previous step, and used in multiple CI/CD scenarios. |
Great to know tekton could support this feature! It's true out of the control in current tekton pipeline, if the loop parameters are defined by user as input parameters or it's the result of another task in the pipeline. We may need to support both the parameters with array list, e.g [a, b, c, d] and also array list with dict inside, e.g [{'a': 1, 'b': 2}, {'a': 10, 'b': 20}]. Then only one loop param need to be considerred to support muilt loop params. I would like to provide you the example of how it defined in an argo yaml file: array list param: array list with dict param: |
Another use case: I've got a pipeline that uses a git as an input resource, reads a config file and generates a set of tekton-results containing dependent gits. i.e result-1=git-1 , result-2=git-2 etc.. then I run a git-clone task to clone git-1 , git-2 etc.. I've also got a condition that checks if result result-1 is not null before running a git-clone task.. so I'd really like a loop which runs on a set of parameters which is passed to a condition, and if the condition returns true, checks out the corresponding git.. At the moment, I've got separate conditions for each variable and hence separate git-clone tasks for each 'true' condition. Would cut my yaml file down to a few lines from a few hundreds of lines. |
Does this issue has any progress? |
@fenglixa I think that @GregDritschler has been continuing to iterate on the design he proposed. @imjasonh has also been working on a mechanism to make it easier to prototype workflow features via "custom tasks", which we may want to use to prototype this. And we've been discussing both of these in our api working group if you are interested in joining or following along :D |
hey all, I'm reposting the question I asked in slack and was directed to this issue. Totally looking forward to this feature!
That said, in addition to the simpler scenario of just being able to iterate to generate N single Right now I'm doing all of this by just having a statically defined single |
This change adds the problem statement for Looping. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to the same `Task` or `Custom Task` - that is, fan out their `Task` or `Custom Tasks`. In this TEP, we aim to provide a way to run the same `Task` or `Custom Task` with varying `Parameters` by spinning up a `TaskRun` or `Run` for each `Parameter` in a loop. This looping construct is aimed at improving the composability, scalability, flexibility and reusability of *Tekton Pipelines*. References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Looping. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to the same `Task` or `Custom Task` - that is, fan out their `Task` or `Custom Tasks`. In this TEP, we aim to provide a way to run the same `Task` or `Custom Task` with varying `Parameters` by spinning up a `TaskRun` or `Run` for each `Parameter` in a loop. This looping construct is aimed at improving the composability, scalability, flexibility and reusability of *Tekton Pipelines*. References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Looping. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to the same `Task` or `Custom Task` - that is, fan out their `Task` or `Custom Tasks`. In this TEP, we aim to provide a way to run the same `Task` or `Custom Task` with varying `Parameters` by spinning up a `TaskRun` or `Run` for each `Parameter` in a loop. This looping construct is aimed at improving the composability, scalability, flexibility and reusability of *Tekton Pipelines*. References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Looping. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to the same `Task` or `Custom Task` - that is, fan out their `Task` or `Custom Tasks`. In this TEP, we aim to provide a way to run the same `Task` or `Custom Task` with varying `Parameters` by spinning up a `TaskRun` or `Run` for each `Parameter` in a loop. This looping construct is aimed at improving the composability, scalability, flexibility and reusability of *Tekton Pipelines*. References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Looping. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to the same `Task` or `Custom Task` - that is, fan out their `Task` or `Custom Tasks`. In this TEP, we aim to provide a way to run the same `Task` or `Custom Task` with varying `Parameters` by spinning up a `TaskRun` or `Run` for each `Parameter` in a loop. This looping construct is aimed at improving the composability, scalability, flexibility and reusability of *Tekton Pipelines*. References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Looping. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to the same `Task` or `Custom Task` - that is, fan out their `Task` or `Custom Tasks`. In this TEP, we aim to provide a way to run the same `Task` or `Custom Task` with varying `Parameters` by spinning up a `TaskRun` or `Run` for each `Parameter` in a loop. This looping construct is aimed at improving the composability, scalability, flexibility and reusability of *Tekton Pipelines*. References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Looping. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to the same `Task` or `Custom Task` - that is, fan out their `Task` or `Custom Tasks`. In this TEP, we aim to provide a way to run the same `Task` or `Custom Task` with varying `Parameters` by spinning up a `TaskRun` or `Run` for each `Parameter` in a loop. This looping construct is aimed at improving the composability, scalability, flexibility and reusability of *Tekton Pipelines*. References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Looping. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to the same `Task` or `Custom Task` - that is, fan out their `Task` or `Custom Tasks`. In this TEP, we aim to provide a way to run the same `Task` or `Custom Task` with varying `Parameters` by spinning up a `TaskRun` or `Run` for each `Parameter` in a loop. This looping construct is aimed at improving the composability, scalability, flexibility and reusability of *Tekton Pipelines*. References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Matrix. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to execute a `PipelineTask`, that is, fan out a `PipelineTasks`. To solve this problem, this TEP aims to enable executing the same `PipelineTask` with different combinations of `Parameters` specified in a `matrix`. `TaskRuns` or `Runs` will be created with variables substituted with each combination of the `Parameters` in the `matrix`. This `matrix` construct will enable users to specify concise but powerful `Pipelines`. Moreover, it would improve the composability, scalability, flexibility and reusability of *Tekton Pipelines*. References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Matrix. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to execute a `PipelineTask`, that is, fan out a `PipelineTasks`. To solve this problem, this TEP aims to enable executing the same `PipelineTask` with different combinations of `Parameters` specified in a `matrix`. `TaskRuns` or `Runs` will be created with variables substituted with each combination of the `Parameters` in the `matrix`. This `matrix` construct will enable users to specify concise but powerful `Pipelines`. Moreover, it would improve the composability, scalability, flexibility and reusability of *Tekton Pipelines*. References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Matrix. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to execute a `PipelineTask`, that is, fan out a `PipelineTasks`. To solve this problem, this TEP aims to enable executing the same `PipelineTask` with different combinations of `Parameters` specified in a `matrix`. `TaskRuns` or `Runs` will be created with variables substituted with each combination of the `Parameters` in the `matrix`. This `matrix` construct will enable users to specify concise but powerful `Pipelines`. Moreover, it would improve the composability, scalability, flexibility and reusability of *Tekton Pipelines*. References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Matrix. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to execute a `PipelineTask`, that is, fan out a `PipelineTasks`. To solve this problem, this TEP aims to enable executing the same `PipelineTask` with different combinations of `Parameters` specified in a `matrix`. `TaskRuns` or `Runs` will be created with variables substituted with each combination of the `Parameters` in the `matrix`. This `matrix` construct will enable users to specify concise but powerful `Pipelines`. Moreover, it would improve the composability, scalability, flexibility and reusability of *Tekton Pipelines*. References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Matrix. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to execute a `PipelineTask`, that is, fan out a `PipelineTasks`. To solve this problem, this TEP aims to enable executing the same `PipelineTask` with different combinations of `Parameters` specified in a `matrix`. `TaskRuns` or `Runs` will be created with variables substituted with each combination of the `Parameters` in the `matrix`. This `matrix` construct will enable users to specify concise but powerful `Pipelines`. Moreover, it would improve the composability, scalability, flexibility and reusability of *Tekton Pipelines*. https://github.com/jerop/community/blob/looping/teps/0090-matrix.md References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Matrix. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to execute a `PipelineTask`, that is, fan out a `PipelineTasks`. To solve this problem, this TEP aims to enable executing the same `PipelineTask` with different combinations of `Parameters` specified in a `matrix`. `TaskRuns` or `Runs` will be created with variables substituted with each combination of the `Parameters` in the `matrix`. This `matrix` construct will enable users to specify concise but powerful `Pipelines`. Moreover, it would improve the composability, scalability, flexibility and reusability of *Tekton Pipelines*. https://github.com/jerop/community/blob/looping/teps/0090-matrix.md References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Matrix. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to execute a `PipelineTask`, that is, fan out a `PipelineTasks`. To solve this problem, this TEP aims to enable executing the same `PipelineTask` with different combinations of `Parameters` specified in a `matrix`. `TaskRuns` or `Runs` will be created with variables substituted with each combination of the `Parameters` in the `matrix`. This `matrix` construct will enable users to specify concise but powerful `Pipelines`. Moreover, it would improve the composability, scalability, flexibility and reusability of *Tekton Pipelines*. https://github.com/jerop/community/blob/looping/teps/0090-matrix.md References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Matrix. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to execute a `PipelineTask`, that is, fan out a `PipelineTasks`. To solve this problem, this TEP aims to enable executing the same `PipelineTask` with different combinations of `Parameters` specified in a `matrix`. `TaskRuns` or `Runs` will be created with variables substituted with each combination of the `Parameters` in the `matrix`. This `matrix` construct will enable users to specify concise but powerful `Pipelines`. Moreover, it would improve the composability, scalability, flexibility and reusability of *Tekton Pipelines*. https://github.com/jerop/community/blob/looping/teps/0090-matrix.md References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Matrix. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to execute a `PipelineTask`, that is, fan out a `PipelineTasks`. To solve this problem, this TEP aims to enable executing the same `PipelineTask` with different combinations of `Parameters` specified in a `matrix`. `TaskRuns` or `Runs` will be created with variables substituted with each combination of the `Parameters` in the `matrix`. This `matrix` construct will enable users to specify concise but powerful `Pipelines`. Moreover, it would improve the composability, scalability, flexibility and reusability of *Tekton Pipelines*. https://github.com/jerop/community/blob/looping/teps/0090-matrix.md References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Matrix. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to execute a `PipelineTask`, that is, fan out a `PipelineTasks`. To solve this problem, this TEP aims to enable executing the same `PipelineTask` with different combinations of `Parameters` specified in a `matrix`. `TaskRuns` or `Runs` will be created with variables substituted with each combination of the `Parameters` in the `matrix`. This `matrix` construct will enable users to specify concise but powerful `Pipelines`. Moreover, it would improve the composability, scalability, flexibility and reusability of *Tekton Pipelines*. https://github.com/jerop/community/blob/looping/teps/0090-matrix.md References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Matrix. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to execute a `PipelineTask`, that is, fan out a `PipelineTasks`. To solve this problem, this TEP aims to enable executing the same `PipelineTask` with different combinations of `Parameters` specified in a `matrix`. `TaskRuns` or `Runs` will be created with variables substituted with each combination of the `Parameters` in the `matrix`. This `matrix` construct will enable users to specify concise but powerful `Pipelines`. Moreover, it would improve the composability, scalability, flexibility and reusability of *Tekton Pipelines*. https://github.com/jerop/community/blob/looping/teps/0090-matrix.md References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
This change adds the problem statement for Matrix. It scopes the problem, describes the use cases, and identifies the goals, the requirements for the solution, and related work in other continuous delivery systems. Today, users cannot supply varying `Parameters` to execute a `PipelineTask`, that is, fan out a `PipelineTasks`. To solve this problem, this TEP aims to enable executing the same `PipelineTask` with different combinations of `Parameters` specified in a `matrix`. `TaskRuns` or `Runs` will be created with variables substituted with each combination of the `Parameters` in the `matrix`. This `matrix` construct will enable users to specify concise but powerful `Pipelines`. Moreover, it would improve the composability, scalability, flexibility and reusability of *Tekton Pipelines*. https://github.com/jerop/community/blob/looping/teps/0090-matrix.md References: - [Task Loops Experimental Project][task-loops] - Issues: - tektoncd/pipeline#2050 - tektoncd/pipeline#4097 [task-loops]: https://github.com/tektoncd/experimental/tree/main/task-loops
Progress Tracker
|
Update that this issue has been addressed through Design: https://github.com/tektoncd/community/blob/main/teps/0090-matrix.md Please share any feedback in issue tracking promotion of |
Desired behaviour
In some cases we are provided a parameter that is an array of values where we want to run a particular Task against each element of the array, when we don't know in advance the length of the array.
You could also imagine a Pipeline that operates on some value, such as the source code for and destination of, an image, and you want to be able to run the same Pipeline for 1+ images, when you only know at runtime how many images you'll be operating on.
Current behaviour
To support this we currently have to dynamically write a Pipeline that has the appropriate Tasks.
In addition, there are variations that we might want to think of here like parallel vs. sequential, conditional execution, early termination, and likely more.
The text was updated successfully, but these errors were encountered: