Skip to content
This project is under active development. Some features may be incomplete.

GitLab Integration

Oore integrates with GitLab using:

  • Webhooks: For receiving push and merge request events
  • OAuth (optional): For cloning private repositories

GitLab webhooks use token-based authentication (simpler than GitHub’s HMAC signatures).

Quick Setup

  1. Add repository to Oore

    Terminal window
    oore repo add \
    --provider gitlab \
    --owner myuser \
    --repo my-project \
    --webhook-secret "my-secure-secret" \
    --gitlab-project-id 12345678
  2. Get webhook URL

    Terminal window
    oore repo webhook-url <repo-id>
  3. Configure in GitLab

    Go to Settings → Webhooks in your GitLab project:

    FieldValue
    URLWebhook URL from step 2
    Secret tokenSame secret from step 1
    Push events
    Merge request events
  4. Test the webhook

    Click “Test” → “Push events” in GitLab, then verify:

    Terminal window
    oore webhook list

GitLab OAuth Setup

For private repositories, automatic webhook creation, and status updates:

1. Create GitLab Application

Go to GitLab → Settings → Applications:

FieldValue
NameOore CI
Redirect URIhttps://your-server.com/setup/gitlab/callback
ConfidentialYes
Scopesapi, read_repository

Configure in /etc/oore/oore.env:

Terminal window
OORE_GITLAB_CLIENT_ID=your-application-id
OORE_GITLAB_CLIENT_SECRET=your-application-secret

2. Connect Account

Terminal window
# For gitlab.com
oore gitlab connect --admin-token YOUR_TOKEN
# For self-hosted
oore gitlab connect --instance https://gitlab.mycompany.com --admin-token YOUR_TOKEN

Follow the URL to authorize, then complete with:

Terminal window
oore gitlab callback "<REDIRECT_URL>" --admin-token YOUR_TOKEN

3. Enable Projects

List available projects and enable CI:

Terminal window
# List accessible projects
oore gitlab projects --admin-token YOUR_TOKEN
# Enable CI for a project (creates repository and webhook automatically)
oore gitlab enable 12345678 --admin-token YOUR_TOKEN

How It Works

GitLab oored Build
│ │ │
│ POST /webhooks/gitlab/:id │ │
├──────────────────────────────▶│ │
│ │ 1. Verify token │
│ │ 2. Store event │
│ │ 3. Queue for processing │
│ {"status":"ok"} │ │
│◀──────────────────────────────┤ │

Security: Token Storage

GitLab tokens are stored securely:

  1. Token sent in X-Gitlab-Token header
  2. Oore stores HMAC-SHA256(token, pepper) in database
  3. On verification, compute HMAC and compare

Event Types

EventTrigger
Push HookCode pushed
Merge Request HookMR opened/updated/merged
Tag Push HookNew tag created

GitLab.com vs Self-Hosted

Configure environment variables for OAuth:

Terminal window
OORE_GITLAB_CLIENT_ID=your-app-id
OORE_GITLAB_CLIENT_SECRET=your-app-secret

Troubleshooting

Webhooks Not Received

  • Check URL is publicly accessible
  • Token must match exactly (case-sensitive)
  • SSL certificate must be valid

View logs in GitLab → Settings → Webhooks → Recent events

Token Verification Failures

Terminal window
# Update token in Oore
oore repo add --provider gitlab --owner myuser --repo my-project \
--webhook-secret "new-secret" --force
# Then update in GitLab webhook settings

Comparing GitHub vs GitLab

FeatureGitHubGitLab
Webhook authHMAC-SHA256 signatureToken header
App modelGitHub AppOAuth + Webhooks
Token storageN/A (signature-based)HMAC hashed

Complete Example (OAuth Flow)

Terminal window
# 1. Connect GitLab account
oore gitlab connect --admin-token YOUR_TOKEN
# Follow the URL, authorize, then:
oore gitlab callback "<REDIRECT_URL>" --admin-token YOUR_TOKEN
# 2. List projects
oore gitlab projects --admin-token YOUR_TOKEN
# 3. Enable CI for a project (creates repo + webhook automatically)
oore gitlab enable 12345678 --admin-token YOUR_TOKEN
# 4. Push code
git push origin main
# 5. Check builds
oore build list

Manual Webhook Setup (Without OAuth)

If you prefer not to use OAuth:

Terminal window
# 1. Add repository manually
oore repo add \
--provider gitlab \
--owner myuser \
--repo my-flutter-app \
--webhook-secret "$(openssl rand -hex 20)" \
--gitlab-project-id 12345678
# 2. Get webhook URL
oore repo webhook-url <repo-id>
# 3. Configure webhook manually in GitLab UI
# 4. Test webhook
# 5. Push code
git push origin main
# 6. Check builds
oore build list