本文整理汇总了Golang中github.com/openshift/origin/pkg/generate/app.Pipeline.Image方法的典型用法代码示例。如果您正苦于以下问题:Golang Pipeline.Image方法的具体用法?Golang Pipeline.Image怎么用?Golang Pipeline.Image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/openshift/origin/pkg/generate/app.Pipeline
的用法示例。
在下文中一共展示了Pipeline.Image方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: buildPipelines
// buildPipelines converts a set of resolved, valid references into pipelines.
func (c *AppConfig) buildPipelines(components app.ComponentReferences, environment app.Environment) (app.PipelineGroup, error) {
pipelines := app.PipelineGroup{}
pipelineBuilder := app.NewPipelineBuilder(c.Name, c.GetBuildEnvironment(environment), c.OutputDocker).To(c.To)
for _, group := range components.Group() {
glog.V(4).Infof("found group: %v", group)
common := app.PipelineGroup{}
for _, ref := range group {
refInput := ref.Input()
from := refInput.String()
var pipeline *app.Pipeline
switch {
case refInput.ExpectToBuild:
glog.V(4).Infof("will add %q secrets into a build for a source build of %q", strings.Join(c.Secrets, ","), refInput.Uses)
if err := refInput.Uses.AddBuildSecrets(c.Secrets); err != nil {
return nil, fmt.Errorf("unable to add build secrets %q: %v", strings.Join(c.Secrets, ","), err)
}
var (
image *app.ImageRef
err error
)
if refInput.ResolvedMatch != nil {
inputImage, err := app.InputImageFromMatch(refInput.ResolvedMatch)
if err != nil {
return nil, fmt.Errorf("can't build %q: %v", from, err)
}
if !inputImage.AsImageStream && from != "scratch" && (refInput.Uses == nil || refInput.Uses.GetStrategy() != generate.StrategyPipeline) {
msg := "Could not find an image stream match for %q. Make sure that a Docker image with that tag is available on the node for the build to succeed."
glog.Warningf(msg, from)
}
image = inputImage
}
glog.V(4).Infof("will use %q as the base image for a source build of %q", ref, refInput.Uses)
if pipeline, err = pipelineBuilder.NewBuildPipeline(from, image, refInput.Uses); err != nil {
return nil, fmt.Errorf("can't build %q: %v", refInput.Uses, err)
}
default:
inputImage, err := app.InputImageFromMatch(refInput.ResolvedMatch)
if err != nil {
return nil, fmt.Errorf("can't include %q: %v", from, err)
}
if !inputImage.AsImageStream {
msg := "Could not find an image stream match for %q. Make sure that a Docker image with that tag is available on the node for the deployment to succeed."
glog.Warningf(msg, from)
}
glog.V(4).Infof("will include %q", ref)
if pipeline, err = pipelineBuilder.NewImagePipeline(from, inputImage); err != nil {
return nil, fmt.Errorf("can't include %q: %v", refInput, err)
}
}
if c.Deploy {
if err := pipeline.NeedsDeployment(environment, c.Labels, c.AsTestDeployment); err != nil {
return nil, fmt.Errorf("can't set up a deployment for %q: %v", refInput, err)
}
}
if c.NoOutput {
pipeline.Build.Output = nil
}
if refInput.Uses != nil && refInput.Uses.GetStrategy() == generate.StrategyPipeline {
pipeline.Build.Output = nil
pipeline.Deployment = nil
pipeline.Image = nil
pipeline.InputImage = nil
}
common = append(common, pipeline)
if err := common.Reduce(); err != nil {
return nil, fmt.Errorf("can't create a pipeline from %s: %v", common, err)
}
describeBuildPipelineWithImage(c.Out, ref, pipeline, c.OriginNamespace)
}
pipelines = append(pipelines, common...)
}
return pipelines, nil
}