Skip to content

Commit

Permalink
Move repo-root to top level since it's needed by dumpclusterlogs.
Browse files Browse the repository at this point in the history
  • Loading branch information
amwat committed Sep 22, 2020
1 parent 4cbf83e commit b50afd5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
10 changes: 9 additions & 1 deletion kubetest2-gke/deployer/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
)

func (d *deployer) Build() error {
if err := d.BuildOptions.Validate(); err != nil {
if err := d.verifyBuildFlags(); err != nil {
return err
}
version, err := d.BuildOptions.Build()
Expand All @@ -41,3 +41,11 @@ func (d *deployer) Build() error {
d.Version = version
return nil
}

func (d *deployer) verifyBuildFlags() error {
if d.RepoRoot == "" {
return fmt.Errorf("required repo-root when building from source")
}
d.BuildOptions.RepoRoot = d.RepoRoot
return d.BuildOptions.Validate()
}
3 changes: 2 additions & 1 deletion kubetest2-gke/deployer/deployer.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ type deployer struct {

BuildOptions *options.BuildOptions

Version string `desc:"Use a specific GKE version e.g. 1.16.13.gke-400 or 'latest'. If --build is specified it will default to building kubernetes from source."`
RepoRoot string `desc:"Path to root of the kubernetes repo. Used with --build and for dumping cluster logs."`
Version string `desc:"Use a specific GKE version e.g. 1.16.13.gke-400 or 'latest'. If --build is specified it will default to building kubernetes from source."`

// doInit helps to make sure the initialization is performed only once
doInit sync.Once
Expand Down
6 changes: 1 addition & 5 deletions kubetest2-gke/deployer/options/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ import (
type BuildOptions 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"`
RepoRoot string `flag:"~repo-root" desc:"Path to root of the kubernetes repo. Used with --build."`

RepoRoot string `flag:"-"`
build.Builder
build.Stager
}

func (bo *BuildOptions) Validate() error {
if bo.RepoRoot == "" {
return fmt.Errorf("required repo-root when building from source")
}
return bo.implementationFromStrategy()
}

Expand Down

0 comments on commit b50afd5

Please sign in to comment.