tektoncd / chains

Supply Chain Security in Tekton Pipelines
Apache License 2.0
248 stars 133 forks source link

crash on startup #1243

Open scoheb opened 1 week ago

scoheb commented 1 week ago

Expected Behavior

Chains should startup normally and remain running

Actual Behavior

Chains controller keeps crashing due to:

{"level":"error","ts":"2024-11-07T17:44:59.117Z","logger":"watcher","caller":"pipelinerun/pipelinerun.go:123","msg":"Mismatch in number of steps for task run postgresql-16-9-5-on-pull-request-25wpn-build-images-0. TaskSpec steps: 7, Status steps: 0","commit":"1390c44","knative.dev/controller":"github.com.tektoncd.chains.pkg.reconciler.pipelinerun.Reconciler","knative.dev/kind":"tekton.dev.PipelineRun","knative.dev/traceid":"fe6ca274-8bf0-4846-9bbb-bf96875cadeb","knative.dev/key":"osci-rhel-containers-tenant/postgresql-16-9-5-on-pull-request-25wpn","stacktrace":"github.com/tektoncd/chains/pkg/chains/formats/slsa/v1/pipelinerun.buildConfig\n\t/go/src/github.com/tektoncd/chains/pkg/chains/formats/slsa/v1/pipelinerun/pipelinerun.go:123\ngithub.com/tektoncd/chains/pkg/chains/formats/slsa/v1/pipelinerun.GenerateAttestation\n\t/go/src/github.com/tektoncd/chains/pkg/chains/formats/slsa/v1/pipelinerun/pipelinerun.go:69\ngithub.com/tektoncd/chains/pkg/chains/formats/slsa/v1.(*InTotoIte6).CreatePayload\n\t/go/src/git...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x48 pc=0x29586ed]
goroutine 164 [running]:
github.com/tektoncd/chains/pkg/chains/formats/slsa/v1/pipelinerun.buildConfig({0x3d77928?, 0xc0059356e0?}, 0xc005df0ae0)
    /go/src/github.com/tektoncd/chains/pkg/chains/formats/slsa/v1/pipelinerun/pipelinerun.go:122 +0x5ad

Additional Info

kubectl get pods -n openshift-pipelines -l app=tekton-chains-controller -ojson | jq '.items[0].metadata.labels.version'
"v0.22.2"
scoheb commented 1 week ago

pipelinerun-postgresql-16-9-5-on-pull-request-25wpn.zip

lcarva commented 1 week ago

Thanks for reporting the issue!

We fixed a couple of nil-pointer dereferences in v0.23.0:

This seems like one of those.

lcarva commented 1 week ago

NOTE: The issue seems to manifest in different way. One of them is if a TaskRun does not contain a status.

ralphbean commented 1 day ago

Taking another stab at this in: