-
Notifications
You must be signed in to change notification settings - Fork 5.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Anni/wcicd #16642
Anni/wcicd #16642
Changes from 51 commits
18736b2
29cb3a7
ee5eb0e
d08eeb8
ba3c060
0f81ccb
c7a2d30
2c60e9d
85c2cbc
032e966
5978781
6b5d23f
c37c2d7
6c273b5
a42186a
019ff16
4938c6b
1ca9a27
bd9ca0d
3934fa9
cf4dd78
3bf7a8e
cb01b51
60fb91d
9a733c4
95b3193
e0a20b3
ab2f1c3
e1561b8
518372a
e4bf4f5
ad72ec4
e1c0774
f8fd013
46326c9
a154fc6
b88b9d4
0028f50
12b1c4a
e071fdb
68e90ab
d513628
8b063cc
1f931e9
93d4e64
bbd1d45
6314b3d
b8c991e
f352b67
2a9515e
4b149ff
b599c70
a21f4c8
88dbeeb
f7623f3
9d34011
2479f75
c69950f
c2837fd
03f5390
1bb08c3
2501833
a8d6af8
7a848cd
b2c7064
baf4640
b0d345e
dd2ca78
c61ae40
a6ee00c
ad6c3ba
e5a0295
94bff1b
9a1a188
e9ce294
21a3617
47945ac
10f94fb
779a780
9db5306
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
on: | ||
pull_request: | ||
branches: | ||
push: | ||
branches-ignore: | ||
- production | ||
|
||
concurrency: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
pcx_content_type: reference | ||
title: Advanced Setups | ||
description: Learn how to use Workers Builds with more advanced setups | ||
sidebar: | ||
order: 5 | ||
--- | ||
|
||
## Monorepos | ||
While the Workers Builds beta has limited support for monorepos, it is still possible to set up a monorepo workflow. In the 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. | ||
|
||
### Example | ||
|
||
In the example `ecommerce-monorepo`, a Workers project should be created for `product-service`, `auth-service`, `order-service`, and `notification-service`. | ||
|
||
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. | ||
aninibread marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
``` | ||
ecommerce-monorepo/ | ||
│ | ||
├── workers/ | ||
│ ├── product-service/ | ||
│ │ ├── src/ | ||
│ │ └── wrangler.toml | ||
│ ├── auth-service/ | ||
│ │ ├── src/ | ||
│ │ └── wrangler.toml | ||
│ ├── order-service/ | ||
│ │ ├── src/ | ||
│ │ └── wrangler.toml | ||
│ └── notification-service/ | ||
│ ├── src/ | ||
│ └── wrangler.toml | ||
├── shared/ | ||
│ └── utils/ | ||
└── README.md | ||
``` | ||
|
||
## Wrangler environments | ||
If you are using [Wrangler Environments](/workers/wrangler/environments/), you can choose to continue using with Workers Builds with a bit of set up: | ||
|
||
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. | ||
2. Find the Workers for your environments. They are typically named `[name of Worker] - [environment name]`. | ||
3. Connect your repository to each of the Workers for your environment. | ||
4. In each of the Workers, edit your Wrangler deploy command to include the flag `--env: <environment name>` in the build configurations. | ||
|
||
When a new commit is detected in the repository, a new build/deploy will trigger for each associated Worker. | ||
|
||
### Example | ||
|
||
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`. | ||
|
||
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. | ||
|
||
```mermaid | ||
graph TD | ||
A[Git Repo for my-worker] --> |Connect| B[my-worker-staging] | ||
A --> |Connect| C[my-worker-production] | ||
|
||
subgraph Cloudflare Dashboard | ||
B | ||
C | ||
end | ||
``` |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,33 @@ | ||||||
--- | ||||||
pcx_content_type: configuration | ||||||
title: Build Configuration | ||||||
aninibread marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
description: Understand the different settings associated with your build. | ||||||
sidebar: | ||||||
order: 2 | ||||||
--- | ||||||
|
||||||
When connecting your repository, you can configure how to build and deploy your Worker. | ||||||
|
||||||
## Build Settings | ||||||
|
||||||
Build settings can be found by navigating to **Settings** > **Build** within your Worker. The following configurations are available: | ||||||
|
||||||
| Setting | Description | | ||||||
| -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||||||
| **Git account** | Select the git account you would like to use. After initial connection,, you can continue to use this git account for future projects. | | ||||||
aninibread marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| **Git repository** | Choose the git repository you would like to connect your Worker to. | | ||||||
| **Git branch** | Select the branch you would like Cloudflare to listen to for new commits. This will be defaulted to `main`. | | ||||||
| **Build command** _(Optional)_ | Set a build command if your project requires a build step. This is necessary, for example, is using a front-end framework (e.g. Astro, Remix). | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Issues:
Fix Explanation: The original sentence uses 'e.g.' which is against the style guide recommendation. Replacing 'e.g.' with 'for example' improves clarity. Additionally, rephrasing the sentence to 'when using a front-end framework such as Astro or Remix' enhances readability and aligns with the style guide's preference for full English phrases. The change is recommended to adhere to the style guide and improve the documentation's clarity. |
||||||
| **Deploy command** | The deploy command lets you set the **specific** Wrangler command to deploy your Worker. Your deploy command will default to `npx wrangler deploy` but you may customize this command if for example you want to create a [version](/workers/configuration/versions-and-deployments/gradual-deployments/) of your Worker or just run `npm run deploy`. Workers Builds will use the Wrangler version set in your `package json`. | | ||||||
| **Root directory** _(Optional)_ | Specify the root directory of your repository. The root directory describes where the build command will be run. | | ||||||
| **API token** _(Optional)_ | By default, Cloudflare will automatically generate an API token for your account when using Workers Builds for the first time. Workers Builds will continue to use this API token for all subsequent projects and builds. You can also generate and use new API tokens if you choose. These API tokens will be created with the following permissions for your account: | | ||||||
aninibread marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| **Build variables and secrets** _(Optional)_ | Add environment variables and secrets accessible only to your build. Build variables will not be accessible at runtime. If you would like to configure runtime variables you can do so in **Setting**s > **Variables & Secrets** | | ||||||
|
||||||
:::note[API Token Permissions] | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this just be part of the description in the table? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I feel like it's too long to put in the table |
||||||
The Workers Builds API token will be created automatically with the following permissions: | ||||||
aninibread marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
- **Account:** Account Settings (read), Workers Scripts (edit), Workers KV Storage (edit), Workers R2 Storage (edit) | ||||||
- **Zone:** Workers Routes (edit) for all zones on the account | ||||||
- **User:** User Details (read), Memberships (read) | ||||||
::: | ||||||
|
||||||
Please note, any updates to your build settings will be applied on the next build once saved. | ||||||
aninibread marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,66 @@ | ||||||
--- | ||||||
pcx_content_type: reference | ||||||
title: Build Image | ||||||
description: Understand the build image used in Workers Builds. | ||||||
sidebar: | ||||||
order: 3 | ||||||
--- | ||||||
|
||||||
Workers Builds uses a build image with support for a variety of languages and tools such as Node.js, Python, PHP, Ruby, and Go. | ||||||
|
||||||
## Supported Languages and Tools | ||||||
|
||||||
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): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
^ simpler language, suggest applying to all places where we start with "In the following table" |
||||||
|
||||||
| Tool | Default version | Environment variable | File | | ||||||
| ----------- | ---------------- | -------------------- | ---------------------------- | | ||||||
| **Go** | 1.22.0 | `GO_VERSION` | | | ||||||
aninibread marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
| **Node.js** | 22 | `NODE_VERSION` | .nvmrc, .node-version | | ||||||
| **Python** | 3.12.5 | `PYTHON_VERSION` | .python-version, runtime.txt | | ||||||
| **Ruby** | 3.3.4 | `RUBY_VERSION` | .ruby-version | | ||||||
| **Bun** | 1.1.22 | `BUN_VERSION` | | | ||||||
| **Hugo** | extended_0.130.0 | `HUGO_VERSION` | | | ||||||
|
||||||
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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dupe |
||||||
|
||||||
### Overriding Default Versions | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
We should be consistent — either call these |
||||||
|
||||||
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/build-configuration/#build-settings), or set the relevant file in your source code as shown above. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We already say this above, and I think this is linking to itself right now? |
||||||
|
||||||
To set the version using a build environment variables, you can: | ||||||
|
||||||
1. Find the environment variable name for the language or tool and desired version (e.g. `NODE_VERSION = 22`) | ||||||
2. Add and save the environment variable on the dashboard by going to **Settings** > **Build** > **Build Variables and Secrets* in your Workers project | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is another instance where the reader will (rightly) ask — can I set these in my own codebase? In Terraform? etc. When something isn't yet supported, a ton of the value that docs can provide can be to just be explicit and clear about it upfront, so that someone doesn't have to chase this down themselves. Turn frustration into simple feature request, etc. |
||||||
|
||||||
Or, to set the version by adding a file to your project, you can: | ||||||
|
||||||
1. Find the filename for the language or tool (e.g. `.nvmrc`) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Issues:
Fix Explanation: The use of 'e.g.' can be less clear to some readers, especially those who may not be familiar with Latin abbreviations. Replacing it with 'for example' improves clarity and aligns with common style guide recommendations. The sentence structure remains clear and informative, so a complete rewrite isn't necessary. |
||||||
2. Add the specified file name to the root directory and add the desired version number as the contents of the file (e.g. 22) | ||||||
aninibread marked this conversation as resolved.
Show resolved
Hide resolved
aninibread marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
## Pre-installed Packages | ||||||
|
||||||
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. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there anything important to say here about versions? |
||||||
|
||||||
| | | | | ||||||
| ----------------- | ----------------- | ----------------- | | ||||||
| `curl` | `libbz2-dev` | `libreadline-dev` | | ||||||
| `git` | `libc++1` | `libssl-dev` | | ||||||
| `git-lfs` | `libdb-dev` | `libvips-dev` | | ||||||
| `unzip` | `libgdbm-dev` | `libyaml-dev` | | ||||||
| `autoconf` | `libgdbm6` | `tzdata` | | ||||||
| `build-essential` | `libgbm1` | `wget` | | ||||||
| `bzip2` | `libgmp-dev` | `zlib1g-dev` | | ||||||
| `gnupg` | `liblzma-dev` | `zstd` | | ||||||
| `libffi-dev` | `libncurses5-dev` | | | ||||||
|
||||||
|
||||||
## Build Environment | ||||||
|
||||||
Workers Builds are run in the following environment: | ||||||
|
||||||
| | | | ||||||
| --------------------- | ------------ | | ||||||
| **Build Environment** | Ubuntu 24.04 | | ||||||
| **Architecture** | x86_64 | |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,25 @@ | ||||||
--- | ||||||
pcx_content_type: concept | ||||||
title: Builds | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is still confusing. If we are calling the system, "Workers Builds" it is too generic to call this section just "Builds". We need to be super clear here that the section currently called "Builds" is where to learn more about the built-in system that is native to the platform. I'm open to ideas about how we get there. Ex — this section is now super clear about this: How can we carry this through to the nav? I know tricky to get right but worth fighting for. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
...or something? |
||||||
description: Use Workers Builds to integrate with Git and automatically build and deploy your Worker when you merge a pull request | ||||||
sidebar: | ||||||
badge: | ||||||
text: Beta | ||||||
--- | ||||||
|
||||||
Workers Builds allows you to connect an existing Worker to a GitHub or GitLab repository to set up automatic builds and deployments for your development workflow. | ||||||
|
||||||
## Get Started | ||||||
|
||||||
To set up your Git integration with Workers: | ||||||
|
||||||
1. **Select your Worker** in the dashboard and navigate to Settings > Build | ||||||
2. **Select the Git provider** you'd like to connect to by clicking "Connect". Follow the prompts to install the Cloudflare application on your git account. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
3. **Configure your build settings** by selecting your desired git repository, branch, and configuring a deploy command and optionally a build command. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like https://anni-wcicd.cloudflare-docs-7ou.pages.dev/workers/ci-cd/builds/build-configuration/ |
||||||
4. **Push a commit** to your repository to trigger your first build and deploy. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing in Terraform? Not part of OpenAPI spec? Seems like a thing we should be explicit about somewhere in docs, not necessarily this page |
||||||
|
||||||
|
||||||
## View Build Details | ||||||
|
||||||
Once a build is in progress, you can monitor its build logs and view build history by navigating to **"View build history"** on the deployments tab of your Worker. If successful, you can also view the build details for each new [version](https://developers.cloudflare.com/workers/configuration/versions-and-deployments/) created. ## Build Limits | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Issues:
Fix Explanation: The change involves replacing the full URL with a relative link to comply with the style guide. This ensures that the documentation remains consistent and links are less likely to break if the base URL changes. The rest of the sentence is clear and does not require any additional modifications.
aninibread marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,29 @@ | ||||||
--- | ||||||
pcx_content_type: concept | ||||||
title: Limits & Pricing | ||||||
description: Limits & pricing for Workers Builds | ||||||
sidebar: | ||||||
order: 4 | ||||||
--- | ||||||
|
||||||
## Limits | ||||||
|
||||||
While in open beta, the following limits are applicable for Workers Builds. Please note, these are subject to change while in beta. | ||||||
|
||||||
| Metric | Description | Limit | | ||||||
| --------------------- | ---------------------------------------------------------------------- | --------- | | ||||||
| **Build Minutes** | The amount of minutes that it takes to build a project. | Unlimited | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
(or something) This isn't about building a specific project, current description ambiguous There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would also suggest removing period for consistency |
||||||
| **Concurrent Builds** | Number of builds that run in parallel across an account. | 1 | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
specific about "Cloudflare account"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would also suggest removing period for consistency |
||||||
| **Build Timeout** | The amount of minutes that a build can be run before it is terminated. | 20 mins | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would also suggest removing period for consistency |
||||||
| **CPU** | Number of CPU cores available to your build | 2 CPUs | | ||||||
| **Memory** | Amount of memory available to the build. | 8GB | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| **Disk space** | Disk space available to your build | 8GB | | ||||||
|
||||||
## Future Pricing | ||||||
|
||||||
During the beta, Workers Builds will be free to try with the limits stated above. In the future, once Workers Builds becomes generally available, you can expect the following updates to the limits and pricing structure. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
| Metric | Workers Free | Paid | Enterprise | | ||||||
| --------------------- | ------------- | ---------------------------- | ---------- | | ||||||
| **Build Minutes** | 3,000 minutes | 6,000 minutes, +$0.005 / min | Custom | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
| **Concurrent Builds** | 1 | 6 | Custom | |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
pcx_content_type: troubleshooting | ||
title: Troubleshooting | ||
description: Learn about troubleshooting and known issues in Workers Builds. | ||
sidebar: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typically, we recommend the beta tag just on the Overview section (instead of every other page). But up to you on the final decision there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 |
||
order: 6 | ||
--- | ||
|
||
Workers Builds provides build logs for every build started. You can view build logs by navigating to your **Worker project** > **Deployments** > **View Build History** > **View Build**. While Workers Builds is in Open Beta, the following issues and limitations may apply: | ||
|
||
- **Worker Name:** The Worker name in your Cloudflare dashboard and the Worker name written in the associated `wrangler.toml` must be the same. If they do not match, the deploy will fail, and you must update either the file or dashboard. | ||
- **Updating API Tokens:** If you have updated or deleted an API Token, the changes may not be reflected in the Build Configuration settings on the dashboard. If you are encountering authentication errors after updating your build's API Token, we recommend creating a new API Token for the build. | ||
- **Failed Builds stuck in In-Progress:** If your build has failed but the status still show that the build is "In-progress", you should cancel the build, review your build configuration, then retry the build. | ||
|
||
|
||
If you discover additional issues or would like to provide feedback, please notify us in the [Discord](https://discord.com/channels/595317990191398933/1052656806058528849). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not clear to me when I read this page what is limited, versus Pages' support for monorepos? Is the "limited" statement a comparative statement about this versus Pages, or a general "our monorepos support could maybe be more extensive" statement?