本文整理汇总了Golang中github.com/openshift/source-to-image/pkg/api.Config.Description方法的典型用法代码示例。如果您正苦于以下问题:Golang Config.Description方法的具体用法?Golang Config.Description怎么用?Golang Config.Description使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/openshift/source-to-image/pkg/api.Config
的用法示例。
在下文中一共展示了Config.Description方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: GenerateConfigFromLabels
// GenerateConfigFromLabels generates the S2I Config struct from the Docker
// image labels.
func GenerateConfigFromLabels(image string, config *api.Config) error {
d, err := docker.New(config.DockerConfig, config.PullAuthentication)
if err != nil {
return err
}
var source *dockerclient.Image
if config.ForcePull {
source, err = d.PullImage(image)
} else {
source, err = d.CheckAndPullImage(image)
}
if err != nil {
return err
}
if builderVersion, ok := source.Config.Labels["io.openshift.builder-version"]; ok {
config.BuilderImageVersion = builderVersion
config.BuilderBaseImageVersion = source.Config.Labels["io.openshift.builder-base-version"]
}
config.ScriptsURL = source.Config.Labels[api.DefaultNamespace+"scripts-url"]
if len(config.ScriptsURL) == 0 {
// FIXME: Backward compatibility
config.ScriptsURL = source.Config.Labels["io.s2i.scripts-url"]
}
config.Description = source.Config.Labels[api.KubernetesNamespace+"description"]
config.DisplayName = source.Config.Labels[api.KubernetesNamespace+"display-name"]
if builder, ok := source.Config.Labels[api.DefaultNamespace+"build.image"]; ok {
config.BuilderImage = builder
} else {
return fmt.Errorf("Required label %q not found in image", api.DefaultNamespace+"build.image")
}
if repo, ok := source.Config.Labels[api.DefaultNamespace+"build.source-location"]; ok {
config.Source = repo
} else {
return fmt.Errorf("Required label %q not found in image", api.DefaultNamespace+"source-location")
}
config.ContextDir = source.Config.Labels[api.DefaultNamespace+"build.source-context-dir"]
config.Ref = source.Config.Labels[api.DefaultNamespace+"build.commit.ref"]
return nil
}
示例2: GenerateConfigFromLabels
// GenerateConfigFromLabels generates the S2I Config struct from the Docker
// image labels.
func GenerateConfigFromLabels(config *api.Config, metadata *docker.PullResult) error {
if config == nil {
return errors.New("config must be provided to GenerateConfigFromLabels")
}
if metadata == nil {
return errors.New("image metadata must be provided to GenerateConfigFromLabels")
}
labels := metadata.Image.Config.Labels
if builderVersion, ok := labels["io.openshift.builder-version"]; ok {
config.BuilderImageVersion = builderVersion
config.BuilderBaseImageVersion = labels["io.openshift.builder-base-version"]
}
config.ScriptsURL = labels[api.DefaultNamespace+"scripts-url"]
if len(config.ScriptsURL) == 0 {
// FIXME: Backward compatibility
config.ScriptsURL = labels["io.s2i.scripts-url"]
}
config.Description = labels[api.KubernetesNamespace+"description"]
config.DisplayName = labels[api.KubernetesNamespace+"display-name"]
if builder, ok := labels[api.DefaultNamespace+"build.image"]; ok {
config.BuilderImage = builder
} else {
return fmt.Errorf("Required label %q not found in image", api.DefaultNamespace+"build.image")
}
if repo, ok := labels[api.DefaultNamespace+"build.source-location"]; ok {
config.Source = repo
} else {
return fmt.Errorf("Required label %q not found in image", api.DefaultNamespace+"source-location")
}
config.ContextDir = labels[api.DefaultNamespace+"build.source-context-dir"]
config.Ref = labels[api.DefaultNamespace+"build.commit.ref"]
return nil
}
示例3: GenerateConfigFromLabels
// GenerateConfigFromLabels generates the S2I Config struct from the Docker
// image labels.
func GenerateConfigFromLabels(config *api.Config) error {
result, err := docker.GetBuilderImage(config)
if err != nil {
return err
}
labels := result.Image.Config.Labels
if builderVersion, ok := labels["io.openshift.builder-version"]; ok {
config.BuilderImageVersion = builderVersion
config.BuilderBaseImageVersion = labels["io.openshift.builder-base-version"]
}
config.ScriptsURL = labels[api.DefaultNamespace+"scripts-url"]
if len(config.ScriptsURL) == 0 {
// FIXME: Backward compatibility
config.ScriptsURL = labels["io.s2i.scripts-url"]
}
config.Description = labels[api.KubernetesNamespace+"description"]
config.DisplayName = labels[api.KubernetesNamespace+"display-name"]
if builder, ok := labels[api.DefaultNamespace+"build.image"]; ok {
config.BuilderImage = builder
} else {
return fmt.Errorf("Required label %q not found in image", api.DefaultNamespace+"build.image")
}
if repo, ok := labels[api.DefaultNamespace+"build.source-location"]; ok {
config.Source = repo
} else {
return fmt.Errorf("Required label %q not found in image", api.DefaultNamespace+"source-location")
}
config.ContextDir = labels[api.DefaultNamespace+"build.source-context-dir"]
config.Ref = labels[api.DefaultNamespace+"build.commit.ref"]
return nil
}