You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- You can now connect your GitHub or GitLab repository to an existing Worker to automatically build and deploy your changes when you make a git push with [Workers Builds](/workers/ci-cd/builds/).
8
11
- publish_date: "2024-09-19"
9
12
description: |-
10
13
- Revamped Workers and Pages UI settings to simplify the creation and management of project configurations. For bugs and general feedback, please submit this [form](https://forms.gle/XXqhRGbZmuzninuN9).
Copy file name to clipboardExpand all lines: src/content/docs/pages/configuration/build-image.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,14 +51,14 @@ When your build starts, if not already [cached](/pages/configuration/build-cachi
51
51
52
52
To override default versions of languages and tools in the build system, you can either set the desired version through environment variables or by adding files to your project.
53
53
54
-
To set the version using **environment variables**, you can:
54
+
To set the version using environment variables, you can:
55
55
56
56
1. Find the environment variable name for the language or tool in [this table](/pages/configuration/build-image/#supported-languages-and-tools).
57
57
2. Add the environment variable on the dashboard by going to **Settings** > **Environmnet variables** in your Pages project, or [add the environment variable via Wrangler](/workers/configuration/environment-variables/#add-environment-variables-via-wrangler).
58
58
59
-
Or, to set the version by **adding a file** to your project, you can:
59
+
Or, to set the version by adding a file to your project, you can:
60
60
61
-
1. Find the environment variable name for the language or tool in [this table](/pages/configuration/build-image/#supported-languages-and-tools).
61
+
1. Find the file name for the language or tool in [this table](/pages/configuration/build-image/#supported-languages-and-tools).
62
62
2. Add the specified file name to the root directory of your project, and add the desired version number as the contents of the file.
63
63
64
64
For example, if you were previously relying on the default version of Node.js in the v1 build system, to migrate to v2, you must specify that you need Node.js `12.18.0` by setting a `NODE_VERSION = 12.18.0` environment variable or by adding a `.node-version` or `.nvmrc` file to your project with `12.18.0` added as the contents to the file.
Copy file name to clipboardExpand all lines: src/content/docs/pages/configuration/git-integration.mdx
+21-18Lines changed: 21 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,19 +1,22 @@
1
1
---
2
2
pcx_content_type: concept
3
3
title: Git integration
4
-
5
4
---
6
5
7
6
Cloudflare supports connecting Cloudflare Pages to your GitHub and GitLab repositories to look for new changes to your project. Pages does not currently support self-hosted instances of GitHub or GitLab.
8
7
9
8
## Custom branches
10
9
11
-
Suppose you have a custom Git workflow that uses specific branches to represent your project's production build. In that case, you can specify a custom branch when creating (or managing an existing) project in the Pages dashboard by going to **Settings** > **Builds & deployments**and clicking the **Configure Production deployments** button. You can change the production branch to any other branch in the dropdown menu under **production branch**.
10
+
Suppose you have a custom Git workflow that uses specific branches to represent your project's production build. In that case, you can specify a custom branch when creating (or managing an existing) project in the Pages dashboard by going to **Settings** > **Builds & deployments**> **Configure Production deployments**. To change the production branch, click the **production branch**dropdown menu and choose any other branch.
12
11
13
12
You can also use [preview deployments](/pages/configuration/preview-deployments/) to preview how the new version of your project looks before merging into `production`. In addition, Pages allows you to configure which of your preview branches are built and deployed by using [branch build controls](/pages/configuration/branch-build-controls/).
14
13
15
14
To configure this in your Pages project go to **Settings** > **Builds & deployments** > **Configure preview deployment** and select **Custom branches**. Here you can specify branches you wish to include and exclude from automatic deployments in the provided configuration fields. To learn more refer to the [branch build controls](/pages/configuration/branch-build-controls/) documentation.
16
15
16
+
## Skipping a specific build via a commit message
17
+
18
+
Without any configuration required, you can choose to skip a deployment on an adhoc basis. By adding the `[CI Skip]`, `[CI-Skip]`, `[Skip CI]`, `[Skip-CI]`, or `[CF-Pages-Skip]` flag as a prefix in your commit message, and Pages will omit that deployment. The prefixes are not case sensitive.
19
+
17
20
## Organizational access
18
21
19
22
You can deploy projects to Cloudflare Pages from your open-source team, company, or side project on both GitHub and GitLab.
@@ -24,27 +27,27 @@ When authorizing Cloudflare Pages to access a GitHub account, you can specify ac
24
27
25
28
:::caution[GitHub security consideration]
26
29
27
-
28
30
A GitHub account should only point to one Cloudflare account, however, this is not enforced. If you are setting up Cloudflare with GitHub for your organization, Cloudflare recommends that you limit the scope of the application to only the repositories you intend to build with Pages at the time that you set up your project. You can modify these permissions as you build more applications.
29
31
30
-
31
32
:::
32
33
33
34
### GitLab
34
35
35
36
By authorizing Cloudflare Pages to access your GitLab account, you will automatically allow access to organizations, groups, and namespaces your GitLab account can access for use by Cloudflare Pages. Managing access to these organizations and groups is handled by GitLab.
36
37
37
-
## Removing access to your GitHub account
38
+
## Removing access
38
39
39
-
You can remove Cloudflare Pages' access to your GitHub account by viewing the [**Applications** page](https://github.com/settings/installations) on GitHub. Note that removing access to GitHub will also disable new builds, though the last build of your site will continue to be hosted via Cloudflare Pages.
40
+
### GitHub
40
41
41
-
## Removing access to your GitLab account
42
+
You can remove Cloudflare Pages' access to your GitHub account by viewing the [**Applications** page](https://github.com/settings/installations) on GitHub. The GitHub App is named Cloudflare Workers and Pages, and it is shared between Workers and Pages projects.
42
43
43
-
You can remove Cloudflare Pages' access to your GitLab account by navigating to **User Settings** > **Applications** > **Authorized Applications**. Find the applications called Cloudflare Pages and select the **Revoke** button to revoke access.
44
+
Note that removing access to GitHub will disable new builds for Workers and Pages, though the last build of your site will continue to be hosted via Cloudflare Pages.
44
45
45
-
##Skipping a specific build via a commit message
46
+
### GitLab
46
47
47
-
Without any configuration required, you can choose to skip a deployment on an adhoc basis. By adding the `[CI Skip]`, `[CI-Skip]`, `[Skip CI]`, `[Skip-CI]` or `[CF-Pages-Skip]` flag as a prefix in your commit message, and Pages will omit that deployment. The prefixes are case insensitive.
48
+
You can remove Cloudflare Pages' access to your GitLab account by navigating to **User Settings** > **Applications** > **Authorized Applications**. Find the applications called Cloudflare Pages and select the **Revoke** button to revoke access.
49
+
50
+
Note that the GitLab application Cloudflare Pages is shared between Workers and Pages projects, and removing access to GitLab will disable new builds for Workers and Pages, though the last build of your site will continue to be hosted via Cloudflare Pages.
48
51
49
52
## Reinstall a Git installation
50
53
@@ -55,7 +58,7 @@ When encountering Git integration related issues, one potential troubleshooting
55
58
1. Go to the installation settings page on GitHub:
56
59
1.`https://github.com/settings/installations` for individual accounts.
57
60
2.`https://github.com/organizations/<YOUR_ORGANIZATION_NAME>/settings/installations` for organizational accounts.
58
-
2. If the Cloudflare Pages installation is there, click **Configure**, and click **Uninstall "Cloudflare Pages"** (if there is no "Cloudflare Pages" installation, the user doesn't need to do anything)
61
+
2. If the Cloudflare Workers and Pages installation is there, click **Configure**, and click **Uninstall "Cloudflare Workers and Pages"**. If there is no "Cloudflare Workers and Pages" installation there, then you don't need to do anything.
59
62
3. Go back to the **Workers & Pages** overview page at `https://dash.cloudflare.com/[YOUR_ACCOUNT_ID]/workers-and-pages`. Click **Create application** > **Pages** > **Connect to Git**
60
63
4. Click the **+ Add account** button, click the GitHub account you want to add, and then click **Install & Authorize**.
61
64
5. You should be redirected to the create project page with your GitHub account or organization in the account list.
@@ -67,7 +70,7 @@ When encountering Git integration related issues, one potential troubleshooting
67
70
2. Click the "Revoke" button on your Cloudflare Pages installation if it exists.
68
71
3. Go back to the **Workers & Pages** overview page at `https://dash.cloudflare.com/[YOUR_ACCOUNT_ID]/workers-and-pages`. Click **Create application** > **Pages** > **Connect to Git**
69
72
4. Select the **GitLab** tab at the top, click the **+ Add account** button, click the GitLab account you want to add, and then click **Authorize** on the modal titled "Authorize Cloudflare Pages to use your account?".
70
-
5. You should be redirected to the create project page with your GitHub account or organization in the account list.
73
+
5. You will be redirected to the create project page with your GitLab account or organization in the account list.
71
74
6. Attempt to make a new deployment with your project which was previously broken.
72
75
73
76
## Troubleshooting
@@ -98,8 +101,8 @@ To resolve this issue, follow the steps provided above in the [Reinstalling a Gi
98
101
99
102
Go to your GitHub installation settings:
100
103
101
-
*`https://github.com/settings/installations` for individual accounts
102
-
*`https://github.com/organizations/<YOUR_ORGANIZATION_NAME>/settings/installations` for organizational accounts
104
+
-`https://github.com/settings/installations` for individual accounts
105
+
-`https://github.com/organizations/<YOUR_ORGANIZATION_NAME>/settings/installations` for organizational accounts
103
106
104
107
Click **Configure** on the Cloudflare Pages application. Scroll down to the bottom of the page and click **Unsuspend** to allow Cloudflare Pages to make future deployments.
105
108
@@ -109,10 +112,10 @@ You may have deleted or transferred the repository associated with this Cloudfla
109
112
110
113
#### `The repository cannot be accessed, this may cause deployments to fail.`
111
114
112
-
You may have excluded this repository from your installation's repository access settings. Go to your GitHub installation settings:
115
+
You may have excluded this repository from your installation's repository access settings. Go to your GitHub installation settings:
113
116
114
-
*`https://github.com/settings/installations` for individual accounts
115
-
*`https://github.com/organizations/<YOUR_ORGANIZATION_NAME>/settings/installations` for organizational accounts
117
+
-`https://github.com/settings/installations` for individual accounts
118
+
-`https://github.com/organizations/<YOUR_ORGANIZATION_NAME>/settings/installations` for organizational accounts
116
119
117
120
Click **Configure** on the Cloudflare Pages application. Under **Repository access**, ensure that the repository associated with your Cloudflare Pages project is included in the list.
118
121
@@ -122,4 +125,4 @@ This is an internal error in the Cloudflare Pages SCM system. You can attempt to
122
125
123
126
## Related resources
124
127
125
-
*[Branch build controls](/pages/configuration/branch-build-controls/#production-branch-control) - Control which environments and branches you would like to automatically deploy to.
128
+
-[Branch build controls](/pages/configuration/branch-build-controls/#production-branch-control) - Control which environments and branches you would like to automatically deploy to.
description: Learn how to use Workers Builds with more advanced setups
5
+
sidebar:
6
+
order: 5
7
+
---
8
+
9
+
## Monorepos
10
+
11
+
While the Workers Builds beta has limited support for monorepos, it is still possible to set up a monorepo workflow. In the Cloudflare Dashboard, you must connect your monorepo to each of the existing Worker projects. When a new commit is detected in the monorepo, a new build/deploy will trigger for each Worker.
12
+
13
+
### Example
14
+
15
+
In the example `ecommerce-monorepo`, a Workers project should be created for `product-service`, `auth-service`, `order-service`, and `notification-service`.
16
+
17
+
A git connection to `ecommerce-monorepo` should be added in all of the Workers projects. If you are using a monorepo tool (e.g. [Turborepo](https://turbo.build/)), you can configure a different deploy command for each Worker (e.g. `turbo deploy -F product-service`). When a new commit is made to `ecommerce-monorepo`, a build and deploy will be triggered for each of the Workers (i.e. `product-service`, `auth-service`, `order-service`, `notification-service`) and respect the configured commands for that Worker.
18
+
19
+
```
20
+
ecommerce-monorepo/
21
+
│
22
+
├── workers/
23
+
│ ├── product-service/
24
+
│ │ ├── src/
25
+
│ │ └── wrangler.toml
26
+
│ ├── auth-service/
27
+
│ │ ├── src/
28
+
│ │ └── wrangler.toml
29
+
│ ├── order-service/
30
+
│ │ ├── src/
31
+
│ │ └── wrangler.toml
32
+
│ └── notification-service/
33
+
│ ├── src/
34
+
│ └── wrangler.toml
35
+
├── shared/
36
+
│ └── utils/
37
+
└── README.md
38
+
```
39
+
40
+
## Wrangler environments
41
+
42
+
If you are using [Wrangler Environments](/workers/wrangler/environments/), you can choose to continue using with Workers Builds with a bit of set up:
43
+
44
+
1.[Deploy via Wrangler](/workers/wrangler/commands/#deploy) to create the Workers for your environments in the Dashboard, if you don't already have them.
45
+
2. Find the Workers for your environments. They are typically named `[name of Worker] - [environment name]`.
46
+
3. Connect your repository to each of the Workers for your environment.
47
+
4. In each of the Workers, edit your Wrangler deploy command to include the flag `--env: <environment name>` in the build configurations.
48
+
49
+
When a new commit is detected in the repository, a new build/deploy will trigger for each associated Worker.
50
+
51
+
### Example
52
+
53
+
Imagine you have a Worker named `my-worker`, and you want to set up two environments `staging` and `production` set in the `wrangler.toml`. If you haven't already, you can deploy `my-worker` for each environment using the commands `wrangler deploy --env staging` and `wrangler deploy --env production`.
54
+
55
+
In your Cloudflare Dashboard, you should find two Workers `my-worker-staging` and `my-worker-production`. A git connection to a `my-worker` git repository should be added to both of the environment Workers. In the build configurations of each environment Worker, edit the deploy commands to be `npx wrangler deploy --env staging` and `npx wrangler deploy --env production` respectively.
56
+
57
+
```mermaid
58
+
graph TD
59
+
A[Git Repo for my-worker] --> |Connect| B[my-worker-staging]
description: Understand the build image used in Workers Builds.
5
+
sidebar:
6
+
order: 4
7
+
---
8
+
9
+
Workers Builds uses a build image with support for a variety of languages and tools such as Node.js, Python, PHP, Ruby, and Go.
10
+
11
+
## Supported Languages and Tools
12
+
13
+
In the following table, review the preinstalled versions for languages and tools included in the Cloudflare Workers' build image, and the environment variables and/or files available for [overriding the preinstalled version](/workers/ci-cd/builds/build-image/#overriding-default-versions):
The default versions will be updated regularly to the latest minor version. No major version updates will be made without notice. If you need a specific minor version, please specify it by overriding the default version.
25
+
26
+
### Overriding Default Versions
27
+
28
+
If you need to override a [specific version](/workers/ci-cd/builds/build-image/#overriding-default-versions) of a language or tool within the image, you can specify it as a [build environment variable](/workers/ci-cd/builds/configuration/#build-settings), or set the relevant file in your source code as shown above.
29
+
30
+
To set the version using a build environment variables, you can:
31
+
32
+
1. Find the environment variable name for the language or tool and desired version (e.g. `NODE_VERSION = 22`)
33
+
2. Add and save the environment variable on the dashboard by going to **Settings** > **Build** > **Build Variables and Secrets** in your Workers project
34
+
35
+
Or, to set the version by adding a file to your project, you can:
36
+
37
+
1. Find the filename for the language or tool (e.g. `.nvmrc`)
38
+
2. Add the specified file name to the root directory and set the desired version number as the file's content. For example, if the version number is 22, the file should contain '22'.
39
+
40
+
## Pre-installed Packages
41
+
42
+
In the following table, review the pre-installed packages in the build image. The packages are installed with `apt`, a package manager for Linux distributions.
0 commit comments