Ejemplo n.º 1
0
func describeBuildInPipeline(f formatter, build *buildapi.BuildConfig, baseImage graphview.ImageTagLocation) string {
	switch {
	case build.Spec.Strategy.DockerStrategy != nil:
		// TODO: handle case where no source repo
		source, ok := describeSourceInPipeline(&build.Spec.Source)
		if !ok {
			return fmt.Sprintf("bc/%s unconfigured docker build - no source set", build.Name)
		}
		return fmt.Sprintf("bc/%s docker build of %s", build.Name, source)
	case build.Spec.Strategy.SourceStrategy != nil:
		source, ok := describeSourceInPipeline(&build.Spec.Source)
		if !ok {
			return fmt.Sprintf("bc/%s unconfigured source build", build.Name)
		}
		if baseImage == nil {
			return fmt.Sprintf("bc/%s %s; no image set", build.Name, source)
		}
		return fmt.Sprintf("bc/%s builds %s with %s", build.Name, source, baseImage.ImageSpec())
	case build.Spec.Strategy.CustomStrategy != nil:
		source, ok := describeSourceInPipeline(&build.Spec.Source)
		if !ok {
			return fmt.Sprintf("bc/%s custom build ", build.Name)
		}
		return fmt.Sprintf("bc/%s custom build of %s", build.Name, source)
	default:
		return fmt.Sprintf("bc/%s unrecognized build", build.Name)
	}
}
Ejemplo n.º 2
0
func describeBuildInPipeline(build *buildapi.BuildConfig, baseImage graphview.ImageTagLocation) string {
	switch build.Spec.Strategy.Type {
	case buildapi.DockerBuildStrategyType:
		// TODO: handle case where no source repo
		source, ok := describeSourceInPipeline(&build.Spec.Source)
		if !ok {
			return "docker build; no source set"
		}
		return fmt.Sprintf("docker build of %s", source)
	case buildapi.SourceBuildStrategyType:
		source, ok := describeSourceInPipeline(&build.Spec.Source)
		if !ok {
			return fmt.Sprintf("unconfigured source build %s", build.Name)
		}
		if baseImage == nil {
			return fmt.Sprintf("%s; no image set", source)
		}
		return fmt.Sprintf("builds %s with %s", source, baseImage.ImageSpec())
	case buildapi.CustomBuildStrategyType:
		source, ok := describeSourceInPipeline(&build.Spec.Source)
		if !ok {
			return fmt.Sprintf("custom build %s", build.Name)
		}
		return fmt.Sprintf("custom build of %s", source)
	default:
		return fmt.Sprintf("unrecognized build %s", build.Name)
	}
}
Ejemplo n.º 3
0
func describeImageTagInPipeline(f formatter, image graphview.ImageTagLocation, namespace string) string {
	switch t := image.(type) {
	case *imagegraph.ImageStreamTagNode:
		if t.ImageStreamTag.Namespace != namespace {
			return image.ImageSpec()
		}
		return f.ResourceName(t)
	default:
		return image.ImageSpec()
	}
}
Ejemplo n.º 4
0
func describeImageTagInPipeline(image graphview.ImageTagLocation, namespace string) string {
	switch t := image.(type) {
	case *imagegraph.ImageStreamTagNode:
		if t.ImageStreamTag.Namespace != namespace {
			return image.ImageSpec()
		}
		return "istag/" + t.ImageStreamTag.Name
	default:
		return image.ImageSpec()
	}
}