Running Scripts
The build system includes a script runner that manages runtime dependencies automatically. You write scripts in Go, Python, or Bash — the build system downloads the correct toolchain and runs them.
Usage
List all available scripts:
./zig/zig build scriptsRun a script by name, with optional arguments:
./zig/zig build scripts -- <script_name> [args...]Arguments after the script name are passed through to the underlying script unchanged.
Supported Languages
| Extension | Runtime | Managed By |
|---|---|---|
.sh |
Bash | System /bin/bash |
.go |
Go | Build system downloads Go |
.py |
Python | Build system downloads uv |
Python scripts must include PEP 723 inline metadata
with a requires-python version.
Directory Layout
Scripts live in src/scripts/. They can be either
standalone files or subdirectories with a main.go,
main.py, or main.sh entry point:
src/scripts/
├── cfo.py # Standalone Python script
├── gcp_postgres_backup.py # Standalone Python script
├── add_az_sql_fw_rule.sh # Standalone Bash script
└── deploy_gcsfuse_healthcheck/ # Subdirectory script
└── main.sh # Entry point
The script runner discovers scripts by scanning
src/scripts/ for files matching the supported extensions,
or directories containing a main.* entry point.
Adding a New Script
- Create a file in
src/scripts/with a.sh,.go, or.pyextension (or create a subdirectory with amain.*entry point) - For Python scripts, add PEP 723 metadata at the top of the file
- Verify discovery:
./zig/zig build scriptsshould list your script - Run it:
./zig/zig build scripts -- your_script_name
Windows: Most scripts are not written with Windows compatibility in mind. Use WSL if you need to run them on Windows.
Edit this page