This is a cache of https://docs.openshift.com/pipelines/1.14/tkn_cli/op-tkn-reference.html. It is a snapshot of the page at 2024-11-23T01:32:15.250+0000.
Basic tkn commands | Pipelines <strong>cli</strong> (tkn) reference | Red Hat OpenShift Pipelines 1.14
×

Basic syntax

tkn [command or options] [arguments…​]

Global options

--help, -h

Utility commands

tkn

Parent command for tkn cli.

Example: Display all options
$ tkn

completion [shell]

Print shell completion code which must be evaluated to provide interactive completion. Supported shells are bash and zsh.

Example: Completion code for bash shell
$ tkn completion bash

version

Print version information of the tkn cli.

Example: Check the tkn version
$ tkn version

Pipelines management commands

pipeline

Manage pipelines.

Example: Display help
$ tkn pipeline --help

pipeline delete

Delete a pipeline.

Example: Delete a pipeline from a namespace
$ tkn pipeline delete <pipeline_name> -n <namespace_name>

pipeline describe

Describe a pipeline.

Example: Describe a pipeline
$ tkn pipeline describe <pipeline_name>

pipeline list

Display a list of pipelines.

Example: Display a list of pipelines
$ tkn pipeline list

pipeline logs

Display the logs for a specific pipeline.

Example: Stream the live logs for a pipeline
$ tkn pipeline logs -f <pipeline_name>

pipeline start

Start a pipeline.

Example: Start a pipeline
$ tkn pipeline start <pipeline_name>

Pipeline run commands

pipelinerun

Manage pipeline runs.

Example: Display help
$ tkn pipelinerun -h

pipelinerun cancel

Cancel a pipeline run.

Example: Cancel a pipeline run from a namespace
$ tkn pipelinerun cancel <pipeline_run_name> -n <namespace_name>

pipelinerun delete

Delete a pipeline run.

Example: Delete pipeline runs from a namespace
$ tkn pipelinerun delete <pipeline_run_name_1> <pipeline_run_name_2> -n <namespace_name>
Example: Delete all pipeline runs from a namespace, except the five most recently executed pipeline runs
$ tkn pipelinerun delete -n <namespace_name> --keep 5 (1)
1 Replace 5 with the number of most recently executed pipeline runs you want to retain.
Example: Delete all pipelines
$ tkn pipelinerun delete --all

Starting with Red Hat OpenShift Pipelines 1.6, the tkn pipelinerun delete --all command does not delete any resources that are in the running state.

pipelinerun describe

Describe a pipeline run.

Example: Describe a pipeline run in a namespace
$ tkn pipelinerun describe <pipeline_run_name> -n <namespace_name>

pipelinerun list

List pipeline runs.

Example: Display a list of pipeline runs in a namespace
$ tkn pipelinerun list -n <namespace_name>

pipelinerun logs

Display the logs of a pipeline run.

Example: Display the logs of a pipeline run with all tasks and steps in a namespace
$ tkn pipelinerun logs <pipeline_run_name> -a -n <namespace_name>

Task management commands

task

Manage tasks.

Example: Display help
$ tkn task -h

task delete

Delete a task.

Example: Delete tasks from a namespace
$ tkn task delete <task_name_1> <task_name_2> -n <namespace_name>

task describe

Describe a task.

Example: Describe a task in a namespace
$ tkn task describe <task_name> -n <namespace_name>

task list

List tasks.

Example: List all the tasks in a namespace
$ tkn task list -n <namespace_name>

task start

Start a task.

Example: Start a task in a namespace
$ tkn task start <task_name> -s <service_account_name> -n <namespace_name>

Task run commands

taskrun

Manage task runs.

Example: Display help
$ tkn taskrun -h

taskrun cancel

Cancel a task run.

Example: Cancel a task run from a namespace
$ tkn taskrun cancel <task_run_name> -n <namespace_name>

taskrun delete

Delete a TaskRun.

Example: Delete task runs from a namespace
$ tkn taskrun delete <task_run_name_1> <task_run_name_2> -n <namespace_name>
Example: Delete all but the five most recently executed task runs from a namespace
$ tkn taskrun delete -n <namespace_name> --keep 5 (1)
1 Replace 5 with the number of most recently executed task runs you want to retain.

taskrun describe

Describe a task run.

Example: Describe a task run in a namespace
$ tkn taskrun describe <task_run_name> -n <namespace_name>

taskrun list

List task runs.

Example: List all the task runs in a namespace
$ tkn taskrun list -n <namespace_name>

taskrun logs

Display task run logs.

Example: Display live logs for a task run in a namespace
$ tkn taskrun logs -f <task_run_name> -n <namespace_name>

Pipeline Resource management commands

resource

Manage Pipeline Resources.

Example: Display help
$ tkn resource -h

resource create

Create a Pipeline Resource.

Example: Create a Pipeline Resource in a namespace
$ tkn resource create -n myspace

This is an interactive command that asks for input on the name of the Resource, type of the Resource, and the values based on the type of the Resource.

resource delete

Delete a Pipeline Resource.

Example: Delete the myresource Pipeline Resource from a namespace
$ tkn resource delete myresource -n myspace

resource describe

Describe a Pipeline Resource.

Example: Describe the myresource Pipeline Resource
$ tkn resource describe myresource -n myspace

resource list

List Pipeline Resources.

