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 alternative implementations of a specific Task #1323

Closed
afrittoli opened this issue Sep 17, 2019 · 12 comments
Closed

Support alternative implementations of a specific Task #1323

afrittoli opened this issue Sep 17, 2019 · 12 comments
Labels
design This task is about creating and discussing a design kind/design Categorizes issue or PR as related to design. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@afrittoli
Copy link
Member

Description and motivation

A Tekton Task has an interface that is defined by the collection of its inputs (resources + params) and outputs (resources). It should be possible to replace a Task in a Pipeline with a different one as long as their inputs and outputs are compatible.

Tekton however does not really provide any way to switch the implementation of a Task in a Pipeline dynamically or without significantly altering the Pipeline definition.

The feature proposed here introduces a way to dynamically select a compatible Task implementation at run time based on inputs or conditions. For instance a release pipeline could use a different Task to tag images depending on the container registry it's running against.

State of the Art

There are ways this could be partially achieved today using Conditions.
A number of Tasks, each with a Condition could be defined in the Pipeline. However there is no way to enforce the conditions being mutually exclusive, so it may be that multiple Tasks are executed at the end. Another issue is with the output resources. Any Task that depend on the outputs of the Tasks with conditions, would not have a way to specify which Task its inputs are coming from.

Use Cases

  • Build a docker image with a different tool
  • Deploy with alternate strategies
  • Different implementations of a Task to work with different cloud APIs
  • Interface with alternate implementations of a service

Possible Implementations

One way to handle this could be to allow for the Task name in the pipeline spec to be dynamic, i.e. only defined at runtime. It could be built out of parameters or resources.
Alternatively a new kind of MultiTask could be implemented, that in its definition references all the possible Task implementations and the condition for their selection, in a way that enforces mutual exclusion. Consumers of the MultiTask outputs would reference to the MultiTask name as source of their inputs.
It might be possible to introduce AbstractTasks, i.e. Tasks with interface spec but no actual steps in them, but I fear that would be to rigid, an suffer similar type of issue as abstract classes in object orient programming.

Notes

This may sound similar to #215 - at least from the issue name - but it's a different feature - even if there may be points of overlap.

@afrittoli afrittoli added design This task is about creating and discussing a design kind/design Categorizes issue or PR as related to design. labels Sep 17, 2019
@skaegi
Copy link
Contributor

skaegi commented Sep 17, 2019

Maybe a little low-tech ... but a Task could have a step that internally wraps a dynamically named (or even generated) Task or Pipeline, run it and then copy it's inputs and outputs (and maybe even logs) back out to the containing TaskRun. It would definitely be a bit of work to support traceability but I think still possible with clever labelling.

@afrittoli
Copy link
Member Author

Maybe a little low-tech ... but a Task could have a step that internally wraps a dynamically named (or even generated) Task or Pipeline, run it and then copy it's inputs and outputs (and maybe even logs) back out to the containing TaskRun. It would definitely be a bit of work to support traceability but I think still possible with clever labeling.

Nice idea, that would move the granularity back; but without the benefit of running on the same node. I think there are multiple possible ways to implement this - but whatever the solution I'd like it to be very much declarative - so that its clear from the pipeline/task/step specs what we expect to happen.

@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 Aug 12, 2020
@afrittoli afrittoli removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Aug 14, 2020
@afrittoli
Copy link
Member Author

I think this is still a valid use case.
This design doc goes in the direction of fixing this: https://docs.google.com/document/d/1G2QbpiMUHSs4LOqcNaIRswcdvoy8n7XuhTV8tXdcE7A/edit#
@sbwsg @bobcatfish

@bobcatfish
Copy link
Collaborator

@afrittoli I still don't totally understand this use case - this means that someone has written a Pipeline and they want to use the entire Pipeline as-is, but they want to swap out individual Tasks. I guess I don't totally understand why it's not worth writing a different Pipeline in that case.

The Task specialization proposal COULD include this, but for the question of "when do you want this specialization", it seemed like "when running the Pipeline" was the one point at which no one really needed to do the specialization.

Do you have some use cases today (maybe for dogfooding?) where you need this?

@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

@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
@bobcatfish
Copy link
Collaborator

I wonder if this is related to some of the discussions we're having in #2298, specifically about being able to make changes to a Task without having to change the Pipeline (e.g. if you use an OCI reference in a Pipeline and want to try out some changes to a Task before it's published)

@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
@tekton-robot
Copy link
Collaborator

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
Rotten issues close after an additional 30d of inactivity.
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 rotten

Send feedback to tektoncd/plumbing.

@tekton-robot tekton-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Mar 16, 2021
@tekton-robot
Copy link
Collaborator

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen with a justification.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/close

Send feedback to tektoncd/plumbing.

@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 with a justification.
Mark the issue as fresh with /remove-lifecycle rotten with a justification.
If this issue should be exempted, mark the issue as frozen with /lifecycle frozen with a justification.

/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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design This task is about creating and discussing a design kind/design Categorizes issue or PR as related to design. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

5 participants