forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
util.go
45 lines (40 loc) · 995 Bytes
/
util.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package api
import "github.com/openshift/origin/pkg/util/namer"
const (
// BuildPodSuffix is the suffix used to append to a build pod name given a build name
BuildPodSuffix = "build"
)
// GetBuildPodName returns name of the build pod.
func GetBuildPodName(build *Build) string {
return namer.GetPodName(build.Name, BuildPodSuffix)
}
func StrategyType(strategy BuildStrategy) string {
switch {
case strategy.DockerStrategy != nil:
return "Docker"
case strategy.CustomStrategy != nil:
return "Custom"
case strategy.SourceStrategy != nil:
return "Source"
}
return ""
}
func SourceType(source BuildSource) string {
var sourceType string
if source.Git != nil {
sourceType = "Git"
}
if source.Dockerfile != nil {
if len(sourceType) != 0 {
sourceType = sourceType + ","
}
sourceType = sourceType + "Dockerfile"
}
if source.Binary != nil {
if len(sourceType) != 0 {
sourceType = sourceType + ","
}
sourceType = sourceType + "Binary"
}
return sourceType
}