Skip to content

feat(tekton): add PipelineRun troubleshooting tools#1245

Open
waveywaves wants to merge 2 commits into
containers:mainfrom
waveywaves:feat/tekton-pipelinerun-troubleshooting
Open

feat(tekton): add PipelineRun troubleshooting tools#1245
waveywaves wants to merge 2 commits into
containers:mainfrom
waveywaves:feat/tekton-pipelinerun-troubleshooting

Conversation

@waveywaves

@waveywaves waveywaves commented Jun 30, 2026

Copy link
Copy Markdown

What

  • Add tekton_pipelinerun_cancel to cancel a PipelineRun by setting spec.status=Cancelled.
  • Add tekton_pipelinerun_logs to collect logs from TaskRuns owned by a PipelineRun.
  • Add the pipeline-troubleshoot prompt to gather PipelineRun status, related TaskRuns, logs, events, Pipeline-as-Code Repository resources, and TektonConfig resources.
  • Document how to use generic resources_list / resources_get for PAC Repository and TektonConfig visibility.
  • Update generated README/configuration tables, Tekton docs, eval tasks, and MCP tests.

Why

PipelineRun cancellation and log collection are Tekton workflows that require domain-specific behavior beyond plain resource get/list. PAC Repository and TektonConfig visibility is handled without thin wrapper tools: generic resource tools cover direct reads, and the troubleshooting prompt pre-fetches those resources when diagnosing PipelineRuns.

Testing

  • make update-readme-tools
  • go test ./pkg/toolsets/tekton -count=1
  • go test ./pkg/mcp -run 'TestTektonMcp|TestToolsets' -count=1
  • go test ./... (fails locally: linker reports no space left on device while building several test binaries)

Notes

No repository or organization PR template is configured; this body follows the repository contribution guidance: background, user-facing changes, tests, and docs.

@waveywaves waveywaves marked this pull request as ready for review June 30, 2026 10:58
@waveywaves waveywaves force-pushed the feat/tekton-pipelinerun-troubleshooting branch from ddb9101 to c1a5942 Compare June 30, 2026 11:34
@waveywaves waveywaves marked this pull request as draft June 30, 2026 11:35
@waveywaves waveywaves marked this pull request as ready for review June 30, 2026 12:02
@waveywaves waveywaves marked this pull request as draft June 30, 2026 12:09
@waveywaves waveywaves force-pushed the feat/tekton-pipelinerun-troubleshooting branch from c1a5942 to c6577bf Compare June 30, 2026 15:17
@waveywaves waveywaves marked this pull request as ready for review June 30, 2026 16:33
@github-actions

Copy link
Copy Markdown
Contributor

👋 Heads up — this pull request changes files owned by @ksimon1.

You are listed as an owner of one or more of the changed areas in .github/CODEOWNERS. GitHub cannot auto-request review from owners without write access, so this comment is the notification instead. A review when you have a moment would be appreciated 🙏

Comment thread pkg/toolsets/tekton/pipelinerun.go
Comment thread pkg/toolsets/tekton/pipeline_troubleshoot.go Outdated
Comment thread pkg/toolsets/tekton/pipelinerun.go
Comment thread pkg/toolsets/tekton/pipeline_troubleshoot.go Outdated
@waveywaves waveywaves force-pushed the feat/tekton-pipelinerun-troubleshooting branch from 7e9426b to bd16b28 Compare July 6, 2026 08:10
@manusa manusa requested a review from ksimon1 July 6, 2026 12:42
}).String()
events, err := params.CoreV1().Events(namespace).List(params.Context, metav1.ListOptions{FieldSelector: selector})
if err != nil {
return fmt.Sprintf("*Error listing events for %s %s: %v*", target.kind, target.name, err)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to just log this error instead of returning and continue gathering other events? Because like this, it will ignore other targets if first target fails e.g. due to RBAC issues.

Comment thread pkg/toolsets/tekton/pipelinerun.go Outdated
return api.NewToolCallResult(sb.String(), nil), nil
}

func listPipelineRunTaskRuns(params api.ToolHandlerParams, namespace, pipelineRunName string) ([]tektonv1.TaskRun, error) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this FN necessary? It just calls another FN.

@ksimon1

ksimon1 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

@waveywaves can you please resolve merge conflicts?

Add PipelineRun cancel and log helpers, read-only Pipeline-as-Code Repository and TektonConfig tools, and a PipelineRun troubleshooting prompt.

Update Tekton docs, eval tasks, snapshots, and MCP coverage for the new tools.

Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
@waveywaves waveywaves force-pushed the feat/tekton-pipelinerun-troubleshooting branch 2 times, most recently from 4a5afc3 to ffc1248 Compare July 10, 2026 09:27
var sb strings.Builder
for _, taskRun := range taskRuns {
fmt.Fprintf(&sb, "### TaskRun: %s\n\n", taskRun.Name)
if status, err := output.MarshalYaml(taskRun.Status); err == nil {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: if marshalling fails, then there is no record of it. It would be probably good to log it

Signed-off-by: Vibhav Bobade <vibhav.bobde@gmail.com>
@waveywaves waveywaves force-pushed the feat/tekton-pipelinerun-troubleshooting branch from ffc1248 to bb64bd9 Compare July 10, 2026 13:31
@ksimon1

ksimon1 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@ksimon1

ksimon1 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@manusa can you please check this PR?

@Cali0707 Cali0707 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@waveywaves are you able to fix the merge conflicts?

Beyond those, LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants