aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Eric Boren <borenet@google.com>2018-04-19 09:36:45 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-19 14:18:24 +0000
commiteb70238dd51fbcb89b52f6cd1690c7477550ddf6 (patch)
tree858110fd3d7d12b3cc13d3343fd12d945d0cbafb
parentdce19a76e9ea90a42829cc7d13e23b3507e83bfe (diff)
[infra] gen_tasks: Pass internal hardware ID as a property
Bug: skia:7050 Change-Id: Ie262788b02f83d945455fa0cad8f5fe737a1cd4a Reviewed-on: https://skia-review.googlesource.com/122303 Reviewed-by: Ben Wagner <benjaminwagner@google.com> Commit-Queue: Eric Boren <borenet@google.com>
-rw-r--r--infra/bots/gen_tasks.go30
1 files changed, 21 insertions, 9 deletions
diff --git a/infra/bots/gen_tasks.go b/infra/bots/gen_tasks.go
index b6c1ed6d0a..741a5dd05e 100644
--- a/infra/bots/gen_tasks.go
+++ b/infra/bots/gen_tasks.go
@@ -47,6 +47,8 @@ const (
DEFAULT_OS_UBUNTU = "Ubuntu-14.04"
DEFAULT_OS_WIN = "Windows-2016Server-14393"
+ DEFAULT_PROJECT = "skia"
+
// Swarming output dirs.
OUTPUT_NONE = "output_ignored" // This will result in outputs not being isolated.
OUTPUT_BUILD = "build"
@@ -77,9 +79,6 @@ var (
// jobs.json.
JOBS []string
- LOGDOG_ANNOTATION_URL = fmt.Sprintf("logdog://logs.chromium.org/%s/%s/+/annotations", PROJECT, specs.PLACEHOLDER_TASK_ID)
- PROJECT = "skia"
-
// General configuration information.
CONFIG struct {
GsBucketCoverage string `json:"gs_bucket_coverage"`
@@ -90,6 +89,9 @@ var (
Pool string `json:"pool"`
}
+ // alternateProject can be set in an init function to override the default project ID.
+ alternateProject string
+
// alternateServiceAccount can be set in an init function to override the normal service accounts.
// Takes one of SERVICE_ACCOUNT_* constants as an argument and returns the service account that
// should be used, or uses sklog.Fatal to indicate a problem.
@@ -164,6 +166,15 @@ var (
jobsFile = flag.String("jobs", "", "JSON file containing jobs to run.")
)
+// Build the LogDog annotation URL.
+func logdogAnnotationUrl() string {
+ project := DEFAULT_PROJECT
+ if alternateProject != "" {
+ project = alternateProject
+ }
+ return fmt.Sprintf("logdog://logs.chromium.org/%s/%s/+/annotations", project, specs.PLACEHOLDER_TASK_ID)
+}
+
// Create a properties JSON string.
func props(p map[string]string) string {
d := make(map[string]interface{}, len(p)+1)
@@ -233,7 +244,7 @@ func kitchenTask(name, recipe, isolate, serviceAccount string, dimensions []stri
"-workdir", ".",
"-recipe", recipe,
"-properties", props(properties),
- "-logdog-annotation-url", LOGDOG_ANNOTATION_URL,
+ "-logdog-annotation-url", logdogAnnotationUrl(),
},
Dependencies: []string{BUNDLE_RECIPES_NAME},
Dimensions: dimensions,
@@ -242,7 +253,7 @@ func kitchenTask(name, recipe, isolate, serviceAccount string, dimensions []stri
"VPYTHON_VIRTUALENV_ROOT": []string{"${cache_dir}/vpython"},
},
ExtraTags: map[string]string{
- "log_location": LOGDOG_ANNOTATION_URL,
+ "log_location": logdogAnnotationUrl(),
},
Isolate: relpath(isolate),
Outputs: outputs,
@@ -876,6 +887,11 @@ func test(b *specs.TasksCfgBuilder, name string, parts map[string]string, compil
if strings.Contains(name, "SKQP") {
recipe = "skqp_test"
}
+ extraProps := map[string]string{}
+ iid := internalHardwareLabel(parts)
+ if iid != nil {
+ extraProps["internal_hardware_label"] = strconv.Itoa(*iid)
+ }
task := kitchenTask(name, recipe, "test_skia_bundled.isolate", "", swarmDimensions(parts), nil, OUTPUT_TEST)
task.CipdPackages = append(task.CipdPackages, pkgs...)
task.Dependencies = append(task.Dependencies, compileTaskName)
@@ -906,10 +922,6 @@ func test(b *specs.TasksCfgBuilder, name string, parts map[string]string, compil
task.ExecutionTimeout = 6 * time.Hour
task.IoTimeout = 6 * time.Hour
}
- iid := internalHardwareLabel(parts)
- if iid != nil {
- task.Command = append(task.Command, fmt.Sprintf("internal_hardware_label=%d", *iid))
- }
b.MustAddTask(name, task)
// Upload results if necessary. TODO(kjlubick): If we do coverage analysis at the same