Chapter 3. OpenShift Pipelines tkn reference
Use the tkn CLI to manage pipelines, tasks, pipeline runs, and other OpenShift Pipelines resources from the command line.
- Basic syntax
$ tkn [command or options] [arguments...]- Global options
--help, -h
3.1. Utility commands Copy linkLink copied to clipboard!
You can use utility commands in the tkn CLI to manage the CLI environment. These commands allow you to check the version and enable shell prompt completion.
3.1.1. tkn Copy linkLink copied to clipboard!
Parent command for tkn CLI.
Example: Display all options
$ tkn
3.1.2. completion [shell] Copy linkLink copied to clipboard!
Print shell prompt completion code that you must evaluate to give interactive completion. Supported shells are bash and zsh.
Example: Completion code for the bash shell prompt
$ tkn completion bash
3.1.3. version Copy linkLink copied to clipboard!
Print version information of the tkn CLI.
Example: Check the tkn version
$ tkn version
3.2. Pipelines management commands Copy linkLink copied to clipboard!
Use the tkn pipeline commands to create, list, start, delete, and describe pipelines from the command line.
3.2.1. pipeline Copy linkLink copied to clipboard!
Manage pipelines.
Example: Display help
$ tkn pipeline --help
3.2.2. pipeline delete Copy linkLink copied to clipboard!
Delete a pipeline.
Example: Delete a pipeline from a namespace
$ tkn pipeline delete <pipeline_name> -n <namespace_name>
3.2.3. pipeline describe Copy linkLink copied to clipboard!
Describe a pipeline.
Example: Describe a pipeline
$ tkn pipeline describe <pipeline_name>
3.2.4. pipeline list Copy linkLink copied to clipboard!
Display a list of pipelines.
Example: Display a list of pipelines
$ tkn pipeline list
3.2.5. pipeline logs Copy linkLink copied to clipboard!
Display the logs for a specific pipeline.
Example: Stream the live logs for a pipeline
$ tkn pipeline logs -f <pipeline_name>
3.2.6. pipeline start Copy linkLink copied to clipboard!
Start a pipeline.
Example: Start a pipeline
$ tkn pipeline start <pipeline_name>
3.3. Pipeline run commands Copy linkLink copied to clipboard!
Use the tkn pipelinerun commands to list, describe, cancel, and delete pipeline runs from the command line.
3.3.1. pipelinerun Copy linkLink copied to clipboard!
Manage pipeline runs.
Example: Display help
$ tkn pipelinerun -h
3.3.2. pipelinerun cancel Copy linkLink copied to clipboard!
Cancel a pipeline run.
Example: Cancel a pipeline run from a namespace
$ tkn pipelinerun cancel <pipeline_run_name> -n <namespace_name>
3.3.3. pipelinerun delete Copy linkLink copied to clipboard!
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
<namespace_name>-
Replace
5with 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.
3.3.4. pipelinerun describe Copy linkLink copied to clipboard!
Describe a pipeline run.
Example: Describe a pipeline run in a namespace
$ tkn pipelinerun describe <pipeline_run_name> -n <namespace_name>
3.3.5. pipelinerun list Copy linkLink copied to clipboard!
List pipeline runs.
Example: Display a list of pipeline runs in a namespace
$ tkn pipelinerun list -n <namespace_name>
3.3.6. pipelinerun logs Copy linkLink copied to clipboard!
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>
3.4. Task management commands Copy linkLink copied to clipboard!
Use the tkn task commands to create, list, start, delete, and describe tasks from the command line.
3.4.1. task Copy linkLink copied to clipboard!
Manage tasks.
Example: Display help
$ tkn task -h
3.4.2. task delete Copy linkLink copied to clipboard!
Delete a task.
Example: Delete tasks from a namespace
$ tkn task delete <task_name_1> <task_name_2> -n <namespace_name>
3.4.3. task describe Copy linkLink copied to clipboard!
Describe a task.
Example: Describe a task in a namespace
$ tkn task describe <task_name> -n <namespace_name>
3.4.4. task list Copy linkLink copied to clipboard!
List tasks.
Example: List all the tasks in a namespace
$ tkn task list -n <namespace_name>
3.4.5. task start Copy linkLink copied to clipboard!
Start a task.
Example: Start a task in a namespace
$ tkn task start <task_name> -s <service_account_name> -n <namespace_name>
3.5. Task run commands Copy linkLink copied to clipboard!
Use the tkn taskrun commands to list, describe, cancel, and delete task runs from the command line.
3.5.1. taskrun Copy linkLink copied to clipboard!
Manage task runs.
Example: Display help
$ tkn taskrun -h
3.5.2. taskrun cancel Copy linkLink copied to clipboard!
Cancel a task run.
Example: Cancel a task run from a namespace
$ tkn taskrun cancel <task_run_name> -n <namespace_name>
3.5.3. taskrun delete Copy linkLink copied to clipboard!
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
<namespace_name>-
Replace
5with the number of most recently executed task runs you want to retain.
3.5.4. taskrun describe Copy linkLink copied to clipboard!
Describe a task run.
Example: Describe a task run in a namespace
$ tkn taskrun describe <task_run_name> -n <namespace_name>
3.5.5. taskrun list Copy linkLink copied to clipboard!
List task runs.
Example: List all the task runs in a namespace
$ tkn taskrun list -n <namespace_name>
3.5.6. taskrun logs Copy linkLink copied to clipboard!
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>
3.6. Pipeline resource management commands Copy linkLink copied to clipboard!
You can use the tkn resource commands to manage, create, view, and interact with pipeline resources in your namespace.
resourceManage pipeline resources.
Example: Display help
$ tkn resource -hresource createCreate a pipeline resource.
Example: Create a pipeline resource in a namespace
$ tkn resource create -n myspaceThis 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 deleteDelete a pipeline resource.
Example: Delete the
myresourcepipeline resource from a namespace$ tkn resource delete myresource -n myspaceresource describeDescribe a pipeline resource.
Example: Describe the
myresourcepipeline resource$ tkn resource describe myresource -n myspaceresource listList pipeline resources.
Example: List all pipeline resources in a namespace
$ tkn resource list -n myspace
3.7. Trigger management commands Copy linkLink copied to clipboard!
You can use the tkn trigger management commands to manage, creating, viewing, and interacting with EventListener, TriggerBinding, TriggerTemplate, and ClusterTriggerBinding resources in your namespace.
eventlistenerManage event listeners.
Example: Display help
$ tkn eventlistener -heventlistener deleteDelete an event listener.
Example: Delete
mylistener1andmylistener2event listeners in a namespace$ tkn eventlistener delete mylistener1 mylistener2 -n myspaceeventlistener describeDescribe an event listener.
Example: Describe the
mylistenerevent listener in a namespace$ tkn eventlistener describe mylistener -n myspaceeventlistener listList event listeners.
Example: List all the event listeners in a namespace
$ tkn eventlistener list -n myspaceeventlistener logsDisplay logs of an event listener.
Example: Display the logs of the
mylistenerevent listener in a namespace$ tkn eventlistener logs mylistener -n myspacetriggerbindingManage trigger bindings.
Example: Display trigger bindings help
$ tkn triggerbinding -htriggerbinding deleteDelete a trigger binding.
Example: Delete
mybinding1andmybinding2trigger bindings in a namespace$ tkn triggerbinding delete mybinding1 mybinding2 -n myspacetriggerbinding describeDescribe a trigger binding.
Example: Describe the
mybindingtrigger binding in a namespace$ tkn triggerbinding describe mybinding -n myspacetriggerbinding listList trigger bindings.
Example: List all the trigger bindings in a namespace
$ tkn triggerbinding list -n myspacetriggertemplateManage trigger templates.
Example: Display trigger template help
$ tkn triggertemplate -htriggertemplate deleteDelete a trigger template.
Example: Delete
mytemplate1andmytemplate2trigger templates in a namespace$ tkn triggertemplate delete mytemplate1 mytemplate2 -n `myspace`triggertemplate describeDescribe a trigger template.
Example: Describe the
mytemplatetrigger template in a namespace$ tkn triggertemplate describe mytemplate -n `myspace`triggertemplate listList trigger templates.
Example: List all the trigger templates in a namespace
$ tkn triggertemplate list -n myspaceclustertriggerbindingManage cluster trigger bindings.
Example: Display cluster trigger bindings help
$ tkn clustertriggerbinding -hclustertriggerbinding deleteDelete a cluster trigger binding.
Example: Delete
myclusterbinding1andmyclusterbinding2cluster trigger bindings$ tkn clustertriggerbinding delete myclusterbinding1 myclusterbinding2clustertriggerbinding describeDescribe a cluster trigger binding.
Example: Describe the
myclusterbindingcluster trigger binding$ tkn clustertriggerbinding describe myclusterbindingclustertriggerbinding listList cluster trigger bindings.
Example: List all cluster trigger bindings
$ tkn clustertriggerbinding list
3.8. Hub interaction commands Copy linkLink copied to clipboard!
You can use the tkn hub commands to interact with Artifact Hub and manage resources such as tasks and pipelines.
hubInteract with hub.
Example: Display help
$ tkn hub -hNoteFor each example, to get the corresponding sub-commands and flags, run
tkn hub <command> --help.hub downgradeRoll back an installed resource to an earlier version.
Example: Roll back the
mytasktask in themynamespacenamespace to its older version$ tkn hub downgrade task mytask --to <version> -n mynamespacehub getGet a resource manifest by its name, kind, catalog, and version.
Example: Get the manifest for a specific version of the
myresourcepipeline or task from thetekton-catalog-taskscatalog$ tkn hub get [pipeline | task] myresource --from tekton-catalog-tasks --version <version>hub infoDisplay information about a resource by its name, kind, catalog, and version.
Example: Display information about a specific version of the
mytasktask from thetekton-catalog-taskscatalog$ tkn hub info task mytask --from tekton-catalog-tasks --version <version>hub installInstall a resource from a catalog by its kind, name, and version.
Example: Install a specific version of the
mytasktask from thetekton-catalog-taskscatalog in themynamespacenamespace$ tkn hub install task mytask --from tekton-catalog-tasks --version <version> -n mynamespacehub reinstallReinstall a resource by its kind and name.
Example: Reinstall a specific version of the
mytasktask from thetekton-catalog-taskscatalog in themynamespacenamespace$ tkn hub reinstall task mytask --from tekton-catalog-tasks --version <version> -n mynamespacehub searchSearch a resource by a combination of name, kind, and tags.
Example: Search a resource with a tag
cli$ tkn hub search --tags clihub upgradeUpgrade an installed resource.
Example: Upgrade the installed
mytasktask in themynamespacenamespace to a new version$ tkn hub upgrade task mytask --to <version> -n mynamespace