tkn pac resolve
Resolve a PipelineRun as if it were executed by Pipelines-as-Code, allowing local testing before pushing to Git.Synopsis
Description
Theresolve command processes PipelineRun templates the same way PAC does on the service:
- Reads template files from
.tekton/or specified paths - Substitutes variables (repo_url, revision, etc.)
- Inlines remote tasks from Tekton Hub or Artifact Hub
- Generates secrets if needed (e.g.,
git_auth_secret) - Outputs resolved YAML ready to apply to cluster
Usage Examples
Required Flags
Template file, directory, or URL
- Single file:
-f .tekton/pull-request.yaml - Multiple files:
-f file1.yaml -f file2.yaml - Directory:
-f .tekton/(processes all.yamlfiles) - Multiple directories:
-f .tekton/ -f tasks/
Flags
Parameters to substitute (format:
key=value)Examples:-p revision=main-p repo_url=https://github.com/org/repo-p image_name=quay.io/myorg/myapp
Output file path (default: stdout)
Skip inlining these tasks (use them as-is)Tasks must exist in the namespace to use them:
Provider token for git-auth-secret generationCan also be set via
PAC_PROVIDER_TOKEN environment variableDon’t generate git-auth-secret even if
{{ git_auth_secret }} is foundDon’t add generateName field for PipelineRun uniqueness
Output as Tekton v1beta1 formatUseful when targeting clusters where bundle conversion doesn’t work correctly
Auto-Detection
When run from a Git repository, parameters are auto-detected:| Parameter | Auto-Detected From |
|---|---|
repo_url | Git remote URL |
revision | Current commit SHA |
repo_owner | Repository owner from URL |
repo_name | Repository name from URL |
Auto-detected values can be overridden with
-p flags.Parameter Substitution
Template variables are replaced with actual values:Template
.tekton/pull-request.yaml
Resolved
Remote Task Inlining
Remote tasks are automatically fetched and embedded:Template
Resolved
Git Auth Secret Generation
If{{ git_auth_secret }} is found in templates:
- Prompts for token (or uses
PAC_PROVIDER_TOKENenv var) - Creates Secret YAML for Git authentication
- Substitutes
{{ git_auth_secret }}with secret name - Outputs secret along with PipelineRun
Example
Output Example
Common Workflows
Test Before Pushing
Debug Parameters
Test Multiple Templates
Use Existing Cluster Tasks
Generate v1beta1 for Legacy Clusters
Limitations
- Local task directories: Tasks from local directories referenced in annotations cannot be resolved
- Provider-specific features: Some Git provider specific features may not work
- Webhook payloads: Cannot simulate full webhook payloads
Git Clone Requirement
The resolved PipelineRun must be able to access the repository at the specified SHA:Troubleshooting
No Files Specified
File Not Found
- Check file path:
ls .tekton/ - Use absolute path:
tkn pac resolve -f $PWD/.tekton/pr.yaml - Check current directory:
pwd
Cannot Connect to Cluster
Remote Task Resolution Failed
- Check internet connectivity
- Verify task name exists on Hub: https://hub.tekton.dev/
- Use
--skipto skip problematic tasks
Invalid Template Syntax
Environment Variables
Git provider token for secret generation
Related Commands
tkn pac generate- Generate PipelineRun templatestkn pac create repo- Create Repository CRDkubectl apply- Apply resolved YAML to cluster