GitLab Integration
RunnerHub integrates with GitLab using OAuth, allowing you to connect projects, trigger builds, and report status back to merge requests.
How It Works
Section titled “How It Works”RunnerHub uses OAuth 2.0 to securely authenticate with GitLab:
You click "Connect GitLab" in RunnerHub ↓Redirected to GitLab login ↓Grant RunnerHub access to your projects ↓GitLab redirects back to RunnerHub ↓Webhook automatically configured ↓Builds trigger on push/MR eventsInstallation
Section titled “Installation”Step 1: Start the OAuth Flow
Section titled “Step 1: Start the OAuth Flow”- Go to your RunnerHub app
- Click Repository → Connect
- Select GitLab
You’ll be redirected to GitLab to authorize RunnerHub.
Step 2: Authorize RunnerHub
Section titled “Step 2: Authorize RunnerHub”On GitLab:
- Log in to your account
- Review the permissions requested by RunnerHub
- Click Authorize
You’ll be redirected back to RunnerHub.
Step 3: Select a Project
Section titled “Step 3: Select a Project”- RunnerHub shows a list of projects you have access to
- Click the project you want to connect
- Click Connect
RunnerHub will:
- Store your GitLab access token (encrypted)
- Automatically configure a webhook on the project
- Start listening for push and merge request events
Permissions
Section titled “Permissions”When you authorize RunnerHub, GitLab grants these access scopes:
| Permission | Purpose |
|---|---|
api | Full API access to your projects |
read_api | Read project data and repository content |
read_repository | Clone the repository |
write_repository | Optional: for advanced features |
These permissions are scoped to the projects you authorize.
How Builds Are Triggered
Section titled “How Builds Are Triggered”Builds start automatically on:
| Event | Trigger |
|---|---|
| Push | New commits to any branch |
| Merge Request | MR opened or updated |
| Manual | Via RunnerHub dashboard |
| Scheduled | Cron-based triggers (app config) |
Filter Branches:
In your pipeline YAML, specify which branches to build:
triggers: - event: push branches: - main - develop - release/*Webhook Configuration
Section titled “Webhook Configuration”Webhooks are automatically configured when you connect a project.
Webhook Details:
- Events: push_events, merge_request_events
- Active: Yes
To view or manage the webhook:
- Go to your GitLab project
- Settings → Webhooks
- Find “RunnerHub” in the list
Status Reporting
Section titled “Status Reporting”Pipeline Status on Commits
Section titled “Pipeline Status on Commits”When a build completes, RunnerHub posts the status to your commit:
- Go to your GitLab project
- Navigate to Repository → Commits
- Click a commit hash
- The build status appears in the commit details
Merge Request Checks
Section titled “Merge Request Checks”When you open a merge request:
- RunnerHub automatically starts a build
- Status appears in the MR “Checks” section
- If you set status checks as required, MRs can’t merge until passing
Setting Required Checks:
- Go to project → Settings → Protected Branches
- Select a branch
- Check “Status checks must succeed”
- Save
Token Refresh
Section titled “Token Refresh”RunnerHub automatically handles token refresh:
- GitLab OAuth tokens expire after a set period
- RunnerHub detects expiration and automatically refreshes the token
- You won’t see any interruption — builds continue working
If a token becomes invalid:
- Disconnect the project: App → Repository → Disconnect
- Reconnect: Click Connect and authorize again
Troubleshooting
Section titled “Troubleshooting””Webhook Not Triggered”
Section titled “”Webhook Not Triggered””If builds aren’t starting after commits:
-
Verify webhook exists:
- Go to project → Settings → Webhooks
- Check that “RunnerHub” is listed and active
- Click “Recent events” to see delivery status
-
Check webhook logs:
- Click the RunnerHub webhook
- Scroll to “Recent events”
- Look for error messages
- Click an event to see full request/response
-
Reconnect the project:
- Disconnect: App → Repository → Disconnect
- Reconnect: App → Repository → Connect → Select Project
- RunnerHub will reconfigure the webhook
”Project Not Found”
Section titled “”Project Not Found””If you can’t see your project in the list:
- Make sure you’re logged in to GitLab
- Verify you have at least Reporter access to the project
- Go to project → Members
- Check your role
- Try logging out and authorizing RunnerHub again
”Permission Denied”
Section titled “”Permission Denied””If you get permission errors:
- Check your GitLab project role:
- Reporter or above can trigger builds
- Owner/Maintainer can manage webhooks
- Verify the OAuth token has the correct scopes:
- Disconnect the project
- Re-authorize RunnerHub
”Build Logs Not Appearing”
Section titled “”Build Logs Not Appearing””If you can see the build in RunnerHub but logs don’t populate:
- Check that the webhook was received:
- Go to project → Settings → Webhooks → RunnerHub
- Click “Recent events” and verify push event was received
- Verify repository access:
- In RunnerHub, go to app → Repository details
- Confirm the clone URL is correct
- Check for authentication issues in RunnerHub logs
Security
Section titled “Security”Token Storage
Section titled “Token Storage”- GitLab OAuth tokens are encrypted at rest
- Only the workspace owner can disconnect or change integrations
- Tokens are never displayed or shared
Webhook Verification
Section titled “Webhook Verification”RunnerHub verifies webhook authenticity using GitLab’s:
X-GitLab-Event-UUIDheader for idempotency- Webhook signature validation (if enabled in GitLab)
Uninstalling
Section titled “Uninstalling”To remove RunnerHub’s access:
Option 1: Disconnect in RunnerHub
- Go to your app
- Click Repository → Disconnect
- The webhook is removed from GitLab
Option 2: Revoke in GitLab
- Go to GitLab User Settings → Applications
- Find “RunnerHub”
- Click “Revoke”
- All RunnerHub projects go offline in your workspace
Multiple Workspaces
Section titled “Multiple Workspaces”You can connect the same GitLab project to different RunnerHub workspaces:
- Each workspace has separate OAuth tokens
- Webhooks are independent
- Both will receive events and create jobs
To do this:
- Authorize RunnerHub in each workspace separately
- Connect the same project to apps in different workspaces
Advanced: Custom Webhook URL
Section titled “Advanced: Custom Webhook URL”If your RunnerHub instance is self-hosted, you may need to update the webhook URL:
- Go to project → Settings → Webhooks → RunnerHub
- Edit the webhook URL to match your instance
- Save
The URL should be: https://<your-runnerhub-instance>/webhooks/gitlab
Best Practices
Section titled “Best Practices”1. Use Branch Protection
Require builds to pass before merging:
- Go to project → Settings → Protected Branches
- Select a branch (e.g.,
main) - Check “Require status checks to pass”
- Save
2. Keep Tokens Fresh
- Every 90 days, GitLab recommends re-authorizing apps
- RunnerHub handles token refresh automatically
- If builds stop working, reconnect the project
3. Monitor Webhook Deliveries
Periodically check webhook health:
- Go to project → Settings → Webhooks → RunnerHub
- Click “Recent events”
- Verify no failed deliveries
- If failures appear, reconnect the project
4. Use Scheduled Builds
In addition to push triggers:
- Go to your app → Schedules
- Create a nightly build or performance test
- Set time and days of week
Comparison with GitHub
Section titled “Comparison with GitHub”| Feature | GitLab | GitHub |
|---|---|---|
| Auth | OAuth 2.0 | GitHub App |
| Webhook Setup | Automatic | Automatic |
| Status Checks | Yes | Yes (Check Runs) |
| Status Reports | Commit + MR | PR Checks |
| Token Refresh | Automatic | N/A (App-based) |
| Scope | Project-level | Organization level |