Quickstart guide
Get up and running with Pipelines as Code in just a few minutes using thetkn pac CLI. This guide will walk you through installing the CLI, bootstrapping Pipelines as Code on your cluster, creating a GitHub App, and running your first pipeline.
This guide assumes you’re using the public GitHub instance. If you’re using GitHub Enterprise, you’ll need to use the
--github-hostname flag with the hostname of your GitHub Enterprise instance.Prerequisites
Before you begin, make sure you have:- A Kubernetes cluster like Kind, Minikube, or OpenShift Local
- Tekton Pipelines installed on your cluster (version 0.50.0+)
- A GitHub account
gitconfigured to push to GitHub
Step 1: Install the tkn pac CLI
Choose your preferred installation method:- Homebrew (macOS/Linux)
- Direct download (Linux)
- Direct download (macOS)
Step 2: Bootstrap Pipelines as Code
Thetkn pac bootstrap command helps you start using Pipelines as Code quickly by:
- Installing Pipelines as Code on your cluster (if not already installed)
- Setting up a webhook forwarder for local development (optional)
- Creating a GitHub Application
- Configuring dashboard integration
Install Pipelines as Code
The CLI will first check if Pipelines as Code is installed:Y to install it.
Set up webhook forwarder (optional)
For local development, you’ll be asked if you want to install gosmee, a webhook forwarder:Configure dashboard (optional)
If you have the Tekton Dashboard installed, the CLI will detect it:Y to use it for viewing pipeline logs and status.
Step 3: Create a GitHub Application
The bootstrap command will now help you create a GitHub Application:The CLI will launch your web browser with a URL to create the GitHub Application. Click the button and you’ll be redirected to GitHub.
Step 4: Create a GitHub repository
If you don’t have a repository, you can create one from our template:- Go to https://github.com/openshift-pipelines/pac-demo/generate
- Choose your username and a repository name (e.g.,
pac-demo) - Click “Create repository from template”
https://github.com/yourusername/pac-demo.
Step 5: Install GitHub App on your repository
Next, install the GitHub Application on your repository:Visit the GitHub App URL
Go to the GitHub App URL provided by
tkn pac bootstrap, for example:
https://github.com/apps/my-paac-applicationStep 6: Clone your repository
Clone the repository to your local machine:Step 7: Create a Repository CRD
The Repository Custom Resource (CRD) tells Pipelines as Code which repository to watch and where to run PipelineRuns.A Repository CR is how you configure Pipelines as Code. The namespace location where you create the CR is where your PipelineRuns will be executed.
Y to create the namespace.
The command will:
- Create a Repository CR in your cluster
- Create a
.tektondirectory with apipelinerun.yamlfile - Detect your programming language and generate an appropriate template
Step 8: Create a pull request
Now let’s test Pipelines as Code by creating a pull request:
As soon as you create the pull request, Pipelines as Code will be triggered and run on your Pull Request!
Step 9: View pipeline execution
You’ll see a status check on your pull request:- Click on the “Details” link to see the PipelineRun details
- Pipelines as Code will provide a link to your Tekton Dashboard or OpenShift Console
- Alternatively, use the
tkn pacCLI to follow logs:
- Using CLI
- Using Dashboard
Step 10: Understanding the demo failure (optional)
If you’re using the pac-demo template, you might notice the pipeline fails on purpose. This demonstrates how Pipelines as Code:- Analyzes log errors from the PipelineRun
- Matches errors to specific lines of code
- Provides annotations on the pull request showing exactly where the issue is
What’s next?
Congratulations! You’ve successfully set up Pipelines as Code and run your first pipeline. Here’s what to explore next:Core concepts
Understand the architecture and key components
Writing pipelines
Learn how to customize your pipeline definitions
Repository CRD
Configure advanced repository settings
GitOps commands
Use /test, /retest, and /cancel commands
Troubleshooting
GitHub App not receiving webhooks
If you’re using gosmee for local development, make sure it’s running:Pipeline not triggering
Check that:- The Repository CR exists in your namespace:
kubectl get repository -n pac-demo-pipelines - The GitHub App is installed on your repository
- Your
.tekton/pipelinerun.yamlhas the correct annotations for the event type
View Pipelines as Code logs
Next steps
Now that you have Pipelines as Code running, you can:- Customize your pipeline to match your project’s needs
- Add more tasks from Tekton Hub or Artifact Hub
- Configure advanced features like secrets, conditional execution, and path-based triggers
- Set up additional repositories
- Explore different Git providers like GitLab or Bitbucket