Example: List all Pipeline Resources in a namespace
$ tkn resource list -n myspace

ClusterTask management commands

In Red Hat OpenShift Pipelines 1.10, ClusterTask functionality of the tkn command line utility is deprecated and is planned to be removed in a future release.

clustertask

Manage ClusterTasks.

Example: Display help
$ tkn clustertask --help

clustertask delete

Delete a ClusterTask resource in a cluster.

Example: Delete mytask1 and mytask2 ClusterTasks
$ tkn clustertask delete mytask1 mytask2

clustertask describe

Describe a ClusterTask.

Example: Describe the mytask ClusterTask
$ tkn clustertask describe mytask1

clustertask list

List ClusterTasks.

Example: List ClusterTasks
$ tkn clustertask list

clustertask start

Start ClusterTasks.

Example: Start the mytask ClusterTask
$ tkn clustertask start mytask

Trigger management commands

eventlistener

Manage EventListeners.

Example: Display help
$ tkn eventlistener -h

eventlistener delete

Delete an EventListener.

Example: Delete mylistener1 and mylistener2 EventListeners in a namespace
$ tkn eventlistener delete mylistener1 mylistener2 -n myspace

eventlistener describe

Describe an EventListener.

Example: Describe the mylistener EventListener in a namespace
$ tkn eventlistener describe mylistener -n myspace

eventlistener list

List EventListeners.

Example: List all the EventListeners in a namespace
$ tkn eventlistener list -n myspace

eventlistener logs

Display logs of an EventListener.

Example: Display the logs of the mylistener EventListener in a namespace
$ tkn eventlistener logs mylistener -n myspace

triggerbinding

Manage TriggerBindings.

Example: Display TriggerBindings help
$ tkn triggerbinding -h

triggerbinding delete

Delete a TriggerBinding.

Example: Delete mybinding1 and mybinding2 TriggerBindings in a namespace
$ tkn triggerbinding delete mybinding1 mybinding2 -n myspace

triggerbinding describe

Describe a TriggerBinding.

Example: Describe the mybinding TriggerBinding in a namespace
$ tkn triggerbinding describe mybinding -n myspace

triggerbinding list

List TriggerBindings.

Example: List all the TriggerBindings in a namespace
$ tkn triggerbinding list -n myspace

triggertemplate

Manage TriggerTemplates.

Example: Display TriggerTemplate help
$ tkn triggertemplate -h

triggertemplate delete

Delete a TriggerTemplate.

Example: Delete mytemplate1 and mytemplate2 TriggerTemplates in a namespace
$ tkn triggertemplate delete mytemplate1 mytemplate2 -n `myspace`

triggertemplate describe

Describe a TriggerTemplate.

Example: Describe the mytemplate TriggerTemplate in a namespace
$ tkn triggertemplate describe mytemplate -n `myspace`

triggertemplate list

List TriggerTemplates.

Example: List all the TriggerTemplates in a namespace
$ tkn triggertemplate list -n myspace

clustertriggerbinding

Manage ClusterTriggerBindings.

Example: Display ClusterTriggerBindings help
$ tkn clustertriggerbinding -h

clustertriggerbinding delete

Delete a ClusterTriggerBinding.

Example: Delete myclusterbinding1 and myclusterbinding2 ClusterTriggerBindings
$ tkn clustertriggerbinding delete myclusterbinding1 myclusterbinding2

clustertriggerbinding describe

Describe a ClusterTriggerBinding.

Example: Describe the myclusterbinding ClusterTriggerBinding
$ tkn clustertriggerbinding describe myclusterbinding

clustertriggerbinding list

List ClusterTriggerBindings.

Example: List all ClusterTriggerBindings
$ tkn clustertriggerbinding list

Hub interaction commands

Interact with Tekton Hub for resources such as tasks and pipelines.

hub

Interact with hub.

Example: Display help
$ tkn hub -h
Example: Interact with a hub API server
$ tkn hub --api-server https://api.hub.tekton.dev

For each example, to get the corresponding sub-commands and flags, run tkn hub <command> --help.

hub downgrade

Downgrade an installed resource.

Example: Downgrade the mytask task in the mynamespace namespace to it’s older version
$ tkn hub downgrade task mytask --to version -n mynamespace

hub get

Get a resource manifest by its name, kind, catalog, and version.

Example: Get the manifest for a specific version of the myresource pipeline or task from the tekton catalog
$ tkn hub get [pipeline | task] myresource --from tekton --version version

hub info

Display information about a resource by its name, kind, catalog, and version.

Example: Display information about a specific version of the mytask task from the tekton catalog
$ tkn hub info task mytask --from tekton --version version

hub install

Install a resource from a catalog by its kind, name, and version.

Example: Install a specific version of the mytask task from the tekton catalog in the mynamespace namespace
$ tkn hub install task mytask --from tekton --version version -n mynamespace

hub reinstall

Reinstall a resource by its kind and name.

Example: Reinstall a specific version of the mytask task from the tekton catalog in the mynamespace namespace
$ tkn hub reinstall task mytask --from tekton --version version -n mynamespace

Search a resource by a combination of name, kind, and tags.

Example: Search a resource with a tag cli
$ tkn hub search --tags cli

hub upgrade

Upgrade an installed resource.

Example: Upgrade the installed mytask task in the mynamespace namespace to a new version
$ tkn hub upgrade task mytask --to version -n mynamespace