Skip to content

Commit

Permalink
Merge pull request #16786 from tamird/bench-quotes
Browse files Browse the repository at this point in the history
cmd/benchmark: include branch and name configuration keys
  • Loading branch information
tamird authored Jun 29, 2017
2 parents 2b4b2a2 + b892066 commit 14d2c91
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions pkg/cmd/benchmark/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,22 +58,22 @@ func do(ctx context.Context) error {
}

show, err := func() ([]byte, error) {
cmd := exec.CommandContext(ctx, "git", "show", "--format='%H %cI'", "HEAD")
cmd := exec.CommandContext(ctx, "git", "show", "-s", "--format=%H%n%cI", "HEAD")
cmd.Dir = rootPkg.Dir
return cmd.Output()
}()
if err != nil {
return errors.Wrap(err, "could not determine commit hash and committer date")
}
parts := strings.Split(string(bytes.TrimSpace(show)), " ")
parts := strings.Split(string(bytes.TrimSpace(show)), "\n")
if len(parts) != 2 {
return errors.Errorf("expected commit hash and committer date, got %s", show)
}
commit, commitTime := parts[0], parts[1]

data, ok := os.LookupEnv(serviceAccountJSONEnv)
if !ok {
return errors.Errorf("Service account JSON environment variable %s is not set", serviceAccountJSONEnv)
return errors.Errorf("service account JSON environment variable %s is not set", serviceAccountJSONEnv)
}

conf, err := google.JWTConfigFromJSON([]byte(data), "https://www.googleapis.com/auth/userinfo.email")
Expand Down Expand Up @@ -135,9 +135,11 @@ func do(ctx context.Context) error {

if _, err := fmt.Fprintf(
buffer,
"commit: %s\ncommit-time: %s\niteration: %d\nstart-time: %s\n",
"commit: %s\ncommit-time: %s\nbranch: %s\nname: %s\niteration: %d\nstart-time: %s\n",
commit,
commitTime,
"master",
"nightly",
i,
timeutil.Now().UTC().Format(time.RFC3339),
); err != nil {
Expand Down

0 comments on commit 14d2c91

Please sign in to comment.