tektoncd / pipeline

A cloud-native Pipeline resource.
https://tekton.dev
Apache License 2.0
8.48k stars 1.78k forks source link

Taskrun's taskref setting kind but without apiversion should be considered as validation error #6557

Open Yongxuanzhang opened 1 year ago

Yongxuanzhang commented 1 year ago

Expected Behavior

Setting Kind to any non-empty string and APIVersion to an empty string in a Taskrun's TaskRef will be considered a validation error.

Actual Behavior

apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
  name: tr
  namespace: default
spec:
  taskRef:
    kind: Example
    name: foo
status:
  completionTime: "2023-04-19T02:48:40Z"
  conditions:
  - lastTransitionTime: "2023-04-19T02:48:40Z"
    message: 'error when listing tasks for taskRun tr: failed to get task: tasks.tekton.dev
      "foo" not found'
    reason: TaskRunResolutionFailed
    status: "False"
    type: Succeeded
  podName: ""

Steps to Reproduce the Problem

  1. Create this example with kubectl create -f example.yaml
    
    apiVersion: tekton.dev/v1beta1
    kind: TaskRun
    metadata:
    generateName: tr-
    spec:
    taskRef:
    kind: Example
    name: foo
2.
3.

# Additional Info

- Kubernetes version:

  **Output of `kubectl version`:**

(paste your output here)


- Tekton Pipeline version:

  **Output of `tkn version` or `kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'`**

(paste your output here)



<!-- Any other additional information -->
Yongxuanzhang commented 1 year ago

https://github.com/tektoncd/pipeline/pull/6505 only fixes part of the bug, we should fix taskrun's taskref as well.

tekton-robot commented 1 year ago

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 commented 1 year ago

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.