func createBuild(t *testing.T, buildInterface client.BuildInterface, strategy string) (*buildapi.Build, error) { build := &buildapi.Build{} build.GenerateName = strings.ToLower(string(strategy)) + "-build-" build.Spec.Strategy = strategyForType(strategy) build.Spec.Source.Git = &buildapi.GitBuildSource{URI: "example.org"} return buildInterface.Create(build) }
func createDockerBuild(t *testing.T, buildInterface client.BuildInterface) (*buildapi.Build, error) { dockerBuild := &buildapi.Build{} dockerBuild.GenerateName = "docker-build-" dockerBuild.Spec.Strategy.Type = buildapi.DockerBuildStrategyType dockerBuild.Spec.Source.Type = buildapi.BuildSourceGit dockerBuild.Spec.Source.Git = &buildapi.GitBuildSource{URI: "example.org"} return buildInterface.Create(dockerBuild) }
func createCustomBuild(t *testing.T, buildInterface client.BuildInterface) (*buildapi.Build, error) { dockerBuild := &buildapi.Build{} dockerBuild.GenerateName = "custom-build-" dockerBuild.Spec.Strategy.Type = buildapi.CustomBuildStrategyType dockerBuild.Spec.Strategy.CustomStrategy = &buildapi.CustomBuildStrategy{From: kapi.ObjectReference{Name: "name:tag"}} dockerBuild.Spec.Source.Type = buildapi.BuildSourceGit dockerBuild.Spec.Source.Git = &buildapi.GitBuildSource{URI: "example.org"} return buildInterface.Create(dockerBuild) }
func createBuild(t *testing.T, buildInterface client.BuildInterface, strategy string) (*buildapi.Build, error) { build := &buildapi.Build{} build.ObjectMeta.Labels = map[string]string{ buildapi.BuildConfigLabel: "mock-build-config", buildapi.BuildRunPolicyLabel: string(buildapi.BuildRunPolicyParallel), } build.GenerateName = strings.ToLower(string(strategy)) + "-build-" build.Spec.Strategy = strategyForType(t, strategy) build.Spec.Source.Git = &buildapi.GitBuildSource{URI: "example.org"} return buildInterface.Create(build) }