Files
honey-biscuit-workshop/prebake.yml.tmpl
T
Catty Steve a8ed935f6a feat(baker/finalize): Add finalize stage framework with plugin system
and template

Implements the finalize stage infrastructure for HoneyBiscuitWorkshop:
- New finalize module with config, error, event, plugin, stage, and
  template submodules
- Plugin system supporting internal (webhook, mail, satori, in-site) and
  external plugins
- FinalizeConfig schema with version validation for finalize.yml
- Add glob, duration-str, lettre dependencies to workshop-baker
- Expand project documentation (clarification.md, description.md)
- Update .gitignore and fix bake.rs pipeline_functions access

BREAKING CHANGE: Not a buildable version!
2026-04-16 23:33:03 +08:00

244 lines
8.4 KiB
Cheetah
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# prebake.yaml.tmpl
#
# 术语说明:
# 可选:该字段可以不给出
# 默认为...:隐含“可选”
# 留空:尚未定义,留作后续
# 版本号,用于格式兼容性检查
# 到目前为止,"1.0"的版本号并不意味着schema就这么确定下来
version: "1.0"
# 构建环境定义
environment:
# 构建机类型:docker | firecracker | custom | baremetal
builder: "docker"
# 构建机配置,与builder一致的被启用。
baremetal: {}
docker:
# 镜像名,与dockerfile互斥
image: "rust:1.70-slim"
# Dockerfile路径,相对于项目根目录,与image互斥
dockerfile: "/Dockerfile"
# Docker构建参数,可选
build_args:
RUST_VERSION: "1.70"
firecracker: {}
# TODO: 定义firecracker结构
custom:
# 自定义构建机名称
name: "my-custom-builder"
# 设置脚本,相对于项目根目录
setup_script: "setup-builder.sh"
# 清洁脚本,相对于项目根目录
cleanup_script: "cleanup-builder.sh"
# 硬件资源要求,满足最小要求的构建机可以被选中
resources:
cpu: 2 # CPU核心数,默认为1
memory: "2G" # 内存大小,也可以写作2048MB,默认为"1G"
disk: "10G" # 磁盘空间,也可以写作10240MB,默认为"1G"
architecture: "x86_64" # 架构要求,只能是"noarch"或{"x86_64"/"amd64", "arm64"/"aarch64", "riscv64", "loongarch64"/"loong64"}中的一个或几个
# TODO: 重新设计GPU字段
# gpu: false # 是否需要GPU,默认为false
# gpu_type: "cuda" # GPU类型(如果需要),可以是"cuda", "rocm", "vulkan", "oneapi"中的一个或几个
tags: # 自定义标签,只有满足标签的构建机可以被选中
- "custom_tag"
# 网络配置
network:
enabled: true # 启用网络,对baremetal不适用,默认为true
outbound: true # 允许出站连接,对baremetal不适用,默认为true
dns_servers: # 指定构建机的DNS服务器,对baremetal不适用,custom应该自行处理DNS问题,可选
- "8.8.8.8"
- "1.1.1.1"
proxies: # 代理配置,暂时留空,可选
# 构建环境初始化
bootstrap:
# 构建用户,默认为 vulcan(火神)
# 设定为 "root" 表示忽略用户切换并禁用安全特性,需要 PIPELINE_PRIVILEGED 权限
user: "vulcan"
# 工作空间
workspace:
# 工作目录路径
path: "/home/vulcan/workspace"
# 路径不可用时回退到 /workspace
# 即使路径可用,也会在 /workspace 建立软链接
fallback: true
# 自定义 sudoers 文件内容
# 这会覆盖默认行为,可能绕过安全机制
# 需要 PIPELINE_CUSTOM_SUDOERS 权限
sudoers: "vulcan ALL=(ALL:ALL) NOPASSWD: ALL"
# 自定义 doas 文件内容
# 这会覆盖默认行为,可能绕过安全机制
# 与 sudoers 共享 PIPELINE_CUSTOM_SUDOERS 权限
doas: "permit nopass vulcan as root"
# 自定义 bootstrap 脚本(与上述所有字段互斥)
# 支持多种来源:
# workspace:///.workshop/bootstrap.sh - 项目内文件
# file:///bin/bootstrap.sh - 环境内文件
# server://bootstrap.sh - 由服务器提供
# https://example.com/bootstrap.sh - http/https网络下载,请确保构建环境可以连接到该URL
# (content) - 直接给出内容,当文本开头无法匹配任何scheme时采用
# 需要 PIPELINE_CUSTOM_BOOTSTRAP 权限
custom: "server://bootstrap-alpine.sh"
# 依赖定义,安装依赖时按system-user顺序进行
dependencies:
# Repology 端点配置,用于将 UPM 包名解析为系统包名
# 可选值:disabled, none, local, remote, server, default
# - disabled: 完全禁用 Repology
# - none: 不解析,直接使用原始包名
# - local: 使用本地 Repology 服务器
# - remote: 使用远程 Repology API
# - server: 由服务器提供 Repology 服务
# - default: 默认行为(通常等同于 local)
config:
repology_endpoint: "default"
# 系统包依赖,按包管理器枚举给出,只应该给出与环境契合的字段。
# 根据security.drop-after的配置,在此阶段一般具有root或免密root权限
# 不适用于裸机
system:
apt:
packages: # 安装的软件包
- "git"
- "curl"
- "build-essential"
- "pkg-config"
- "libssl-dev"
repositories: # 该字段按serde Value原样传递给插件,config.rs不做解析
- url: "ppa:custom/ppa" # 自定义PPAUbuntu
- url: "https://download.docker.com/linux/ubuntu" # DEB822
key: "https://download.docker.com/linux/ubuntu/gpg"
mirror: "https://mirrors.tuna.tsinghua.edu.cn" # 指定软件包镜像源,可选
pacman:
packages:
- "git"
- "curl"
- "base-devel"
- "pkg-config"
- "openssl"
repositories:
- server: "https://mirrors.tuna.tsinghua.edu.cn/arch4edu/$arch" # 自定义仓库(Arch
name: "arch4edu"
keypackage: "arch4edu-keyring"
mirror: "https://mirrors.tuna.tsinghua.edu.cn" # 指定软件包镜像源,可选
#dnf:
# 略
# 用户依赖
# 根据security.drop-after的配置,在此阶段一般不具有root权限
# 例外:语言依赖会在system中产生隐式依赖
user:
# 以下字段按serde Value原样传递给插件,config.rs不做解析
# rust:
# type: "rustup" # 此时会向系统引入隐式的rustup依赖
# toolchain: "nightly-x86_64-unknown-linux-gnu"
# manifest: "Cargo.toml"
# lock: "Cargo.lock"
# python:
# type: "uv"
# python: "python3.14"
# index: "http://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
# directory: ".venv"
# env: # 优先,高级选项
# UV_PYTHON: "python3.14"
# UV_INDEX: "http://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple"
# UV_DIRECTORY: ".venv"
# manifest: "requirements.txt" # 或pyproject.toml
# nix: {}
# # TBD: 没用过lol
# # PR welcome
custom: # 绝对的自定义,与上述全部配置互斥(custom独占)
- command: "cargo fetch"
working_dir: "/tmp"
# 环境变量配置
envvars:
# 构建环境变量,只在 prebake 阶段有效
# 用于控制 prebake 阶段的行为(apt/cargo/rustc 等)
prebake:
RUST_BACKTRACE: "full" # Rust 调试
CARGO_NET_GIT_FETCH_WITH_CLI: "true" # Cargo 配置
NODE_ENV: "production" # Node 环境
# 运行时环境变量(会传递给 bake 阶段)
# 这些变量会与项目中的 .env 文件合并后,作为最终环境
bake:
# 支持 secret 引用,格式: {{ secret.<key> }}
DATABASE_URL: "postgresql://user:{{ secret.dbpassword }}@localhost/db"
LOG_LEVEL: "info"
# 特殊变量:指定项目中 .env 文件的位置
# 系统会读取该文件,并将其中的变量与上面定义的变量合并
# 合并规则:prebake.yml 中定义的变量优先级更高,会覆盖 .env 中的同名变量
# 此变量本身不会传递给 bake 阶段
# .env不应该包含任何 secret
__ENV_FILE: ".env"
# 注意:
# - secret 只存在于内存中,不会写入磁盘
# - 日志中会自动遮蔽 secret 的值
# - 如需临时查看 secret,可使用 PIPELINE_UNCOVER_SECRET 权限(需 2FA
# 缓存配置
cache:
# 缓存目录
directory:
- path: "/usr/local/cargo"
strategy: "always" # 在"always","readonly","clean"和"never"中选择一个,可以被流水线启动时配置覆盖,默认为"always"
mode: "zstd" # 在"gzip","zstd","none"和"dir"中选择一个
- path: "/root/.npm"
strategy: "clean"
mode: "none"
- path: "/app/target"
strategy: "always"
mode: "dir"
# 缓存策略
strategy:
ttl_days: 30 # 缓存生存时间
max_size_gb: 20 # 最大缓存大小
cleanup_policy: "lru" # 清理策略:lru, fifo, size
# 安全配置
security:
#
drop-after: ""
# 留空
# 钩子脚本
hooks:
# 依赖安装前
early:
- command: "echo 'Starting dependency installation'"
name: ""
# 依赖安装后
late:
- command: "cargo fetch"
working_dir: "/tmp"
# 元数据
metadata:
description: "Rust project build environment"
maintainer: "team@example.com"
# vim: set ft=yaml ts=2 sw=2 et: