Skip to content

GitLab integration

Cloudflare supports connecting your GitLab repository to your Cloudflare Worker, and will automatically deploy your code every time you push a change.

Features

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

Merge request comment

If a commit is on a merge request, Cloudflare will automatically post a comment on the merge request with the status of the build.

GitLab merge request comment

A Preview URL will be provided for builds which perform wrangler preview. This is useful when reviewing your merge request, as it lets you test the code changes in an isolated copy of your Worker.

Subsequent pushes to the same branch update the same Preview URL. Each deployment also gets an immutable Deployment URL for testing one exact deployment.

The comment lists URLs for every host enabled for Previews on your Worker. This can be a custom domain, workers.dev, or both. A custom domain alone is enough.

If the comment shows No Preview URL for a successful build, refer to Troubleshooting.

Commit Status

If you have one or multiple Workers connected to a repository (for example, a monorepo), you can check on the status of each build within GitLab via GitLab commit status ↗︎.

You can view the statuses by selecting the status icon next to a commit or by going to Build > Pipelines within your GitLab repository. In the following example, you can select the green check mark to view 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 build on the Cloudflare Dashboard.

GitLab Commit Status

Note that when using build watch paths, only projects that trigger a build will generate a commit status.

Manage access

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

Organizational access

When you authorize Cloudflare Workers to access your GitLab account, you automatically give Cloudflare Workers 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 going to the Authorized Applications page ↗︎ on GitLab. Find the application called Cloudflare Workers (or Cloudflare Pages) and select Revoke to revoke access.

The GitLab application is shared between Workers and Pages projects. Removing access to GitLab disables new builds for both Workers and Pages, though your previous deployments will continue to be hosted by Cloudflare.

Reinstall the Cloudflare GitLab App

  1. Go to your application settings page on GitLab at GitLab Authorized Applications ↗︎.

  2. Select Revoke on your Cloudflare Workers (or Cloudflare Pages) installation if it exists.

  3. In the Cloudflare dashboard, go to the Workers & Pages page.

    Go to Workers & Pages ↗
  4. Select Create application > GitLab.

  5. Select + Add account, choose the GitLab account you want to add, and select Install & Authorize.

  6. You will be redirected to the create project page with your GitLab account or organization in the account list.

  7. Trigger a new deployment for the affected project.

Was this helpful?