Quick Start
This guide covers both administrator and user tasks:
- Administrators: Steps 1-2 (Deploy PAC Component, Configure Access)
- Regular Users: Steps 2-4 (Configure Repository, Create Pipeline, Test)
This guide helps you quickly deploy PAC component and configure your first Git repository integration.
TOC
Introduction
This quick start guide covers:
- Deploying PAC component on Kubernetes
- Configuring a Git repository using
tkn pacCLI - Creating your first pipeline in code
Estimated Reading Time
20-30 minutes
Prerequisites
- Kubernetes cluster (1.24+)
- Tekton Operator installed
- Cluster administrator permissions
- kubectl installed and configured
- tkn CLI installed with pac plugin
- A Git repository with admin access
Step 1: Deploy PAC Component
This section is for cluster administrators. If PAC is already deployed in your cluster, skip to Step 2: Configure Repository.
Create OpenShiftPipelinesAsCode CR
Although the resource name contains "OpenShift", PAC can be deployed on Kubernetes platforms through the Tekton Operator.
Create a file named pac.yaml:
Note: The targetNamespace field specifies where PAC components will be deployed. The default is tekton-pipelines, but you can use any namespace name. Make sure the namespace exists before applying the configuration.
Custom Console Integration: The commented custom console settings allow you to integrate PAC with your custom dashboard. When configured, pipeline status links in Git providers will point to your console. Important: Replace my-cluster in the URLs with your actual cluster name (ask your cluster administrator if unsure). For detailed configuration guide, step-by-step instructions, and troubleshooting, see Configure Custom Console Links.
Apply the configuration:
Example output:
Verify Deployment
Check the PAC component status:
Example output:
Check the PAC pods (replace tekton-pipelines with your actual namespace if different):
Example output:
Note: Throughout this guide, tekton-pipelines is used as the default namespace example. If you deployed PAC in a different namespace, replace tekton-pipelines with your actual namespace name.
You should see three pods in Running state:
pipelines-as-code-controller-*pipelines-as-code-watcher-*pipelines-as-code-webhook-*
Configure Access
This section is for cluster administrators. Regular users can skip this and proceed to Step 2.
Expose the PAC controller so that GitLab webhooks can reach it. You can use Ingress or NodePort. See Manage PAC Component for detailed configuration options.
Important: The PAC controller URL must be accessible from your GitLab server. Make sure to configure the correct URL when setting up the repository.
Get PAC Controller URL
After exposing the PAC controller, you can get the URL using the following methods. Regular users can use these commands to query the URL if needed:
Query Ingress (if configured)
Check if PAC controller is exposed via Ingress (replace <pac-namespace> with your PAC namespace, default is tekton-pipelines):
Example output (if Ingress is configured):
If found, get the Ingress host:
Example output:
Query NodePort Service (if configured)
Check if PAC controller is exposed via NodePort (replace <pac-namespace> with your PAC namespace, default is tekton-pipelines):
Example output (if NodePort is configured):
If found, get the NodePort and node IP:
Example output:
If You Cannot Find the URL
If none of the above methods work or you don't have permission to query cluster resources, contact your PAC administrator to get the PAC controller URL.
Step 2: Configure Repository
This section is for regular users to configure their Git repositories. If you need the PAC controller URL, see the query instructions in Step 1 above, or contact your PAC administrator.
In this guide, we use two different namespaces:
- PAC namespace: The namespace where PAC components (controller, watcher, webhook) are deployed. Default is
tekton-pipelines, but can be customized viatargetNamespacein theOpenShiftPipelinesAsCodeCR. - Pipeline namespace: The namespace where PipelineRuns are created. This is specified when creating the Repository CR and can be any namespace in your cluster.
The --pac-namespace parameter in tkn pac create repo specifies the PAC namespace (where PAC is deployed), not the pipeline namespace (where pipelines will run).
If PAC is already deployed in your cluster, you can skip Step 1 and start from this step. To verify PAC is running, check the pods:
You should see three pods in Running state. If not, contact your PAC administrator or refer to Manage PAC Component.
Install tkn pac Plugin
Ensure you have the tkn pac plugin installed:
Example output:
If the command fails or shows an error, see the installation steps in tkn pac Command Reference.
Create GitLab Personal Access Token
- Go to GitLab → Settings → Access Tokens
- Create a token with
apiscope - Save the token securely
Configure Repository with tkn pac
Important: Navigate to your Git repository directory before running the command. The .tekton directory will be created in the current working directory.
Note: Replace tekton-pipelines with your actual PAC namespace if you deployed PAC in a different namespace. The --pac-namespace parameter specifies where the PAC controller is deployed.
Follow the interactive prompts:
- Enter Git repository URL (auto-detected from current directory, or enter manually)
- Enter namespace for pipelines (default:
default, enterproject-pipelinesor your preferred namespace)- Note: The namespace must exist. Create it first:
kubectl create namespace project-pipelines
- Note: The namespace must exist. Create it first:
- Repository CR will be created at this point
- Enter GitLab project ID (found in project settings → General)
- Enter PAC controller URL (auto-detected, or enter manually if detection fails)
- Enter webhook secret (or press Enter to use auto-generated default)
- Enter GitLab access token (the Personal Access Token you created)
- Enter GitLab API URL (default:
https://gitlab.com, or enter your self-hosted GitLab URL)
The command will:
- Create Repository CR in the cluster
- Configure GitLab webhook automatically
- Create Kubernetes Secret with credentials
- Generate
.tekton/pipelinerun.yamltemplate in your repository
Step 3: Create Your First Pipeline
The tkn pac create repo command creates a basic template at .tekton/pipelinerun.yaml. Edit it to define your pipeline:
Commit and push to your repository:
Note:
- Replace
<your-branch-name>with your branch name (e.g.,main,master, ordevelop) - Make sure the annotation
pipelinesascode.tekton.dev/on-target-branchmatches your branch name. For example, if your branch ismain, use"[refs/heads/main]"; if it'stest, use"[refs/heads/test]" - To match multiple branches, use comma-separated values:
"[main, develop]"or"[refs/heads/main,refs/heads/develop]" - To match all branches, use:
"[refs/heads/*]"
Step 4: Test the Pipeline
Trigger via Push
Push a commit to the branch specified in your pipeline annotation to trigger the pipeline:
Trigger via Merge Request
Create a Merge Request to trigger the pipeline:
Then create a Merge Request in GitLab.
Check Pipeline Status
View PipelineRuns in the namespace:
Example output:
View pipeline logs:
Example output:
Example output:
Next Steps
- Manage PAC Component - Deploy, update, and uninstall guide
- Configure Repository - Advanced repository configuration
- Maintain Pipeline Code - Pipeline definition guide
- Trigger Pipelines - Event triggering guide