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

Cluster Tasks Cannot be Run from a pipelineRun #1001

Closed
steveodonovan opened this issue Jun 21, 2019 · 4 comments · Fixed by #1003
Closed

Cluster Tasks Cannot be Run from a pipelineRun #1001

steveodonovan opened this issue Jun 21, 2019 · 4 comments · Fixed by #1003
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@steveodonovan
Copy link
Member

Expected Behavior

Cluster tasks should be runnable from pipelineRuns.

Actual Behavior

The pipeline run and task run fails. TaskRun with the status

status:
  conditions:
  - lastTransitionTime: "2019-06-21T15:38:58Z"
    message: 'error when listing tasks for taskRun demo-pipeline-run-4-cluster-task-pipeline-4-p6ch2:
      task.tekton.dev "cluster-task-pipeline-4" not found'
    reason: TaskRunResolutionFailed
    status: "False"
    type: Succeeded
  podName: ""
  startTime: "2019-06-21T15:38:58Z"

Root cause seems to be the taskRun is created with the wrong kind attached to the taskRef.spec.kind field. (see the taskRun resource below)

Steps to Reproduce the Problem

  1. Apply the resources below
  2. Check status for taskRun and PipelineRun

Additional Info

apiVersion: tekton.dev/v1alpha1
kind: ClusterTask
metadata:
  name: cluster-task-pipeline-4
spec:
  steps:
  - name: task-two-step-one
    image: ubuntu
    command: ["/bin/bash"]
    args: ['-c', 'echo success']
---
apiVersion: tekton.dev/v1alpha1
kind: Pipeline
metadata:
  name: sample-pipeline-cluster-task-4
spec:
  tasks:
  - name: cluster-task-pipeline-4
    taskRef:
      name: cluster-task-pipeline-4
      kind: ClusterTask
---
apiVersion: tekton.dev/v1alpha1
kind: PipelineRun
metadata:
  name: demo-pipeline-run-4
spec:
  pipelineRef:
    name: sample-pipeline-cluster-task-4
  trigger:
    type: manual
  serviceAccount: 'default'

controller logs

{"level":"error","logger":"controller.taskrun-controller","caller":"taskrun/taskrun.go:164","msg":"Error stopping sidecars for TaskRun \"demo-pipeline-run-4-cluster-task-pipeline-4-p6ch2\": resource name may not be empty","knative.dev/controller":"taskrun-controller","stacktrace":"github.com/tektoncd/pipeline/pkg/reconciler/v1alpha1/taskrun.(*Reconciler).Reconcile\n\t/Users/stephen/cloud/go/src/github.com/tektoncd/pipeline/pkg/reconciler/v1alpha1/taskrun/taskrun.go:164\ngithub.com/tektoncd/pipeline/vendor/github.com/knative/pkg/controller.(*Impl).processNextWorkItem\n\t/Users/stephen/cloud/go/src/github.com/tektoncd/pipeline/vendor/github.com/knative/pkg/controller/controller.go:330\ngithub.com/tektoncd/pipeline/vendor/github.com/knative/pkg/controller.(*Impl).Run.func1\n\t/Users/stephen/cloud/go/src/github.com/tektoncd/pipeline/vendor/github.com/knative/pkg/controller/controller.go:282"}
{"level":"error","logger":"controller.taskrun-controller","caller":"controller/controller.go:345","msg":"Reconcile error","knative.dev/controller":"taskrun-controller","error":"resource name may not be empty","stacktrace":"github.com/tektoncd/pipeline/vendor/github.com/knative/pkg/controller.(*Impl).handleErr\n\t/Users/stephen/cloud/go/src/github.com/tektoncd/pipeline/vendor/github.com/knative/pkg/controller/controller.go:345\ngithub.com/tektoncd/pipeline/vendor/github.com/knative/pkg/controller.(*Impl).processNextWorkItem\n\t/Users/stephen/cloud/go/src/github.com/tektoncd/pipeline/vendor/github.com/knative/pkg/controller/controller.go:331\ngithub.com/tektoncd/pipeline/vendor/github.com/knative/pkg/controller.(*Impl).Run.func1\n\t/Users/stephen/cloud/go/src/github.com/tektoncd/pipeline/vendor/github.com/knative/pkg/controller/controller.go:282"}
{"level":"info","logger":"controller.taskrun-controller","caller":"controller/controller.go:332","msg":"Reconcile failed. Time taken: 837.3µs.","knative.dev/controller":"taskrun-controller","knative.dev/traceid":"3d40844a-f82c-4fd3-a5d8-7d9599895052","knative.dev/key":"default/demo-pipeline-run-4-cluster-task-pipeline-4-p6ch2"}

The Task Run which gets created (The taskRef.kind field has Task as its value)

apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"tekton.dev/v1alpha1","kind":"Pipeline","metadata":{"annotations":{},"name":"sample-pipeline-cluster-task-4","namespace":"default"},"spec":{"tasks":[{"name":"cluster-task-pipeline-4","taskRef":{"kind":"ClusterTask","name":"cluster-task-pipeline-4"}}]}}
  creationTimestamp: "2019-06-21T15:38:58Z"
  generation: 1
  labels:
    tekton.dev/pipeline: sample-pipeline-cluster-task-4
    tekton.dev/pipelineRun: demo-pipeline-run-4
    tekton.dev/pipelineTask: cluster-task-pipeline-4
  name: demo-pipeline-run-4-cluster-task-pipeline-4-p6ch2
  namespace: default
  ownerReferences:
  - apiVersion: tekton.dev/v1alpha1
    blockOwnerDeletion: true
    controller: true
    kind: PipelineRun
    name: demo-pipeline-run-4
    uid: afa1512a-943a-11e9-887a-025000000001
  resourceVersion: "733285"
  selfLink: /apis/tekton.dev/v1alpha1/namespaces/default/taskruns/demo-pipeline-run-4-cluster-task-pipeline-4-p6ch2
  uid: afb0bc47-943a-11e9-887a-025000000001
spec:
  inputs: {}
  outputs: {}
  serviceAccount: default
  taskRef:
    kind: Task
    name: cluster-task-pipeline-4
status:
  conditions:
  - lastTransitionTime: "2019-06-21T15:38:58Z"
    message: 'error when listing tasks for taskRun demo-pipeline-run-4-cluster-task-pipeline-4-p6ch2:
      task.tekton.dev "cluster-task-pipeline-4" not found'
    reason: TaskRunResolutionFailed
    status: "False"
    type: Succeeded
  podName: ""
  startTime: "2019-06-21T15:38:58Z"

Looking to get involved in contributing to the pipeline project. If it's unexpected behaviour I'd be happy to take this one.

@vdemeester
Copy link
Member

vdemeester commented Jun 21, 2019

/kind bug

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 21, 2019
@vdemeester vdemeester added this to the Pipelines 0.5 🐱 milestone Jun 21, 2019
@vdemeester
Copy link
Member

/assign

@abergmeier
Copy link

I have the same error message in #1096. Can anyone explain to me what happened in sidecars.Stop to trigger this error message?

@gireeshpunathil
Copy link

Hello!
I am using minishift v1.34.1 from https://github.com/minishift/minishift/releases , and looks like I am hit with the issue reported above.

  • do you know if cf2ecd5 is included in v1.34.1?
  • are there workarounds possible? I qualified the pipelineref and taskref with kind in my definitions, but the issue persists.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants