Tekton CLI Tekton pipelines CLI

Version 0.46 · source

Start here

tkn pipeline list
List pipelines
tkn pipeline start <name> --showlog
Run and follow
tkn pipelinerun list
Recent runs
tkn pr logs -f --last
Follow latest run
tkn pr describe --last
Status and tasks
tkn task start <name> -p k=v
Run one task
tkn pr cancel <run>
Stop a run
tkn pr delete --keep 5
Prune old runs

Concepts

  1. Pipeline ordered tasks
  2. PipelineRun one execution
  3. TaskRun per task
  4. Pod one step per container
Definitions are reusable; each start creates a run

Pipelines

tkn pipeline list
List pipelines
tkn pipeline describe <name>
Params, workspaces, tasks, recent runs
tkn pipeline start <name>
Start a run (prompts for params)
tkn pipeline start <name> -p <key>=<val>
Pass a parameter
Repeat -p per parameter; use key=v1,v2 for array params.
tkn pipeline start <name> --showlog
Start and stream logs
tkn pipeline start <name> --use-param-defaults
Skip param prompts
tkn pipeline start <name> -L
Rerun with last run's values
tkn pipeline start -f <file>
Start from a local or remote file
tkn pipeline start <name> --dry-run -o yaml
Preview the PipelineRun
tkn pipeline start <name> -s <sa>
Use a service account
tkn pipeline start <name> --pipeline-timeout <dur>
Set run timeout
tkn pipeline start <name> --prefix-name <p>
Name the run with a prefix
tkn pipeline start <name> -E --showlog
Exit code follows run result
Useful in CI scripts: 0 success, 1 error, 2 unknown.
tkn pipeline logs <name>
Logs of a pipeline's run
tkn pipeline export <name>
Print as YAML
tkn pipeline delete <name>
Delete a pipeline
tkn pipeline delete <name> --prs
Also delete its runs

Workspaces

-w name=<ws>,emptyDir=
Scratch dir for the run
-w name=<ws>,claimName=<pvc>
Bind an existing PVC
-w name=<ws>,secret=<secret>
Mount a secret
-w name=<ws>,config=<cm>
Mount a config map

PipelineRuns

tkn pr list
List runs
tkn pr list -A
Runs in all namespaces
tkn pr list --limit <n>
Cap the number shown
tkn pr list --label <k>=<v>
Filter by label
tkn pr describe <run>
Status, params, task runs
tkn pr describe --last
Describe newest run
tkn pr logs <run>
Show run logs
tkn pr logs <run> -f
Stream logs live
tkn pr logs --last
Logs of newest run
tkn pr logs <run> --log-failed
Only failed tasks and steps
tkn pr logs <run> -t <task>
Only one task's logs
tkn pr logs <run> --timestamps
Prefix lines with times
tkn pr logs <run> -a
Include init steps
tkn pr cancel <run>
Cancel a running run
tkn pr delete <run>...
Delete runs by name
tkn pr delete --keep <n>
Keep the n newest
tkn pr delete --all
Delete all runs in namespace
tkn pr delete -p <pipeline>
Delete a pipeline's runs
tkn pr delete --all --keep-since <min>
Spare recent runs
tkn pr delete --all -f
Skip confirmation prompt
tkn pr export <run>
Print run as YAML

Tasks

tkn task list
List tasks
tkn task describe <name>
Params, steps, recent runs
tkn task start <name>
Start a task run
tkn task start <name> -p <key>=<val> --showlog
Pass params and follow
tkn task start <name> -L
Rerun with last values
tkn task start -f <file>
Start from a file
tkn task start <name> --dry-run
Preview the TaskRun
tkn task start <name> --timeout <dur>
Set run timeout
tkn task logs <name>
Logs of a task's run
tkn task delete <name>
Delete a task
tkn task delete <name> --trs
Also delete its runs

TaskRuns

tkn tr list
List task runs
tkn tr describe <run>
Steps, status, results
tkn tr logs <run> -f
Stream logs live
tkn tr logs <run> -s <step>
One step only
tkn tr logs --last
Logs of newest run
tkn tr cancel <run>
Cancel a run
tkn tr delete --keep <n>
Keep the n newest
tkn tr export <run>
Print run as YAML

Output & Scripting

tkn pr list -o name
Names only
tkn pr list -o json
Machine-readable output
tkn pr list --no-headers
Drop the header row
tkn pr list -o jsonpath='{...}'
Extract fields
tkn pr logs <run> -F
Pick the run with fzf
tkn <cmd> -C
Disable colour
tkn completion bash
Print shell completion
tkn version
Client version

Hub & Triggers

tkn hub search <term>
Search the Tekton Hub
The tkn hub subcommands are deprecated; check the docs for your version.
tkn hub install task <name>
Install a task from the hub
tkn bundle list <image>
List resources in a bundle
tkn eventlistener list
List event listeners
tkn triggertemplate list
List trigger templates
tkn triggerbinding list
List trigger bindings
tkn eventlistener logs <name>
Listener logs

Recipes

Run and gate CI on the result
tkn pipeline start build -p rev=main \  -w name=src,claimName=build-pvc \  --showlog -E# exit code 0 only if the run succeeded
Rerun the last run and follow it
tkn pr list --limit 3tkn pipeline start build -L --showlog
Debug a failed run
tkn pr describe --lasttkn pr logs --last --log-failed
Prune old runs, keep the latest 5
tkn pr delete --keep 5 -n <ns>tkn tr delete --keep 5 -n <ns>