Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
richackard committed Jul 30, 2021
1 parent 2b2c555 commit c9e06a1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions kubetest2-gke/deployer/build/gke_make.go
Expand Up @@ -36,15 +36,17 @@ const (
pack gkeBuildAction = "package"
stage gkeBuildAction = "push-gcs"
printVersion gkeBuildAction = "print-version"

gkeMinorVersionRegex string = "^v(\\d\\.\\d+).*$"
)

const (
// GKEMakeStrategy builds and stages using the gke_make build
GKEMakeStrategy build.BuildAndStageStrategy = "gke_make"
)

var (
gkeMinorVersionRegex = regexp.MustCompile("^v(\\d\\.\\d+).*$")
)

type GKEMake struct {
RepoRoot string
BuildScript string
Expand Down Expand Up @@ -118,8 +120,7 @@ func (gmb *GKEMake) Stage(version string) error {
}

if gmb.UpdateLatest {
r := regexp.MustCompile(gkeMinorVersionRegex)
m := r.FindStringSubmatch(version)
m := gkeMinorVersionRegex.FindStringSubmatch(version)
var fName string
if len(m) < 2 {
klog.Warningf("can't find the minor version of %s, defaulting to latest.txt", version)
Expand All @@ -129,7 +130,7 @@ func (gmb *GKEMake) Stage(version string) error {
fName = fmt.Sprintf("latest-%s.txt", minor)
}
pushCmd := fmt.Sprintf("gsutil cp - %s/%s", gmb.StageLocation, fName)
cmd := exec.Command(pushCmd)
cmd := exec.RawCommand(pushCmd)
cmd.SetStdin(strings.NewReader(version))
exec.SetOutput(cmd, os.Stdout, os.Stderr)
if err := cmd.Run(); err != nil {
Expand Down

0 comments on commit c9e06a1

Please sign in to comment.