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

Unified Diff: go/src/infra/tools/kitchen/kitchen.go

Issue 2146403002: Kitchen: Generate LogDog prefix from Swarming. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Kitchen: Generate LogDog prefix from Swarming. Created 4 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
Index: go/src/infra/tools/kitchen/kitchen.go
diff --git a/go/src/infra/tools/kitchen/kitchen.go b/go/src/infra/tools/kitchen/kitchen.go
index 69b16dcc623dff50892826a041c1b25f5c071843..68bd7d31dd9d6ec93f262482f8895e50a153db41 100644
--- a/go/src/infra/tools/kitchen/kitchen.go
+++ b/go/src/infra/tools/kitchen/kitchen.go
@@ -13,6 +13,7 @@ import (
"golang.org/x/net/context"
"github.com/luci/luci-go/common/cli"
+ "github.com/luci/luci-go/common/environ"
"github.com/luci/luci-go/common/errors"
log "github.com/luci/luci-go/common/logging"
"github.com/luci/luci-go/common/logging/gologger"
@@ -68,3 +69,18 @@ func logAnnotatedErr(ctx context.Context, err error) {
log.Errorf(ctx, "Annotated error stack:\n%s", buf.String())
}
+
+// getSwarmingTaskParameters retrieves the Swarming task parameters from the
+// environment.
+func getSwarmingTaskParameters(env environ.Env) (host, taskID string, err error) {
+ if host, _ = env.Get("SWARMING_SERVER"); host == "" {
+ err = errors.Reason("missing or empty SWARMING_SERVER").Err()
+ return
+ }
+ if taskID, _ = env.Get("SWARMING_TASK_ID"); taskID == "" {
+ err = errors.Reason("missing SWARMING_TASK_ID").Err()
+ return
+ }
+
+ return
+}
« go/src/infra/tools/kitchen/cook.go ('K') | « go/src/infra/tools/kitchen/cook_logdog_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698