Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(782)

Unified Diff: milo/buildsource/buildbucket/pubsub.go

Issue 2980253002: Milo pubsub: Don't decode properties out of parameters (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: milo/buildsource/buildbucket/pubsub.go
diff --git a/milo/buildsource/buildbucket/pubsub.go b/milo/buildsource/buildbucket/pubsub.go
index d92a028c5c6ed6e0bcc0acf2d8da5d4794284893..077be7dbcaf9d5a1df175d138373e1781d401cd2 100644
--- a/milo/buildsource/buildbucket/pubsub.go
+++ b/milo/buildsource/buildbucket/pubsub.go
@@ -6,7 +6,6 @@ package buildbucket
import (
"encoding/json"
- "errors"
"fmt"
"net/http"
"strings"
@@ -16,6 +15,7 @@ import (
"github.com/luci/gae/service/datastore"
bucketApi "github.com/luci/luci-go/common/api/buildbucket/buildbucket/v1"
"github.com/luci/luci-go/common/clock"
+ "github.com/luci/luci-go/common/errors"
"github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/common/retry/transient"
"github.com/luci/luci-go/common/tsmon/field"
@@ -53,7 +53,6 @@ var (
type parameters struct {
BuilderName string `json:"builder_name"`
- Properties string `json:"properties"`
}
func isLUCI(build *bucketApi.ApiCommonBuildMessage) bool {
@@ -175,10 +174,12 @@ func saveBuildSummary(
func handlePubSubBuild(c context.Context, data *psMsg) error {
host := data.Hostname
build := &data.Build
+ // We only care about the "builder_name" key from the parameter.
p := parameters{}
err := json.Unmarshal([]byte(build.ParametersJson), &p)
if err != nil {
- logging.WithError(err).Errorf(c, "could not unmarshal build parameters")
+ err = errors.Annotate(
+ err, "could not unmarshal build parameters %s", build.ParametersJson).Err()
buildCounter.Add(c, 1, build.Bucket, isLUCI(build), build.Status, "Rejected")
// Permanent error, since this is probably a type of build we do not recognize.
return err
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698