Skip to main content

tkn pac logs

Display PipelineRun logs from a Pipelines-as-Code Repository.

Synopsis

tkn pac logs [repository-name] [flags]

Description

The logs command shows logs for PipelineRuns belonging to a Repository CRD. It:
  1. Selects a repository (prompts if not specified)
  2. Lists PipelineRuns attached to that repository
  3. Selects a PipelineRun (prompts if multiple exist)
  4. Shows logs using tkn CLI or opens console/dashboard
The tkn CLI must be installed to show logs in the terminal.

Prerequisites

  • Tekton CLI (tkn) installed and in PATH
  • Or use --web flag to open logs in browser

Usage Examples

# Select repository and PipelineRun interactively
tkn pac logs

Arguments

repository-name
string
Repository name (optional - prompts if not provided)

Flags

-n, --namespace
string
Namespace containing the repository
-L, --last
boolean
default:"false"
Show logs of the last PipelineRun (skip selection prompt)
-w, --web
boolean
default:"false"
Open web browser to console/dashboard instead of using tkn
--limit
int
default:"-1"
Limit the number of PipelineRuns to show (-1 for unlimited)
--tkn-path
string
Path to the tkn binary (auto-detected if not specified)

Interactive Flow

1. Repository Selection

If repository name not provided:
? Select a repository:
  › myorg-api
    myorg-frontend
    myorg-docs

2. PipelineRun Selection

If multiple PipelineRuns exist and --last not specified:
? Select a PipelineRun:
  › myorg-api-pr-123 running since 2m ago
    myorg-api-pr-122 completed 10m ago
    myorg-api-pr-121 completed 1h ago
    myorg-api-pr-120 completed 2h ago

3. Logs Display

Logs are streamed in real-time:
$ tkn pac logs myorg-app

[fetch-repository : clone] Cloning into '/workspace/output'...
[fetch-repository : clone] From https://github.com/myorg/app
[fetch-repository : clone]  * branch            main       -> FETCH_HEAD
[fetch-repository : clone] Switched to branch 'main'

[run-tests : test] Running tests...
[run-tests : test] === RUN   TestMain
[run-tests : test] === RUN   TestHandler
[run-tests : test] --- PASS: TestHandler (0.00s)
[run-tests : test] PASS
[run-tests : test] ok      github.com/myorg/app    0.123s

[build-image : build] STEP 1/5: FROM golang:1.21
[build-image : build] STEP 2/5: WORKDIR /app
[build-image : build] --> Using cache
...

Output Examples

Terminal Output (tkn CLI)

$ tkn pac logs myorg-api

? Select a PipelineRun: myorg-api-pr-123 running since 2m ago

[fetch-repository : clone] + git clone https://github.com/myorg/api /workspace/output
[fetch-repository : clone] Cloning into '/workspace/output'...
[fetch-repository : clone] remote: Enumerating objects: 1234, done.
[fetch-repository : clone] remote: Counting objects: 100% (1234/1234), done.
[fetch-repository : clone] Receiving objects: 100% (1234/1234), 5.67 MiB | 12.34 MiB/s, done.

[run-tests : test] + go test ./...
[run-tests : test] ok      github.com/myorg/api/pkg/handlers  0.123s
[run-tests : test] ok      github.com/myorg/api/pkg/models    0.089s
...

Browser Output (—web)

Opens the console or Tekton Dashboard in your default browser:
$ tkn pac logs myorg-api --web

Opening: https://console.apps.cluster.example.com/k8s/ns/production/tekton.dev~v1~PipelineRun/myorg-api-pr-123

Web Console Integration

The --web flag opens logs in: OpenShift:
  • Auto-detects OpenShift Console
  • Opens PipelineRun detail page
Kubernetes with Tekton Dashboard:
  • Detects Tekton Dashboard
  • Opens PipelineRun logs page

Environment Variables

PAC_TEKTON_DASHBOARD_URL
string
Override Tekton Dashboard URLExample:
export PAC_TEKTON_DASHBOARD_URL=https://dashboard.example.com
tkn pac logs --web

Common Workflows

View Latest Logs

# Quickly check the most recent run
tkn pac logs myorg-app --last

Follow Running Pipeline

# Stream logs in real-time
tkn pac logs myorg-app
# Select the running PipelineRun

Debug Failed Run

# View logs of failed PipelineRun
tkn pac logs myorg-app
# Select the failed run from the list

Open in Dashboard

# View in Tekton Dashboard for better UI
tkn pac logs myorg-app --last --web

Multiple Repositories

# Check logs across repositories
tkn pac logs api-repo --last
tkn pac logs frontend-repo --last
tkn pac logs docs-repo --last

Limiting PipelineRuns

Control how many PipelineRuns are shown:
tkn pac logs myorg-app --limit 5

PipelineRun Status Display

The selection list shows status for each PipelineRun:
? Select a PipelineRun:
  › myorg-api-pr-123 running since 2m ago        ← Currently executing
    myorg-api-pr-122 completed 10m ago             ← Finished 10m ago
    myorg-api-pr-121 completed 1h ago
    myorg-api-pr-120 completed 2h ago
  • running since - Currently executing
  • completed - Finished execution

tkn CLI Detection

The command automatically finds tkn in your PATH:
$ which tkn
/usr/local/bin/tkn
If tkn is not found:
Error: cannot find tkn binary in Path
Solution: Install tkn or specify path:
tkn pac logs --tkn-path /custom/path/to/tkn

Troubleshooting

tkn Not Found

Error: cannot find tkn binary in Path
Solutions:
  1. Install tkn:
    # macOS
    brew install tektoncd-cli
    
    # Linux
    curl -LO https://github.com/tektoncd/cli/releases/latest/download/tkn_Linux_x86_64.tar.gz
    tar xvzf tkn_Linux_x86_64.tar.gz -C /usr/local/bin/ tkn
    
  2. Use web browser instead:
    tkn pac logs --web
    
  3. Specify tkn path:
    tkn pac logs --tkn-path /opt/bin/tkn
    

No PipelineRuns Found

Error: cannot detect pipelineruns belonging to repository: myorg-app
Solutions:
  • Check repository exists: tkn pac list
  • Verify PipelineRuns: kubectl get pr -l pipelinesascode.tekton.dev/repository=myorg-app
  • Ensure pipeline has run at least once

Repository Not Found

Error: repositories.pipelinesascode.tekton.dev "myorg-app" not found
Solutions:
  • List available repositories: tkn pac list
  • Check namespace: tkn pac list -A
  • Verify repository name spelling

Console URL Not Detected

When using --web:
# Set dashboard URL explicitly
export PAC_TEKTON_DASHBOARD_URL=https://dashboard.example.com
tkn pac logs --web
Or:
export TEKTON_DASHBOARD_URL=https://dashboard.example.com
tkn pac logs --web

Permission Denied

Error: pipelineruns.tekton.dev is forbidden
Solution: Request RBAC permissions to list PipelineRuns in the namespace.

See Also

Build docs developers (and LLMs) love