Skip to content

GitLab integration

You can connect each Cloudflare Pages project to a GitLab repository, and Cloudflare will automatically deploy your code every time you push a change to a branch.

Features

Beyond automatic deployments, the Cloudflare GitLab integration lets you monitor, manage, and preview deployments directly in GitLab, keeping you informed without leaving your workflow.

Custom branches

Pages will default to setting your production environment to the branch you first push. If a branch other than the default branch (e.g. main) represents your project's production branch, then go to Settings > Builds > Branch control, change the production branch by clicking the Production branch dropdown menu and choose any other branch.

You can also use preview deployments to preview versions of your project before merging your production branch, and deploying to production. Pages allows you to configure which of your preview branches are automatically deployed using branch build controls. To configure, go to Settings > Builds > Branch control and select an option under Preview branch. Use Custom branches to specify branches you wish to include or exclude from automatic preview deployments.

Skipping a specific build via a commit message

Without any configuration required, you can choose to skip a deployment on an ad hoc basis. By adding the [CI Skip], [CI-Skip], [Skip CI], [Skip-CI], or [CF-Pages-Skip] flag as a prefix in your commit message, Pages will omit that deployment. The prefixes are not case sensitive.

Check runs and preview URLs

If you have one or multiple projects connected to a repository (i.e. a monorepo), you can check on the status of each build within GitLab via GitLab commit status.

You can see the statuses by selecting the status icon next to a commit or by going to Build > Pipelines within your GitLab repository. In the example below, you can select the green check mark to see the results of the check run.

GitLab Status

Check runs will appear like the following in your repository. You can select one of the statuses to view the preview URL for that deployment.

GitLab Commit Status

If a build skips for any reason (i.e. CI Skip, build watch paths, or branch deployment controls), the check run/commit status will not appear.

Manage access

You can deploy projects to Cloudflare Workers from your company or side project on GitLab using the Cloudflare Pages app.

Organizational access

You can deploy projects to Cloudflare Pages from your company or side project on both GitHub and GitLab.

When you authorize Cloudflare Pages to access your GitLab account, you automatically give Cloudflare Pages access to organizations, groups, and namespaces accessed by your GitLab account. Managing access to these organizations and groups is handled by GitLab.

Remove access

You can remove Cloudflare Workers' access to your GitLab account by navigating to Authorized Applications page on GitLab. Find the applications called Cloudflare Workers and select the Revoke button to revoke access.

Note that the GitLab application Cloudflare Workers is shared between Workers and Pages projects, and removing access to GitLab will disable new builds for Workers and Pages, though your previous deployments will continue to be hosted by Cloudflare Pages.

Reinstall the Cloudflare GitLab app

When encountering Git integration related issues, one potential troubleshooting step is attempting to uninstall and reinstall the GitHub or GitLab application associated with the Cloudflare Pages installation.

  1. Go to your application settings page on GitLab located here: https://gitlab.com/-/profile/applications
  2. Select the Revoke button on your Cloudflare Pages installation if it exists.
  3. Go back to the Workers & Pages overview page at https://dash.cloudflare.com/[YOUR_ACCOUNT_ID]/workers-and-pages. Select Create application > Pages > Connect to Git.
  4. Select the GitLab tab at the top, select the + Add account button, select the GitLab account you want to add, and then select Authorize on the modal titled "Authorize Cloudflare Pages to use your account?".
  5. You will be redirected to the create project page with your GitLab account or organization in the account list.
  6. Attempt to make a new deployment with your project which was previously broken.