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

TEP-0114: Custom Tasks Beta - Required Work #4313

Closed
7 tasks done
Tracked by #4983
jerop opened this issue Oct 14, 2021 · 12 comments
Closed
7 tasks done
Tracked by #4983

TEP-0114: Custom Tasks Beta - Required Work #4313

jerop opened this issue Oct 14, 2021 · 12 comments
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

@jerop
Copy link
Member

jerop commented Oct 14, 2021

In TEP-0114: Custom Tasks Beta, we proposed migrating Custom Tasks and Runs to beta. This is an overarching issue to track the work required to promote Custom Tasks to beta.

The work scoped here are blockers for promotion.

The pull requests completing the above work are here.

@jerop jerop added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 14, 2021
@jerop jerop added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Oct 20, 2021
@jerop jerop self-assigned this Oct 20, 2021
@pritidesai
Copy link
Member

/assign

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

Experimenting with Custom Tasks for the ColocatedPipelineRun POC, wanted to leave a few notes on things we might want to improve for beta:

  • Codegen is really difficult. It seems like the best solution right now is to add the new Go types, not import them anywhere yet, copy go.mod and codegen scripts from another working example, run go mod vendor, run the codegen, then add the reconciler/controller.
    • go structs also need to have the correct annotations e.g. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object which doesn't seem to be documented
  • Using a Custom Task as a runtime type that executes an authoring time type is awkward (here, a ColocatedPipelineRun executes a Pipeline)-- the following issues can probably be addressed with better docs
    • I wrote code which copies the status of the ColocatedPipelineRun to the status of the Run and vice versa (now that I think about it maybe ColocatedPipelineRun doesn't need to have its own status-- but this probably highlights the need for better examples)
    • I want to have multiple timeouts fields for ColocatedPipelineRun (similar to the multiple timeouts on PipelineRun) but it's unclear how this should interact with the Run timeout
    • getting the embedded spec of the custom object via Run.Spec.Spec.Spec is quite confusing
  • You have to write your own serialization/deserialization for Run.Status.ExtraFields and Run.Spec.Spec.Spec, which can silently go wrong and is awkward to test (in my case I realized that the JSON annotations were incorrect and JSON.Unmarshal by default ignores unknown fields instead of returning an error)

@vdemeester
Copy link
Member

  • Codegen is really difficult. It seems like the best solution right now is to add the new Go types, not import them anywhere yet, copy go.mod and codegen scripts from another working example, run go mod vendor, run the codegen, then add the reconciler/controller.

    • go structs also need to have the correct annotations e.g. // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object which doesn't seem to be documented

I tend to agree, but this is "only true" for custom task reconciler that are written in Go 👼🏼 , aka it's the same problem you have when writing any CRD and reconciler with Go more or less.

  • Using a Custom Task as a runtime type that executes an authoring time type is awkward (here, a ColocatedPipelineRun executes a Pipeline)-- the following issues can probably be addressed with better docs
    • I wrote code which copies the status of the ColocatedPipelineRun to the status of the Run and vice versa (now that I think about it maybe ColocatedPipelineRun doesn't need to have its own status-- but this probably highlights the need for better examples)
    • I want to have multiple timeouts fields for ColocatedPipelineRun (similar to the multiple timeouts on PipelineRun) but it's unclear how this should interact with the Run timeout
    • getting the embedded spec of the custom object via Run.Spec.Spec.Spec is quite confusing

+:100:

@lbernick
Copy link
Member

#4686 is relevant here-- there's some discussion of adding a custom task controller for testing; could be generally useful for developing on custom tasks

@lbernick
Copy link
Member

Created #5120 to track implementing a custom task controller for testing.

@jerop
Copy link
Member Author

jerop commented Jul 18, 2022

@tektoncd/core-maintainers updated this issue reflect what we agreed to do to promote custom tasks to beta in TEP-0114

@jerop jerop changed the title Custom Tasks Beta TEP-0114: Custom Tasks Beta Jul 18, 2022
@lbernick
Copy link
Member

One more idea I'd like to bring up for beta here after pairing on this with @JeromeJu: I'm wondering if it would make sense to have the PipelineRun controller responsible for retries of custom runs, as opposed to the current behavior of a custom task controller being responsible for implementing retry behavior. This would make custom tasks easier to author, and make them more consistent with how we handle TaskRuns. It would involve removing spec.retries from customRun, and the PR controller would be fully responsible for updating retriesstatus when a run has failed. This solution was discussed in this thread, and it looks like it was rejected to avoid having the PipelineRun controller be responsible for updating Run statuses, but that's a pattern we already use with TaskRuns. @dibyom @jerop @ScrapCodes what do you think about this?

@vdemeester
Copy link
Member

This solution was discussed in this thread, and it looks like it was rejected to avoid having the PipelineRun controller be responsible for updating Run statuses, but that's a pattern we already use with TaskRuns. @dibyom @jerop @ScrapCodes what do you think about this?

How is it a pattern we use for TaskRuns ? The PipelineRun controller should not mutate the TaskRun status at all, only the TaskRun controller does (which happens to be in the same binary).

@lbernick
Copy link
Member

How is it a pattern we use for TaskRuns ? The PipelineRun controller should not mutate the TaskRun status at all, only the TaskRun controller does (which happens to be in the same binary).

happens here

@vdemeester
Copy link
Member

How is it a pattern we use for TaskRuns ? The PipelineRun controller should not mutate the TaskRun status at all, only the TaskRun controller does (which happens to be in the same binary).

happens here

😱 🙀

@dibyom
Copy link
Member

dibyom commented Jul 26, 2022

This would make custom tasks easier to author, and make them more consistent with how we handle TaskRuns. It would involve removing spec.retries from customRun, and the PR controller would be fully responsible for updating retriesstatus when a run has failed.

How would retries work if the Run was created by itself without being in a Pipeline? Can easy retry behavior be something we add as part of an SDK for making authoring custom tasks easier?

@lbernick
Copy link
Member

How would retries work if the Run was created by itself without being in a Pipeline?

They wouldn't, just as TaskRuns can't retry on their own -- retries are a Pipeline feature.

Can easy retry behavior be something we add as part of an SDK for making authoring custom tasks easier?

potentially, although it's still harder than having it implemented in the PR controller.

Sounds like this needs more discussion, so I created #5218.

@jerop jerop changed the title TEP-0114: Custom Tasks Beta TEP-0114: Custom Tasks Beta - Required Dec 10, 2022
@jerop jerop changed the title TEP-0114: Custom Tasks Beta - Required TEP-0114: Custom Tasks Beta - Required Work Dec 10, 2022
@jerop jerop closed this as completed Dec 13, 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
Status: Done
Status: Done
Development

No branches or pull requests

5 participants