Cloudflare Workers

Cloudflare Workers

Please use Cloudflare Workers v2!

Just marvel at these EOL versions installed by the [still active] v1 Build System (save for Hugo which was being updated via environment variable):

10:54:07.597	Success: Finished cloning repository files
10:54:08.920	Checking for configuration in a Wrangler configuration file (BETA)
10:54:08.921	
10:54:10.092	No wrangler.toml file found. Continuing.
10:54:10.188	Installing dependencies
10:54:10.195	Python version set to 2.7
10:54:11.984	v12.18.0 is already installed.
10:54:12.691	Now using node v12.18.0 (npm v6.14.4)
10:54:12.825	Started restoring cached build plugins
10:54:12.833	Finished restoring cached build plugins
10:54:13.093	Attempting ruby version 2.7.1, read from environment
10:54:14.175	Using /opt/buildhome/.rvm/gems/ruby-2.7.1
10:54:14.809	Using PHP version 5.6
10:54:14.886	5.2.5 is already installed.
10:54:14.898	Using Swift version 5.2.5
10:54:14.898	Installing Hugo 0.145.0
10:54:16.032	hugo v0.145.0-666444f0a52132f9fec9f71cf25b441cc6a4f355+extended linux/amd64 BuildDate=2025-02-26T15:41:25Z VendorInfo=gohugoio
10:54:16.034	Started restoring cached go cache
10:54:16.042	Finished restoring cached go cache
10:54:16.103	go version go1.14.4 linux/amd64
10:54:16.113	go version go1.14.4 linux/amd64
10:54:16.115	Installing missing commands
10:54:16.116	Verify run directory
10:54:16.116	Executing user command: hugo
10:54:16.154	Start building sites … 
10:54:16.154	hugo v0.145.0-666444f0a52132f9fec9f71cf25b441cc6a4f355+extended linux/amd64 BuildDate=2025-02-26T15:41:25Z VendorInfo=gohugoio

As opposed to v2:

11:30:22.443	Using v2 root directory strategy
11:30:22.464	Success: Finished cloning repository files
11:30:23.133	No build output detected to cache. Skipping.
11:30:23.134	No dependencies detected to cache. Skipping.
11:30:24.133	Checking for configuration in a Wrangler configuration file (BETA)
11:30:24.133	
11:30:25.243	No wrangler.toml file found. Continuing.
11:30:26.824	Detected the following tools from environment: golang@1.24.1, hugo@extended_0.145.0
11:30:26.824	Installing golang 1.24.1
11:30:26.934	Platform 'linux' supported!
11:30:27.030	  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
11:30:27.030	                                 Dload  Upload   Total   Spent    Left  Speed
11:30:27.305	
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
 87 74.8M   87 65.8M    0     0   258M      0 --:--:-- --:--:-- --:--:--  258M
100 74.8M  100 74.8M    0     0   271M      0 --:--:-- --:--:-- --:--:--  272M
11:30:27.319	  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
11:30:27.319	                                 Dload  Upload   Total   Spent    Left  Speed
11:30:27.408	
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100    64  100    64    0     0    711      0 --:--:-- --:--:-- --:--:--   719
11:30:27.412	verifying checksum
11:30:27.811	/opt/buildhome/.asdf/downloads/golang/1.24.1/archive.tar.gz: OK
11:30:27.812	checksum verified
11:30:30.034	Installing hugo extended_0.145.0
11:30:30.147	* Downloading hugo release extended_0.145.0...
11:30:31.880	hugo extended_0.145.0 installation was successful!
11:30:32.160	Executing user command: hugo
11:30:32.405	Start building sites … 
11:30:32.405	hugo v0.145.0-666444f0a52132f9fec9f71cf25b441cc6a4f355+extended linux/amd64 BuildDate=2025-02-26T15:41:25Z VendorInfo=gohugoio

Even better, only the overridden tools are installed:

GO_VERSION: 1.24.1
HUGO_VERSION: 0.145.0

To migrate from v1 -> v2, just update your project’s settings and set the Build System Version to 2 and add verison overrides for only the tools/packages that are needed by the project.

v2 was introduced in 2023 already and I’m surprised I didn’t make the move sooner.

More info can be found in Cloudflare’s docs and in the v2 announcement.