Fix the go version tag (#1058)

Per runtime.Version() docs the version might be a commit tag, that is not accepted
by Mako servers.
So fix that to espace more generally.
Period, on the other hand, is now an accepted symbol, so stop translating it.
This commit is contained in:
Victor Agababov 2020-02-06 10:57:32 -08:00 committed by GitHub
parent 8c2e0012c3
commit 1e31aa840f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 7 deletions

View File

@ -77,9 +77,11 @@ func (c *Client) StoreAndHandleResult() error {
return c.alerter.HandleBenchmarkResult(c.benchmarkKey, c.benchmarkName, out, err)
}
var tagEscaper = strings.NewReplacer("+", "-", "\t", "_", " ", "_")
// EscapeTag replaces characters that Mako doesn't accept with ones it does.
func EscapeTag(tag string) string {
return strings.ReplaceAll(tag, ".", "_")
return tagEscaper.Replace(tag)
}
// SetupHelper sets up the mako client for the provided benchmarkKey.
@ -135,15 +137,16 @@ func SetupHelper(ctx context.Context, benchmarkKey *string, benchmarkName *strin
} else if parts := strings.Split(machineType, "/"); len(parts) != 4 {
tags = append(tags, "instanceType="+EscapeTag(parts[3]))
}
tags = append(tags,
"commit="+commitID,
"kubernetes="+EscapeTag(version.String()),
"goversion="+EscapeTag(runtime.Version()),
)
log.Printf("The tags for this run are: %+v", tags)
// Create a new Quickstore that connects to the microservice
qs, qclose, err := quickstore.NewAtAddress(ctx, &qpb.QuickstoreInput{
BenchmarkKey: benchmarkKey,
Tags: append(tags,
"commit="+commitID,
"kubernetes="+EscapeTag(version.String()),
EscapeTag(runtime.Version()),
),
Tags: tags,
}, sidecarAddress)
if err != nil {
return nil, err