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

What is a Custom Task? #6457

Closed
jerop opened this issue Mar 29, 2023 · 7 comments
Closed

What is a Custom Task? #6457

jerop opened this issue Mar 29, 2023 · 7 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@jerop
Copy link
Member

jerop commented Mar 29, 2023

Today, a spec is considered a Custom Task when APIVersion and Kind are non-empty.

If a user sets apiVersion to "tekton.dev/v1beta1" and kind to "Task", a CustomRun will be created instead of a TaskRun.

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: hello-world
spec:
  steps:
    - name: echo
      image: ubuntu
      command:
        - echo
      args:
        - "hello world"
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  generateName: pr-
spec:
  pipelineSpec:
    tasks:
      - name: greeting
        taskRef:
          apiVersion: tekton.dev/v1beta1
          kind: Task
          name: hello-world
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  name: pr-jphlt
spec:
  pipelineSpec:
    tasks:
    - name: greeting
      taskRef:
        apiVersion: tekton.dev/v1beta1
        kind: Task
        name: hello-world
status:
  childReferences:
  - apiVersion: tekton.dev/v1beta1
    kind: CustomRun
    name: pr-jphlt-greeting
    pipelineTaskName: greeting
  conditions:
  - lastTransitionTime: "2023-03-29T15:35:22Z"
    message: 'Tasks Completed: 0 (Failed: 0, Cancelled 0), Incomplete: 1, Skipped: 0'
    reason: Running
    status: Unknown
    type: Succeeded
  pipelineSpec:
    tasks:
    - name: greeting
      taskRef:
        apiVersion: tekton.dev/v1beta1
        kind: Task
        name: hello-world
---
apiVersion: tekton.dev/v1beta1
kind: CustomRun
metadata:
  name: pr-jphlt-greeting
  ownerReferences:
  - apiVersion: tekton.dev/v1beta1
    kind: PipelineRun
    name: pr-jphlt
spec:
  customRef:
    apiVersion: tekton.dev/v1beta1
    kind: Task
    name: hello-world

If a user sets apiVersion to "tekton.dev/v1beta1" and kind to "Pipeline", a CustomRun will be created instead of a PipelineRun. This behavior has been been useful for Pipelines in Pipelines Custom Task.

apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: hello-world
spec:
  steps:
    - name: echo
      image: ubuntu
      command:
        - echo
      args:
        - "hello world"
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  generateName: pr-
spec:
  pipelineSpec:
    tasks:
      - name: greeting
        taskRef:
          apiVersion: tekton.dev/v1beta1
          kind: Pipeline
          name: hello-world
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  name: pr-xfb2f
spec:
  pipelineSpec:
    tasks:
    - name: greeting
      taskRef:
        apiVersion: tekton.dev/v1beta1
        kind: Pipeline
        name: hello-world
status:
  childReferences:
  - apiVersion: tekton.dev/v1beta1
    kind: CustomRun
    name: pr-xfb2f-greeting
    pipelineTaskName: greeting
  conditions:
  - lastTransitionTime: "2023-03-29T15:43:29Z"
    message: 'Tasks Completed: 0 (Failed: 0, Cancelled 0), Incomplete: 1, Skipped: 0'
    reason: Running
    status: Unknown
    type: Succeeded
  pipelineSpec:
    tasks:
    - name: greeting
      taskRef:
        apiVersion: tekton.dev/v1beta1
        kind: Pipeline
        name: hello-world
---
apiVersion: tekton.dev/v1beta1
kind: CustomRun
metadata:
  name: pr-xfb2f-greeting
  ownerReferences:
  - apiVersion: tekton.dev/v1beta1
    kind: PipelineRun
    name: pr-xfb2f
spec:
  customRef:
    apiVersion: tekton.dev/v1beta1
    kind: Pipeline
    name: hello-world

This behavior was initially surprising to me when refactoring isCustomTask in #6447, but it made sense after looking into it more. Was wondering if it may be surprising to users, especially given that @lbernick also raised similar questions during review of #6447. Opened this issue to make this behavior known so that we can discuss whether we're okay with this or we want to make some changes.

cc @tektoncd/core-maintainers

@dibyom
Copy link
Member

dibyom commented Mar 29, 2023

IMO, it's clever but I found it a bit confusing too

@Yongxuanzhang
Copy link
Member

If apiVersion is only used for custom task, why don't we rename it to something like CustomApiVersion to avoid confusion?

@lbernick
Copy link
Member

Note from @Yongxuanzhang: When we enabled custom tasks by default, users who were accidentally setting APIVersion for Tasks and ClusterTasks experienced a regression, which is that Custom tasks would be created instead of TaskRuns (#6682). The fix for these users is to remove APIVersion.

I'd like to find some way to make this less confusing; CustomAPIVersion could help with that as Yongxuan suggested, or maybe this could be a reason to explore the discussion in #6186 again?

@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 Aug 22, 2023
@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 Sep 21, 2023
@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
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