@@ -672,9 +672,9 @@ func describeDeploymentConfigTrigger(dc *deployapi.DeploymentConfig) string {
672
672
func describeStandaloneBuildGroup (f formatter , pipeline graphview.ImagePipeline , namespace string ) []string {
673
673
switch {
674
674
case pipeline .Build != nil :
675
- lines := []string {describeBuildInPipeline (f , pipeline . Build . BuildConfig , pipeline . BaseImage )}
675
+ lines := []string {describeBuildInPipeline (f , pipeline , namespace )}
676
676
if pipeline .Image != nil {
677
- lines = append (lines , fmt .Sprintf ("pushes to %s" , describeImageTagInPipeline (f , pipeline .Image , namespace )))
677
+ lines = append (lines , fmt .Sprintf ("-> %s" , describeImageTagInPipeline (f , pipeline .Image , namespace )))
678
678
}
679
679
return lines
680
680
case pipeline .Image != nil :
@@ -687,11 +687,11 @@ func describeStandaloneBuildGroup(f formatter, pipeline graphview.ImagePipeline,
687
687
func describeImageInPipeline (f formatter , pipeline graphview.ImagePipeline , namespace string ) string {
688
688
switch {
689
689
case pipeline .Image != nil && pipeline .Build != nil :
690
- return fmt .Sprintf ("%s <- %s" , describeImageTagInPipeline (f , pipeline .Image , namespace ), describeBuildInPipeline (f , pipeline . Build . BuildConfig , pipeline . BaseImage ))
690
+ return fmt .Sprintf ("%s <- %s" , describeImageTagInPipeline (f , pipeline .Image , namespace ), describeBuildInPipeline (f , pipeline , namespace ))
691
691
case pipeline .Image != nil :
692
692
return describeImageTagInPipeline (f , pipeline .Image , namespace )
693
693
case pipeline .Build != nil :
694
- return describeBuildInPipeline (f , pipeline . Build . BuildConfig , pipeline . BaseImage )
694
+ return describeBuildInPipeline (f , pipeline , namespace )
695
695
default :
696
696
return "<unknown>"
697
697
}
@@ -709,33 +709,31 @@ func describeImageTagInPipeline(f formatter, image graphview.ImageTagLocation, n
709
709
}
710
710
}
711
711
712
- func describeBuildInPipeline (f formatter , build * buildapi.BuildConfig , baseImage graphview.ImageTagLocation ) string {
712
+ func describeBuildInPipeline (f formatter , pipeline graphview.ImagePipeline , namespace string ) string {
713
+ bldType := ""
713
714
switch {
714
- case build .Spec .Strategy .DockerStrategy != nil :
715
- // TODO: handle case where no source repo
716
- source , ok := describeSourceInPipeline (& build .Spec .Source )
717
- if ! ok {
718
- return fmt .Sprintf ("bc/%s unconfigured docker build - no source set" , build .Name )
719
- }
720
- return fmt .Sprintf ("bc/%s docker build of %s" , build .Name , source )
721
- case build .Spec .Strategy .SourceStrategy != nil :
722
- source , ok := describeSourceInPipeline (& build .Spec .Source )
723
- if ! ok {
724
- return fmt .Sprintf ("bc/%s unconfigured source build" , build .Name )
725
- }
726
- if baseImage == nil {
727
- return fmt .Sprintf ("bc/%s %s; no image set" , build .Name , source )
728
- }
729
- return fmt .Sprintf ("bc/%s builds %s with %s" , build .Name , source , baseImage .ImageSpec ())
730
- case build .Spec .Strategy .CustomStrategy != nil :
731
- source , ok := describeSourceInPipeline (& build .Spec .Source )
732
- if ! ok {
733
- return fmt .Sprintf ("bc/%s custom build " , build .Name )
734
- }
735
- return fmt .Sprintf ("bc/%s custom build of %s" , build .Name , source )
715
+ case pipeline .Build .BuildConfig .Spec .Strategy .DockerStrategy != nil :
716
+ bldType = "docker"
717
+ case pipeline .Build .BuildConfig .Spec .Strategy .SourceStrategy != nil :
718
+ bldType = "source"
719
+ case pipeline .Build .BuildConfig .Spec .Strategy .CustomStrategy != nil :
720
+ bldType = "custom"
721
+ case pipeline .Build .BuildConfig .Spec .Strategy .JenkinsPipelineStrategy != nil :
722
+ return fmt .Sprintf ("bc/%s is a Jenkins Pipeline" , pipeline .Build .BuildConfig .Name )
736
723
default :
737
- return fmt .Sprintf ("bc/%s unrecognized build" , build .Name )
724
+ return fmt .Sprintf ("bc/%s unrecognized build" , pipeline .Build .BuildConfig .Name )
725
+ }
726
+
727
+ source , ok := describeSourceInPipeline (& pipeline .Build .BuildConfig .Spec .Source )
728
+ if ! ok {
729
+ return fmt .Sprintf ("bc/%s unconfigured %s build" , pipeline .Build .BuildConfig .Name , bldType )
730
+ }
731
+
732
+ retStr := fmt .Sprintf ("bc/%s %s builds %s" , pipeline .Build .BuildConfig .Name , bldType , source )
733
+ if pipeline .BaseImage != nil {
734
+ retStr = retStr + fmt .Sprintf (" on %s" , describeImageTagInPipeline (f , pipeline .BaseImage , namespace ))
738
735
}
736
+ return retStr
739
737
}
740
738
741
739
func describeAdditionalBuildDetail (build * buildgraph.BuildConfigNode , lastSuccessfulBuild * buildgraph.BuildNode , lastUnsuccessfulBuild * buildgraph.BuildNode , activeBuilds []* buildgraph.BuildNode , pushTargetResolved bool , includeSuccess bool ) []string {
0 commit comments