-
Notifications
You must be signed in to change notification settings - Fork 787
/
kind.go
45 lines (38 loc) · 980 Bytes
/
kind.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 metapipeline
import "strings"
const (
// ReleasePipeline indicates a release pipeline build.
ReleasePipeline PipelineKind = iota
// PullRequestPipeline indicates a pull request pipeline build.
PullRequestPipeline
// FeaturePipeline indicates a feature pipeline build.
FeaturePipeline
)
// PipelineKind defines the type of the pipeline
type PipelineKind uint32
// String returns a string representation of the pipeline type
func (p PipelineKind) String() string {
switch p {
case ReleasePipeline:
return "release"
case PullRequestPipeline:
return "pullrequest"
case FeaturePipeline:
return "feature"
default:
return "unknown"
}
}
// StringToPipelineKind converts text to a PipelineKind
func StringToPipelineKind(text string) PipelineKind {
switch strings.ToLower(text) {
case "release":
return ReleasePipeline
case "pullrequest":
return PullRequestPipeline
case "feature":
return FeaturePipeline
default:
return ReleasePipeline
}
}