spec:
output:
to:
kind: "ImageStreamTag"
name: "sample-image:latest"
使用源到镜像 (S2I) 策略的构建会创建一个新的容器镜像。然后,该镜像会被推送到`Build`规范的`output`部分中指定的容器镜像注册表。
如果输出类型为`ImageStreamTag`,则镜像将被推送到集成的OpenShift镜像注册表并在指定的imagestream中进行标记。如果输出类型为`DockerImage`,则输出引用的名称将用作docker push规范。该规范可能包含一个注册表,如果未指定注册表,则默认为DockerHub。如果构建规范的输出部分为空,则在构建结束时不会推送镜像。
spec:
output:
to:
kind: "ImageStreamTag"
name: "sample-image:latest"
spec:
output:
to:
kind: "DockerImage"
name: "my-registry.mycompany.com:5000/myimages/myimage:tag"
源到镜像 (S2I) 策略构建会在输出镜像上设置以下环境变量
变量 | 描述 |
---|---|
|
构建的名称 |
|
构建的命名空间 |
|
构建的源URL |
|
构建中使用的Git引用 |
|
构建中使用的源提交 |
此外,任何用户定义的环境变量(例如使用S2I策略选项配置的环境变量)也将成为输出镜像环境变量列表的一部分。
源到镜像 (S2I) 构建会在输出镜像上设置以下标签
标签 | 描述 |
---|---|
|
构建中使用的源提交的作者 |
|
构建中使用的源提交的日期 |
|
构建中使用的源提交的哈希值 |
|
构建中使用的源提交的消息 |
|
源中指定的branch或引用 |
|
构建的源URL |
您还可以使用`BuildConfig.spec.output.imageLabels`字段指定将应用于从构建配置构建的每个镜像的自定义标签列表。
spec:
output:
to:
kind: "ImageStreamTag"
name: "my-image:latest"
imageLabels:
- name: "vendor"
value: "MyCompany"
- name: "authoritative-source-url"
value: "registry.mycompany.com"