-
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 all 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 |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--- | ||
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 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. | ||
|
||
### 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. | ||
|
||
``` | ||
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,63 @@ | ||||||
--- | ||||||
pcx_content_type: reference | ||||||
title: Build Image | ||||||
description: Understand the build image used in Workers Builds. | ||||||
sidebar: | ||||||
order: 4 | ||||||
--- | ||||||
|
||||||
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): | ||||||
|
||||||
| Tool | Default version | Environment variable | File | | ||||||
| ----------- | ---------------- | -------------------- | ---------------------------- | | ||||||
| **Go** | 1.23.0 | `GO_VERSION` | | | ||||||
| **Node.js** | 22 | `NODE_VERSION` | .nvmrc, .node-version | | ||||||
| **Python** | 3.12.5 | `PYTHON_VERSION` | .python-version, runtime.txt | | ||||||
| **Ruby** | 3.3.5 | `RUBY_VERSION` | .ruby-version | | ||||||
| **Bun** | 1.1.28 | `BUN_VERSION` | | | ||||||
| **Hugo** | extended_0.134.3 | `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. 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/configuration/#build-settings), or set the relevant file in your source code as shown above. | ||||||
|
||||||
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 | ||||||
|
||||||
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 set the desired version number as the file's content. For example, if the version number is 22, the file should contain '22'. | ||||||
|
||||||
## 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 | |
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.
^ simpler language, suggest applying to all places where we start with "In the following table"