forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.go
42 lines (35 loc) · 1.01 KB
/
build.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
package test
import (
buildapi "github.com/openshift/origin/pkg/build/api"
)
type TestBuild buildapi.Build
func Build() *TestBuild {
b := (*TestBuild)(&buildapi.Build{})
b.Name = "TestBuild"
b.Spec.Strategy.DockerStrategy = &buildapi.DockerBuildStrategy{}
b.Spec.Source.Git = &buildapi.GitBuildSource{
URI: "http://test.build/source",
}
return b
}
func (b *TestBuild) WithDockerStrategy() *TestBuild {
b.Spec.Strategy.DockerStrategy = &buildapi.DockerBuildStrategy{}
return b
}
func (b *TestBuild) WithSourceStrategy() *TestBuild {
strategy := &buildapi.SourceBuildStrategy{}
strategy.From.Name = "builder/image"
strategy.From.Kind = "DockerImage"
b.Spec.Strategy.SourceStrategy = strategy
return b
}
func (b *TestBuild) WithCustomStrategy() *TestBuild {
strategy := &buildapi.CustomBuildStrategy{}
strategy.From.Name = "builder/image"
strategy.From.Kind = "DockerImage"
b.Spec.Strategy.CustomStrategy = strategy
return b
}
func (b *TestBuild) AsBuild() *buildapi.Build {
return (*buildapi.Build)(b)
}