本文整理匯總了Golang中github.com/openshift/source-to-image/pkg/api.Config.HasOnBuild方法的典型用法代碼示例。如果您正苦於以下問題:Golang Config.HasOnBuild方法的具體用法?Golang Config.HasOnBuild怎麽用?Golang Config.HasOnBuild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/openshift/source-to-image/pkg/api.Config
的用法示例。
在下文中一共展示了Config.HasOnBuild方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Strategy
// Strategy creates the appropriate build strategy for the provided config, using
// the overrides provided. Not all strategies support all overrides.
func Strategy(config *api.Config, overrides build.Overrides) (build.Builder, api.BuildInfo, error) {
var builder build.Builder
var buildInfo api.BuildInfo
image, err := docker.GetBuilderImage(config)
if err != nil {
buildInfo.FailureReason = utilstatus.NewFailureReason(utilstatus.ReasonPullBuilderImageFailed, utilstatus.ReasonMessagePullBuilderImageFailed)
return nil, buildInfo, err
}
config.HasOnBuild = image.OnBuild
// if we're blocking onbuild, just do a normal s2i build flow
// which won't do a docker build and invoke the onbuild commands
if image.OnBuild && !config.BlockOnBuild {
builder, err = onbuild.New(config, overrides)
if err != nil {
buildInfo.FailureReason = utilstatus.NewFailureReason(utilstatus.ReasonGenericS2IBuildFailed, utilstatus.ReasonMessageGenericS2iBuildFailed)
return nil, buildInfo, err
}
return builder, buildInfo, nil
}
builder, err = sti.New(config, overrides)
if err != nil {
buildInfo.FailureReason = utilstatus.NewFailureReason(utilstatus.ReasonGenericS2IBuildFailed, utilstatus.ReasonMessageGenericS2iBuildFailed)
return nil, buildInfo, err
}
return builder, buildInfo, err
}
示例2: Strategy
// Strategy creates the appropriate build strategy for the provided config, using
// the overrides provided. Not all strategies support all overrides.
func Strategy(config *api.Config, overrides build.Overrides) (build.Builder, error) {
image, err := docker.GetBuilderImage(config)
if err != nil {
return nil, err
}
config.HasOnBuild = image.OnBuild
// if we're blocking onbuild, just do a normal s2i build flow
// which won't do a docker build and invoke the onbuild commands
if image.OnBuild && !config.BlockOnBuild {
return onbuild.New(config, overrides)
}
return sti.New(config, overrides)
}