Skip to content

Commit 40cec1d

Browse files
Maximo-Guksdnts
authored andcommitted
Documents environment variables present in workers builds (cloudflare#22969)
1 parent c1c311b commit 40cec1d

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/content/docs/pages/configuration/build-configuration.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ The following system environment variables are injected by default (but can be o
5050

5151
| Environment Variable | Injected value | Example use-case |
5252
| --------------------- | ------------------------------------- | --------------------------------------------------------------------------------------- |
53+
| `CI` | `true` | Changing build behaviour when run on CI versus locally |
5354
| `CF_PAGES` | `1` | Changing build behaviour when run on Pages versus locally |
5455
| `CF_PAGES_COMMIT_SHA` | `<sha1-hash-of-current-commit>` | Passing current commit ID to error reporting, for example, Sentry |
5556
| `CF_PAGES_BRANCH` | `<branch-name-of-current-deployment>` | Customizing build based on branch, for example, disabling debug logging on `production` |

src/content/docs/workers/ci-cd/builds/configuration.mdx

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,4 +78,23 @@ It is recommended to consistently use the same API token across all uploads and
7878

7979
[Static assets](/workers/static-assets/) and [frameworks](/workers/framework-guides/) are now supported in Cloudflare Workers. Learn to set up Workers projects and the commands for each framework in the framework guides:
8080

81-
<DirectoryListing folder="workers/framework-guides" maxDepth={4}/>
81+
<DirectoryListing folder="workers/framework-guides" maxDepth={4} />
82+
83+
## Environment variables
84+
85+
You can provide custom environment variables to your build by configuring them in the Cloudflare dashboard:
86+
87+
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select your account.
88+
2. In **Account Home**, select **Workers & Pages**.
89+
3. In **Overview**, select your Worker.
90+
4. Select **Settings** > **Environment variables**.
91+
92+
The following system environment variables are injected by default (but can be overridden):
93+
94+
| Environment Variable | Injected value | Example use-case |
95+
| ----------------------- | ------------------------------- | --------------------------------------------------------------------------------------- |
96+
| `CI` | `true` | Changing build behaviour when run on CI versus locally |
97+
| `WORKERS_CI` | `1` | Changing build behaviour when run on Workers Builds versus locally |
98+
| `WORKERS_CI_BUILD_UUID` | `<build-uuid-of-current-build>` | Passing the Build UUID along to custom workflows |
99+
| `WORKERS_CI_COMMIT_SHA` | `<sha1-hash-of-current-commit>` | Passing current commit ID to error reporting, for example, Sentry |
100+
| `WORKERS_CI_BRANCH` | `<branch-name-from-push-event` | Customizing build based on branch, for example, disabling debug logging on `production` |

0 commit comments

Comments
 (0)