GitLab integration
Connect gitlab.com or self-hosted GitLab with OAuth, use connected-account App Services, and enable push-to-deploy.
Use this guide when App Services should build from GitLab repositories. dFlow connects through OAuth so you can pick repositories and branches from the dashboard, register push webhooks, and show deploy status on commits.
For public repositories or one-off clones without a connected account, you can still use a repository URL with an optional Personal Access Token (PAT). See Manual deployment below and Git source integrations under Integrations in the sidebar for PAT scope details shared with other token-based Git hosts.
For the shortest dFlow Cloud path, see Integrations overview under Integrations in the sidebar.
Before you start
- You can sign in to gitlab.com or your self-hosted instance as a user who may authorize OAuth applications.
- You know which repositories and branches map to which Application and Environment (see How dFlow is structured under Core Concepts in the sidebar).
- Review Integration permissions and prerequisites for least-privilege and token hygiene.
1. Open GitLab in Integrations
- Sign in to the dFlow dashboard (for example app.dflow.sh on dFlow Cloud).
- Open Integrations (or Settings → Integrations, depending on your UI version).
- Select GitLab and click Connect GitLab.
2. Connect gitlab.com (recommended)
- In the connect dialog, choose GitLab.com.
- Sign in on gitlab.com when redirected and approve the requested scopes:
api,read_user,read_repository. - Return to dFlow when authorization completes.
Expected outcome: GitLab shows as connected and repository pickers list repos your account can access.
dFlow uses a shared OAuth application on gitlab.com. You do not create your own OAuth app for gitlab.com.
3. Connect self-hosted GitLab
Use this when your organization runs GitLab on its own domain (for example https://git.example.com) instead of gitlab.com.
dFlow cannot use the shared gitlab.com OAuth app on a private instance. Register an OAuth application on that GitLab instance, then paste the credentials into dFlow when connecting.
Where to create the application
Depending on your GitLab policy, create the OAuth application in one of these places:
| Location | Path in GitLab |
|---|---|
| Instance-wide (typical for enterprise) | Admin Area → Applications → Add new application |
| Group-owned | Group → Settings → Applications |
| User-owned | Edit profile → Applications |
OAuth application fields
Use these values when creating the application. The connect dialog in dFlow shows the exact Redirect URI for your deployment (copy it from there).
| GitLab field | What to enter |
|---|---|
| Name | Any label, for example dFlow |
| Redirect URI | {your-dflow-dashboard-url}/api/webhook/providers/gitlab |
| Confidential | Enabled (default). dFlow stores the client secret securely. |
| Scopes | Enable all of: api, read_user, read_repository |
| Trusted | Enable when available (skips repeated consent on each login) |
Redirect URI examples
- dFlow Cloud staging or production: use your public dashboard URL (same host as
NEXT_PUBLIC_WEBHOOK_URLwhen set). - Local development: your ngrok or tunnel URL, for example
https://abc123.ngrok-free.app/api/webhook/providers/gitlab.
Why each scope matters
| Scope | Required for |
|---|---|
api | List repositories, register push webhooks, post commit deploy status |
read_user | Identify the connected GitLab account in dFlow |
read_repository | Clone private repositories during deploy |
If api or read_repository is missing, OAuth may appear to succeed but repo pickers, webhooks, or deploys will fail with permission errors.
After you save the application, GitLab shows:
- Application ID → paste into dFlow as OAuth application ID
- Secret → paste into dFlow as OAuth application secret (shown once; copy it immediately)
Connect from dFlow
- In the connect dialog, select Self-hosted GitLab.
- Follow the in-dialog setup guide (redirect URI, scopes, and field names).
- Enter your instance URL (for example
https://git.example.com). - Click Test connection to verify dFlow can reach
GET /api/v4/version. - Paste the Application ID and Secret.
- Click Connect GitLab and complete authorization on your instance.
Self-hosted connections store your OAuth credentials encrypted so token refresh continues to work after the initial connect.
HTTPS and network access: Production dFlow requires HTTPS instance URLs. Your GitLab instance must be reachable from the dFlow dashboard for OAuth and API calls. GitLab must be able to reach your dFlow URL for OAuth callbacks and push webhooks (
/api/deploy/gitlab).
4. Use GitLab on an App Service (connected account)
- Open the Application, choose the Environment, then add or edit an App Service.
- Open the GitLab tab and choose Connected GitLab account.
- Select your account, repository, and branch.
- Save the Service. dFlow registers a project webhook for push events on that branch.
- Push a commit to the connected branch to trigger a deployment, or deploy manually from the dashboard.
Deployment settings
For connected GitLab services, open Service Settings to configure:
- Auto Deploy: deploy automatically when new commits are pushed.
- Require Approval Before Deploy: create a pending deployment that must be approved before building.
Commit status badges on GitLab update during the deploy lifecycle (queued, building, success, or failed).
Self-hosted GitLab works the same as gitlab.com after connect: connected-account pickers, automatic webhook registration on save, and the same deployment settings.
Manual deployment (public URL or PAT)
Use this when you are not using a connected OAuth account:
- Add or edit an App Service and open the GitLab tab.
- Choose Manual deployment.
- Enter the repository URL, branch, and optional Git Token for private repos.
- Deploy or Redeploy when you are ready to build.
To create a PAT: GitLab → Edit profile → Access Tokens. Use at least read_repository for private clone-only deploys.
Permission and access errors
| Symptom | What to check |
|---|---|
| Repository missing in picker | OAuth scopes may be incomplete; reconnect and confirm api and read_repository on the GitLab application. |
| Clone or build fails with permission denied | Token or OAuth authorization expired; reconnect from Integrations. |
| Push does not trigger deploy | Auto Deploy may be off, branch mismatch, or webhook delivery failed; see Integration troubleshooting. |
| Self-hosted connect fails | Test connection errors often mean wrong URL, TLS, or firewall rules; confirm redirect URI matches the dashboard host exactly. |