-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Open
Labels
area/apiIndicates an issue or PR that deals with the API.Indicates an issue or PR that deals with the API.good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.
Description
Expected Behavior
When a taskRun is cancelled due to a timeout, I expect the steps that were not executed to have no timings attached to them. It is misleading to set the same time for all steps, as steps are generally executed in sequence. Additionally, the startedAt time is set to the start time of the taskRun. Meaning, if a taskRun is canceled while executing the second step of a task, that step may have a startedAt time earlier than the first step, which is inaccurate.
Actual Behavior
Steps to Reproduce the Problem
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: task
spec:
steps:
- image: mirror.gcr.io/busybox
name: step-1
command: ['/bin/sh']
args: ['-c', 'sleep 1']
- image: mirror.gcr.io/busybox
name: step-2
command: ['/bin/sh']
args: ['-c', 'sleep 10']
- image: mirror.gcr.io/busybox
name: step-3
command: ['/bin/sh']
args: ['-c', 'sleep 10']
- image: mirror.gcr.io/busybox
name: step-4
command: ['/bin/sh']
args: ['-c', 'sleep 10']
---
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
name: pipeline
spec:
tasks:
- name: foo
taskRef:
name: task
---
apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: pipelinerun
spec:
pipelineRef:
name: pipeline
timeouts:
pipeline: 10s
Apply this pipelineRun:
k create -f pipelinerun-timeout.yaml
Analyze the taskRun:
tkn taskrun describe pipelinerun-foo
Name: pipelinerun-foo
Namespace: default
Task Ref: task
Service Account: default
Timeout: 24h0m0s
Labels:
app.kubernetes.io/managed-by=tekton-pipelines
tekton.dev/memberOf=tasks
tekton.dev/pipeline=pipeline
tekton.dev/pipelineRun=pipelinerun
tekton.dev/pipelineTask=foo
tekton.dev/task=task
Annotations:
pipeline.tekton.dev/release=e58ca13
π‘οΈ Status
STARTED DURATION STATUS
11 seconds ago 10s Cancelled(TaskRunCancelled)
Message
TaskRun "pipelinerun-foo" was cancelled. TaskRun cancelled as the PipelineRun it belongs to has timed out.
π¦Ά Steps
NAME STATUS
β step-2 TaskRunCancelled
β step-3 TaskRunCancelled
β step-4 TaskRunCancelled
β step-1 Completed
Analyze the steps:
k get taskruns.tekton.dev pipelinerun-foo -o json | jq .status.steps
[
{
"container": "step-step-1",
"imageID": "mirror.gcr.io/busybox@sha256:2919d0172f7524b2d8df9e50066a682669e6d170ac0f6a49676d54358fe970b5",
"name": "step-1",
"terminated": {
"containerID": "containerd://0f9896d9080b86b7deb09dea2b2b73d3f5d5a8a57a5e76222df9b3dce911ff1b",
"exitCode": 0,
"finishedAt": "2025-01-10T20:07:18Z",
"reason": "Completed",
"startedAt": "2025-01-10T20:07:17Z"
},
"terminationReason": "Completed"
},
{
"container": "step-step-2",
"imageID": "mirror.gcr.io/busybox@sha256:2919d0172f7524b2d8df9e50066a682669e6d170ac0f6a49676d54358fe970b5",
"name": "step-2",
"terminated": {
"exitCode": 1,
"finishedAt": "2025-01-10T20:07:22Z",
"message": "Step step-2 terminated as pod pipelinerun-foo-pod is terminated",
"reason": "TaskRunCancelled",
"startedAt": "2025-01-10T20:07:15Z"
},
"terminationReason": "TaskRunCancelled"
},
{
"container": "step-step-3",
"imageID": "mirror.gcr.io/busybox@sha256:2919d0172f7524b2d8df9e50066a682669e6d170ac0f6a49676d54358fe970b5",
"name": "step-3",
"terminated": {
"exitCode": 1,
"finishedAt": "2025-01-10T20:07:22Z",
"message": "Step step-3 terminated as pod pipelinerun-foo-pod is terminated",
"reason": "TaskRunCancelled",
"startedAt": "2025-01-10T20:07:15Z"
},
"terminationReason": "TaskRunCancelled"
},
{
"container": "step-step-4",
"imageID": "mirror.gcr.io/busybox@sha256:2919d0172f7524b2d8df9e50066a682669e6d170ac0f6a49676d54358fe970b5",
"name": "step-4",
"terminated": {
"exitCode": 1,
"finishedAt": "2025-01-10T20:07:22Z",
"message": "Step step-4 terminated as pod pipelinerun-foo-pod is terminated",
"reason": "TaskRunCancelled",
"startedAt": "2025-01-10T20:07:16Z"
},
"terminationReason": "TaskRunCancelled"
}
]
| Step | startedAt | finishedAt |
|---|---|---|
| step-1 | 2025-01-10T20:07:17Z | 2025-01-10T20:07:18Z |
| step-2 | 2025-01-10T20:07:15Z | 2025-01-10T20:07:22Z |
| step-3 | 2025-01-10T20:07:15Z | 2025-01-10T20:07:22Z |
| step-4 | 2025-01-10T20:07:16Z | 2025-01-10T20:07:22Z |
Additional Info
-
Kubernetes version:
Output of
kubectl version:
k version
Client Version: v1.31.0
Server Version: v1.29.11+IKS
-
Tekton Pipeline version:
Output of
tkn versionorkubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'
tkn version
Client version: 0.32.0
Pipeline version: v0.62.1
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area/apiIndicates an issue or PR that deals with the API.Indicates an issue or PR that deals with the API.good first issueDenotes an issue ready for a new contributor, according to the "help wanted" guidelines.Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.Categorizes issue or PR as related to a bug.