Skip to content

missing sidecar termination information in taskRun status #8987

@pritidesai

Description

@pritidesai

Expected Behavior

When EnableKubernetesSidecar is enabled, Tekton Pipelines must ensure that both main containers AND init containers have completed successfully before marking a TaskRun as complete.

Actual Behavior

A TaskRun is currently marked as complete as soon as all main containers finish execution, without considering the status of any initContainers. This behavior introduces race conditions where a TaskRun may be declared complete even though initContainers are still running.

Impact:

Sidecar Termination Details Missing: The premature completion leads to missing termination details for sidecars in the TaskRun status.
Misleading Client Behavior: Due to insufficient metadata, clients such as the Tekton Dashboard and CLI cannot accurately determine the status of sidecars. This results in a misleading representation where sidecars appear to be running even after the TaskRun has completed.

Steps to Reproduce the Problem

kubectl apply -f https://storage.googleapis.com/tekton-releases/pipeline/previous/v1.3.1/release.yaml
kubectl create -f examples/v1/taskruns/dind-sidecar.yaml

kubectl get tr  dind-sidecar-6vp2v -o json | jq .status.sidecars
[
  {
    "container": "sidecar-server",
    "imageID": "ghcr.io/tektoncd/pipeline/nop-8eac7c133edad5df719dc37b36b62482@sha256:9d58dcb3ae901ecdf2a7b255f32fdf2ab4bddb35e16d84d9eaefb93155c6df55",
    "name": "server",
    "terminated": {
      "containerID": "containerd://7ddcbbbd9ebc02564e02c83746537825d1441b809c40f0148e52780180bd2a0d",
      "exitCode": 0,
      "finishedAt": "2025-08-21T19:37:32Z",
      "message": "Sidecar container successfully stopped by nop image",
      "reason": "Completed",
      "startedAt": "2025-08-21T19:36:32Z"
    }
  }
]

tkn taskrun describe
? Select taskrun: dind-sidecar-6vp2v started 29 minutes ago
Name:              dind-sidecar-6vp2v
Namespace:         default
Service Account:   default
Timeout:           1h0m0s
Labels:
 app.kubernetes.io/managed-by=tekton-pipelines
Annotations:
 pipeline.tekton.dev/release=a53cdad

🌡️  Status

STARTED          DURATION    STATUS
29 minutes ago   1m2s        Failed

Message

"step-client" exited with code 125: Error

🦶 Steps

 NAME       STATUS
 ∙ client   Error

🚗 Sidecars

 NAME       STATUS
 ∙ server   Completed


kubectl patch cm feature-flags -n tekton-pipelines -p '{"data":{"enable-kubernetes-sidecar":"true"}}'
kubectl create -f examples/v1/taskruns/dind-sidecar.yaml

kubectl get tr  dind-sidecar-6hh2r -o json | jq .status.sidecars 
[
  {
    "container": "sidecar-server",
    "imageID": "docker.io/library/docker@sha256:74e78208fc18da48ddf8b569abe21563730845c312130bd0f0b059746a7e10f5",
    "name": "server",
    "running": {
      "startedAt": "2025-08-21T19:42:29Z"
    }
  }
]

tkn taskrun describe 
? Select taskrun: dind-sidecar-6hh2r started 23 minutes ago
Name:              dind-sidecar-6hh2r
Namespace:         default
Service Account:   default
Timeout:           1h0m0s
Labels:
 app.kubernetes.io/managed-by=tekton-pipelines
Annotations:
 pipeline.tekton.dev/release=a53cdad

🌡️  Status

STARTED          DURATION    STATUS
23 minutes ago   1m3s        Failed

Message

"step-client" exited with code 125: Error

🦶 Steps

 NAME       STATUS
 ∙ client   Error

🚗 Sidecars

 NAME       STATUS
 ∙ server   Running

Additional Info

  • Kubernetes version:

    Output of kubectl version:

Client Version: v1.31.0
Kustomize Version: v5.4.2
Server Version: v1.30.14+IKS
  • 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}'

Client version: 0.32.0
Pipeline version: v1.3.1
Dashboard version: v0.60.0

Metadata

Metadata

Assignees

Labels

kind/bugCategorizes issue or PR as related to a bug.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions