Drone 提供了一个官方扩展,支持使用 Starlark(一种受 Python 启发的配置语言)来构建流水线。Starlark 为传统 yaml 配置提供了强大的替代方案。
安装
-
创建一个共享密钥。
$ openssl rand -hex 16 bea26a2221fd8090ea38720fc445eca6 -
下载并运行扩展。
$ docker run -d \ --publish=3000:3000 \ --env=DRONE_DEBUG=true \ --env=DRONE_SECRET=bea26a2221fd8090ea38720fc445eca6 \ --restart=always \ --name=starlark drone/drone-convert-starlark -
更新 Drone Server 配置以包含扩展地址和共享密钥。
DRONE_CONVERT_PLUGIN_ENDPOINT=http://1.2.3.4:3000 DRONE_CONVERT_PLUGIN_SECRET=bea26a2221fd8090ea38720fc445eca6
验证安装结果
你可以使用命令行工具验证扩展是否已配置并正在处理请求。
-
为命令行工具提供扩展端点和密钥。
export DRONE_CONVERT_ENDPOINT=http://1.2.3.4:3000 export DRONE_CONVERT_SECRET=bea26a2221fd8090ea38720fc445eca6 -
使用命令行工具转换 Starlark 脚本:
drone plugins convert path/to/.drone.star