3.3. 构建规格定义
您可以使用 spec.build.spec 字段将完整的构建规格嵌入到 BuildRun 资源中。通过嵌入规格,您可以在不创建和维护专用构建自定义资源的情况下构建镜像。以下示例显示了配置 spec.build.spec 字段的 BuildRun CR:
apiVersion: shipwright.io/v1beta1
kind: BuildRun
metadata:
name: standalone-buildrun
spec:
build:
spec:
source:
git:
url: https://github.com/shipwright-io/sample-go.git
contextDir: source-build
strategy:
kind: ClusterBuildStrategy
name: buildah
output:
image: <path_to_image>
注意
您不能在同一 CR 中使用 spec.build.name 和 spec.build.spec 字段,因为它们是相互排斥的。