Skip to content

Commit

Permalink
move out strategy to it's own type
Browse files Browse the repository at this point in the history
  • Loading branch information
amwat committed Feb 2, 2021
1 parent 10fcccd commit 6843a36
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkg/build/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ import (
"fmt"
)

type buildStrategy string

const (
// bazelStrategy builds and (optionally) stages using bazel
bazelStrategy buildStrategy = "bazel"
// makeStrategy builds using make and (optionally) stages using krel
makeStrategy buildStrategy = "make"
)

type Options struct {
Strategy string `flag:"~strategy" desc:"Determines the build strategy to use either make or bazel."`
StageLocation string `flag:"~stage" desc:"Upload binaries to gs://bucket/ci/job-suffix if set"`
Expand All @@ -36,15 +45,15 @@ func (o *Options) Validate() error {

func (o *Options) implementationFromStrategy() error {
switch o.Strategy {
case "bazel":
case string(bazelStrategy):
bazel := &Bazel{
RepoRoot: o.RepoRoot,
StageLocation: o.StageLocation,
ImageLocation: o.ImageLocation,
}
o.Builder = bazel
o.Stager = bazel
case "make":
case string(makeStrategy):
o.Builder = &MakeBuilder{
RepoRoot: o.RepoRoot,
}
Expand Down

0 comments on commit 6843a36

Please sign in to comment.