本文整理匯總了Golang中github.com/openshift/origin/pkg/generate/app/cmd.AppConfig.RunBuilds方法的典型用法代碼示例。如果您正苦於以下問題:Golang AppConfig.RunBuilds方法的具體用法?Golang AppConfig.RunBuilds怎麽用?Golang AppConfig.RunBuilds使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/openshift/origin/pkg/generate/app/cmd.AppConfig
的用法示例。
在下文中一共展示了AppConfig.RunBuilds方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: RunNewBuild
// RunNewBuild contains all the necessary functionality for the OpenShift cli new-build command
func RunNewBuild(fullName string, f *clientcmd.Factory, out io.Writer, in io.Reader, c *cobra.Command, args []string, config *newcmd.AppConfig) error {
output := cmdutil.GetFlagString(c, "output")
if config.Dockerfile == "-" {
data, err := ioutil.ReadAll(in)
if err != nil {
return err
}
config.Dockerfile = string(data)
}
if err := setupAppConfig(f, out, c, args, config); err != nil {
return err
}
if err := setAppConfigLabels(c, config); err != nil {
return err
}
result, err := config.RunBuilds()
if err != nil {
if errs, ok := err.(errors.Aggregate); ok {
if len(errs.Errors()) == 1 {
err = errs.Errors()[0]
}
}
if err == newcmd.ErrNoInputs {
// TODO: suggest things to the user
return cmdutil.UsageError(c, "You must specify one or more images, image streams and source code locations to create a build configuration.")
}
return err
}
if err := setLabels(config.Labels, result); err != nil {
return err
}
if err := setAnnotations(map[string]string{newcmd.GeneratedByNamespace: newcmd.GeneratedByNewBuild}, result); err != nil {
return err
}
if len(output) != 0 && output != "name" {
return f.Factory.PrintObject(c, result.List, out)
}
if err := createObjects(f, out, output == "name", result); err != nil {
return err
}
for _, item := range result.List.Items {
switch t := item.(type) {
case *buildapi.BuildConfig:
fmt.Fprintf(c.Out(), "Build configuration %q created and build triggered.\n", t.Name)
}
}
if len(result.List.Items) > 0 {
fmt.Fprintf(c.Out(), "Run '%s %s' to check the progress.\n", fullName, StatusRecommendedName)
}
return nil
}
示例2: RunNewBuild
// RunNewBuild contains all the necessary functionality for the OpenShift cli new-build command
func RunNewBuild(fullName string, f *clientcmd.Factory, out io.Writer, in io.Reader, c *cobra.Command, args []string, config *newcmd.AppConfig) error {
output := cmdutil.GetFlagString(c, "output")
if config.Dockerfile == "-" {
data, err := ioutil.ReadAll(in)
if err != nil {
return err
}
config.Dockerfile = string(data)
}
if err := setupAppConfig(f, out, c, args, config); err != nil {
return err
}
if err := setAppConfigLabels(c, config); err != nil {
return err
}
result, err := config.RunBuilds()
if err != nil {
return handleBuildError(c, err, fullName)
}
if err := setLabels(config.Labels, result); err != nil {
return err
}
if err := setAnnotations(map[string]string{newcmd.GeneratedByNamespace: newcmd.GeneratedByNewBuild}, result); err != nil {
return err
}
if len(output) != 0 && output != "name" {
return f.Factory.PrintObject(c, result.List, out)
}
if err := createObjects(f, out, c.Out(), output == "name", true, result); err != nil {
return err
}
for _, item := range result.List.Items {
switch t := item.(type) {
case *buildapi.BuildConfig:
fmt.Fprintf(c.Out(), "Build configuration %q created and build triggered.\n", t.Name)
}
}
if len(result.List.Items) > 0 {
fmt.Fprintf(c.Out(), "Run '%s %s' to check the progress.\n", fullName, StatusRecommendedName)
}
return nil
}
示例3: RunNewBuild
// RunNewBuild contains all the necessary functionality for the OpenShift cli new-build command
func RunNewBuild(fullName string, f *clientcmd.Factory, out io.Writer, c *cobra.Command, args []string, config *newcmd.AppConfig) error {
if err := setupAppConfig(f, c, args, config); err != nil {
return err
}
if err := setAppConfigLabels(c, config); err != nil {
return err
}
result, err := config.RunBuilds(out, c.Out())
if err != nil {
if errs, ok := err.(errors.Aggregate); ok {
if len(errs.Errors()) == 1 {
err = errs.Errors()[0]
}
}
if err == newcmd.ErrNoInputs {
// TODO: suggest things to the user
return cmdutil.UsageError(c, "You must specify one or more images, image streams and source code locations to create a build configuration.")
}
return err
}
if err := setLabels(config.Labels, result); err != nil {
return err
}
if err := setAnnotations(map[string]string{newcmd.GeneratedByNamespace: newcmd.GeneratedByNewBuild}, result); err != nil {
return err
}
if len(cmdutil.GetFlagString(c, "output")) != 0 {
return f.Factory.PrintObject(c, result.List, out)
}
if err := createObjects(f, out, result); err != nil {
return err
}
for _, item := range result.List.Items {
switch t := item.(type) {
case *buildapi.BuildConfig:
fmt.Fprintf(c.Out(), "A build configuration was created - you can run `%s start-build %s` to start it.\n", fullName, t.Name)
}
}
return nil
}