如何在BuildConfig中使用可选的图像输入

时间:2020-02-18 19:34:45

标签: openshift

https://docs.openshift.com/container-platform/4.3/builds/creating-build-inputs.html#image-source_creating-build-inputs中所述,我已经为BuildConfig配置了一个图像源:

      source:
        images:
          - from:
              kind: ImageStreamTag
              name: optional-data-image:latest
            paths:
              - sourcePath: /.
                destinationDir: "image-sources/optional-data-dir"

当我开始上面的构建时,它无法从下面的消息开始

Warning BuildConfigInstantiateFailed    6m26s   buildconfig-controller  error instantiating Build from BuildConfig next/site (0): Build.build.openshift.io "my-build-1" is invalid: [spec.source.images[1].from.name: Required value]

是否有一种方法可以指定可选的图像输入,以便在图像不存在的情况下仍可以正常继续构建?

1 个答案:

答案 0 :(得分:0)

您的构建失败,因为您未指定from

strategy:
    type: Source
    sourceStrategy:
      from:
        kind: ImageStreamTag
        namespace: openshift
        name: 'java:8'