tkn pac Command Reference
tkn pac is the official CLI plugin for Pipelines-as-Code. It automates one-off setups (creating the Repository resource, registering the webhook, generating a starter .tekton/pipelinerun.yaml) that are otherwise done manually with kubectl apply and the Git provider's web UI.
This page is a command reference for users who prefer the CLI workflow. For the recommended end-to-end procedure that uses plain manifests, see Configure GitHub Repository and Configure GitLab Repository.
TOC
PrerequisitesInstalling tkn pac PluginVerify InstallationRepository Commandstkn pac create repositorytkn pac listtkn pac repo describeGenerate Commandtkn pac generateResolve Commandtkn pac resolveGlobal OptionsBest Practices1. Repository Management2. Pipeline GenerationTroubleshootingCommand Not FoundConnection IssuesNext StepsPrerequisites
tknCLI installedtkn pacplugin installed- kubectl configured to access your cluster
- PAC component deployed
Installing tkn pac Plugin
Download tkn from Tekton CLI Releases, then install the pac plugin from tkn pac Releases.
Install tkn pac by using one of the methods in the official tkn pac project release guide, and make sure the executable is available in your PATH.
Verify Installation
Example output:
Example output:
Repository Commands
tkn pac create repository
Creates a new Pipelines as Code repository and namespace based on the pipeline run template.
Basic Syntax:
Interactive Mode:
The command will prompt you for:
- Git repository URL (auto-detected from current directory)
- Namespace for pipelines (default:
project-pipelines) - Git provider specific information (e.g., project ID for GitLab)
- PAC controller URL (auto-detected)
- Webhook secret (auto-generated)
- Git provider access token
- Git provider API URL (varies by provider)
What it does:
- Creates a Repository CR in your Kubernetes cluster
- Configures Git provider webhook automatically
- Creates Kubernetes Secret with Git provider credentials
- Generates
.tekton/pipelinerun.yamltemplate in your repository
Example:
Example output (interactive prompts):
For provider-specific end-to-end procedures, see Guides.
tkn pac list
Lists all Pipelines as Code repositories and displays the last status of associated runs.
Basic Syntax:
List in Specific Namespace:
Output Format:
Options:
-n, --namespace <namespace>: Specify namespace to list repositories (default: current kubectl context namespace)-A, --all-namespaces: List repositories in all namespaces-o, --output <format>: Output format (default, json, yaml, wide)
Example:
tkn pac repo describe
Describes a Pipelines as Code repository and associated runs.
Basic Syntax:
Options:
-n, --namespace <namespace>: Specify namespace where the repository is located (default: current kubectl context namespace)-o, --output <format>: Output format (default, json, yaml)
Output Includes:
- Repository CR details
- Git provider configuration
- Webhook configuration
- Recent PipelineRun status
- Last run information
Example:
Example output:
Generate Command
tkn pac generate
Generates a simple PipelineRun template.
Basic Syntax:
Features:
- Automatically detects current Git information from the directory
- Uses basic language detection capability
- Adds extra tasks depending on the detected language
- Creates
.tekton/pipelinerun.yamltemplate
Language Detection:
The command detects the project language and adds appropriate tasks:
- Python: Detects
setup.pyorrequirements.txt, addspylinttask - Go: Detects
go.mod, addsgolangci-linttask - Node.js: Detects
package.json, addsnpmtasks - Java: Detects
pom.xml, addsmaventasks
Example:
Example output:
Generated Template Example:
Resolve Command
tkn pac resolve
Executes a pipeline run as if it is owned by the Pipelines as Code service. This is useful for testing pipeline definitions locally without creating a new commit.
The resolve command processes your PipelineRun definition and:
- Replaces PAC variables (like
{{repo_url}},{{revision}}) with actual values - Resolves task annotations (fetches tasks from Tekton Hub if needed)
- Validates the pipeline structure
- Shows you what the final PipelineRun would look like
Important: This command does not create a PipelineRun in your cluster. It only processes and validates the pipeline definition locally.
Basic Syntax:
Options:
-f, --file: Path to pipeline file or directory (required)-p, --param: Override parameter values (format:key=value)-o, --output: Output format (yaml, json, or default)
Resolve from File:
Resolve from Directory:
The command processes all .yaml and .yml files in the directory.
Override Parameters:
You can override default parameter values derived from the Git repository:
Multiple Files:
You can use the -f flag multiple times:
Auto-Detection:
When run from a source code repository, the command attempts to:
- Detect current Git information
- Automatically resolve parameters such as:
- Current revision (commit SHA)
- Branch name
- Repository URL
- Repository name
Example:
Example output:
Output Format:
The command outputs the resolved PipelineRun YAML to stdout. You can:
-
Save it to a file:
tkn pac resolve -f .tekton/pipelinerun.yaml > resolved.yaml -
View it directly:
tkn pac resolve -f .tekton/pipelinerun.yaml -
Use it for validation: Check if variables are resolved correctly before committing
Example output:
Use Cases:
- Test pipeline definitions locally
- Debug pipeline issues without creating commits
- Validate pipeline syntax before committing
- Test parameter resolution
Global Options
All tkn pac commands support the following global options:
-h, --help: Show help for the command-v, --version: Show version information--kubeconfig: Path to kubeconfig file--context: Kubernetes context to use
Best Practices
1. Repository Management
- Use descriptive names: Choose clear repository names
- Organize by namespace: Group related repositories in namespaces
- Regular monitoring: Use
tkn pac listto monitor repository status
2. Pipeline Generation
- Review generated templates: Always review and customize generated pipelines
- Test locally: Use
tkn pac resolveto test pipelines before committing - Version control: Commit pipeline definitions to Git
Troubleshooting
Command Not Found
If tkn pac command is not found:
-
Verify installation:
Example output:
-
Check PATH: Ensure
tkn-pacis in your PATH -
Reinstall: Reinstall the plugin if needed
Connection Issues
If commands fail to connect to the cluster:
- Verify kubectl: Test kubectl connection
- Check context: Verify Kubernetes context
- Review permissions: Ensure you have required permissions
Next Steps
- Guides - Repository setup walkthroughs
- Incoming Webhooks - Trigger pipelines via webhooks
- Manage PAC Component - PAC component management
- Common Issues - Troubleshooting guide