GitHub App Setup
The GitHub App installation is the recommended way to integrate Pipelines as Code with GitHub. It provides the best user experience by leveraging GitHub’s Check Runs API to display pipeline status directly in pull requests.Overview
GitHub Apps act as the integration point between your Kubernetes cluster and GitHub, bringing Git workflows into Tekton pipelines. Typically, you need only one GitHub App per cluster, usually set up by a cluster administrator. The GitHub App webhook must point to your Pipelines as Code controller route or ingress endpoint to receive GitHub events.Setup Methods
There are two ways to set up a GitHub App:Option 1: Automated Setup with tkn pac CLI
The easiest method is using thetkn pac bootstrap command:
Run bootstrap command
- Create a GitHub App with the correct permissions
- Generate the webhook secret
- Configure the webhook URL
- Create the necessary Kubernetes secrets
Option 2: Manual Setup
For more control over the configuration, you can set up the GitHub App manually:Create a new GitHub App
- Go to https://github.com/settings/apps (or Settings > Developer settings > GitHub Apps)
- Click the New GitHub App button
Configure basic information
Provide the following details:
- GitHub Application Name:
OpenShift Pipelines(or your preferred name) - Homepage URL: Your OpenShift Console URL or cluster dashboard
- Webhook URL: The Pipelines as Code controller public endpoint
- Webhook secret: Generate a secure secret:
Save the webhook secret - you’ll need it when creating the Kubernetes secret.
Set repository permissions
Configure the following repository permissions:
| Permission | Access |
|---|---|
| Checks | Read & Write |
| Contents | Read & Write |
| Issues | Read & Write |
| Metadata | Read only |
| Pull requests | Read & Write |
Subscribe to events
Select the following webhook events:
- Check run
- Check suite
- Issue comment
- Commit comment
- Pull request
- Push
Configure Pipelines as Code to Use the GitHub App
After creating the GitHub App, configure your cluster to use it:Create the Kubernetes secret
Create a secret containing the GitHub App credentials:Replace:
$PATH_PRIVATE_KEY- Path to the downloaded private key fileAPP_ID- The App ID from the GitHub App details pageWEBHOOK_SECRET- The webhook secret you configured
GitHub Enterprise Support
Pipelines as Code fully supports GitHub Enterprise.No special configuration is needed for GitHub Enterprise. Pipelines as Code automatically detects GitHub Enterprise headers and uses the appropriate API endpoints.
- GitHub Enterprise sends webhooks to your controller
- The controller identifies the GitHub Enterprise headers
- API calls are routed to your GitHub Enterprise instance
Authentication Flow
The GitHub App uses the following authentication mechanism:- Webhook Validation: Incoming webhooks are validated using the webhook secret to ensure they’re from GitHub
- Token Generation: The controller generates a short-lived installation token using the GitHub App private key
- API Operations: The installation token is used for GitHub API operations (setting status, fetching code, etc.)
Permissions Reference
Here’s why each permission is needed:- Checks (Read & Write): Display pipeline status in the GitHub Checks tab
- Contents (Read & Write): Access
.tektondirectory and pipeline definitions - Issues (Read & Write): Support for
/retestand/ok-to-testcommands - Metadata (Read only): Access repository information
- Pull requests (Read & Write): Trigger pipelines on PR events and update status
- Members (Read only): Verify user permissions for triggering pipelines
Next Steps
After setting up your GitHub App:- Create a Repository CRD for each repository you want to monitor
- Add
.tektondirectory with your pipeline definitions to your repositories - Test the integration by creating a pull request