Forgejo/Gitea Setup
Technology PreviewForgejo support in Pipelines as Code is in technology preview. Features may change as the integration matures.
Overview
Forgejo is supported as a first-class provider type:- Use
type: "forgejo"in your Repository CRD configuration - Legacy
type: "gitea"is kept as an alias for backwards compatibility
Prerequisites
Before starting, ensure you have installed Pipelines as Code on your Kubernetes cluster.Create Personal Access Token
Create a personal access token for Pipelines as Code to interact with Forgejo.Navigate to Applications settings
Go to:
https://your.forgejo.domain/user/settings/applicationsOr navigate manually:- Click your profile icon
- Go to Settings > Applications
Generate new token
In the Manage Access Tokens section:
- Enter a token name:
pipelines-as-code-token - Select permissions (see below)
- Click Generate Token
Configure required scopes
Required Scopes (necessary for basic functionality):
- Repository (Write) - For setting commit status and reading repository contents
- Issue (Write) - For creating and editing comments on pull requests
Configure optional scopes
Optional Scopes:
- Organization (Read) - Only required if using team-based policies
Most users only need the required scopes. Add Organization (Read) only if you plan to use
policy.team_ids in your Repository CRD to restrict pipeline triggers based on Forgejo organization team membership.Configure Webhook
Get controller URL
On OpenShift:For other Kubernetes distributions, retrieve the public URL from your ingress controller.
Generate webhook secret
Generate a secure random secret:
You can also configure an empty webhook secret if your Forgejo instance is behind a firewall.
Create webhook in Forgejo
- Navigate to your repository in Forgejo
- Go to Settings > Webhooks
- Click Add Webhook > Forgejo
- Configure the webhook:
- HTTP Method: POST
- POST Content Type: application/json
- Target URL: Your Pipelines as Code controller URL
- Secret: The secret you generated (or leave empty)
- Select trigger events (see below)
- Click Add Webhook
Create Repository CRD
Create Kubernetes secret
Create a secret with the personal token and webhook secret:With webhook secret:With empty webhook secret:
Create Repository CRD
For Gitea instances, you can use
type: "gitea" instead of type: "forgejo". Both are functionally identical.Configuration Examples
Standard Forgejo Configuration
Gitea Configuration (Legacy)
With Team-based Policy
To use team-based policies, ensure your personal access token has the Organization (Read) scope.
Managing Tokens
Update Personal Access Token
When your token expires or needs rotation:Using kubectl
Find the secret name in your Repository CRD:By Recreating the Secret
Important Notes
- Provider type: Use
type: "forgejo"for new configurations.type: "gitea"is supported for backwards compatibility - Instance URL required: You must specify
git_provider.urlpointing to your Forgejo/Gitea instance - Webhook signatures: Currently not validated. Webhooks are accepted without signature verification, but secrets can still be stored for future compatibility
- Secrets scope: Secrets must be in the same namespace as the Repository CRD
- CLI support:
tkn pacwebhook management commands are not yet supported for Forgejo/Gitea
Security Considerations
Troubleshooting
Webhooks Not Being Received
-
Check webhook delivery:
- Go to Repository Settings > Webhooks in Forgejo
- Click on your webhook
- View recent deliveries and responses
-
Verify controller logs:
- Test webhook manually: Click “Test Delivery” in Forgejo webhook settings.
Authentication Failures
Verify:- Token has Repository (Write) and Issue (Write) permissions
- Token is not expired
- Secret exists in the correct namespace
git_provider.urlmatches your Forgejo instance URL
Pipeline Not Triggering on Pull Requests
Ensure these pull request events are selected:- Opened
- Reopened
- Synchronized
Team Policy Not Working
If team-based policies aren’t working:- Verify token has Organization (Read) permission
- Check team IDs are correct (visible in organization team settings)
- Ensure policy users are members of specified teams
Next Steps
After configuring Forgejo/Gitea:- Add
.tektondirectory with pipeline definitions to your repository - Test by creating a pull request or pushing commits
- Monitor pipeline status in pull request comments and commit status