borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1 | // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | package main |
| 6 | |
| 7 | /* |
| 8 | Generate the tasks.json file. |
| 9 | */ |
| 10 | |
| 11 | import ( |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 12 | "encoding/json" |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 13 | "flag" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 14 | "fmt" |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 15 | "io/ioutil" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 16 | "os" |
| 17 | "path" |
Eric Boren | 7e3a364 | 2017-06-14 15:25:31 -0400 | [diff] [blame] | 18 | "path/filepath" |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 19 | "regexp" |
Eric Boren | 7e3a364 | 2017-06-14 15:25:31 -0400 | [diff] [blame] | 20 | "runtime" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 21 | "sort" |
Kevin Lubick | 32f318b | 2017-10-17 13:40:52 -0400 | [diff] [blame] | 22 | "strconv" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 23 | "strings" |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 24 | "time" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 25 | |
| 26 | "github.com/skia-dev/glog" |
Eric Boren | 7e3a364 | 2017-06-14 15:25:31 -0400 | [diff] [blame] | 27 | "go.skia.org/infra/go/sklog" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 28 | "go.skia.org/infra/go/util" |
| 29 | "go.skia.org/infra/task_scheduler/go/specs" |
| 30 | ) |
| 31 | |
| 32 | const ( |
Kevin Lubick | 814b149 | 2017-11-29 14:45:14 -0500 | [diff] [blame] | 33 | BUNDLE_RECIPES_NAME = "Housekeeper-PerCommit-BundleRecipes" |
| 34 | ISOLATE_SKIMAGE_NAME = "Housekeeper-PerCommit-IsolateSkImage" |
| 35 | ISOLATE_SKP_NAME = "Housekeeper-PerCommit-IsolateSKP" |
| 36 | ISOLATE_SVG_NAME = "Housekeeper-PerCommit-IsolateSVG" |
| 37 | ISOLATE_NDK_LINUX_NAME = "Housekeeper-PerCommit-IsolateAndroidNDKLinux" |
Stephan Altmueller | 2a55217 | 2018-02-20 11:40:25 -0500 | [diff] [blame] | 38 | ISOLATE_SDK_LINUX_NAME = "Housekeeper-PerCommit-IsolateAndroidSDKLinux" |
Kevin Lubick | 814b149 | 2017-11-29 14:45:14 -0500 | [diff] [blame] | 39 | ISOLATE_WIN_TOOLCHAIN_NAME = "Housekeeper-PerCommit-IsolateWinToolchain" |
| 40 | ISOLATE_WIN_VULKAN_SDK_NAME = "Housekeeper-PerCommit-IsolateWinVulkanSDK" |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 41 | |
Eric Boren | 170c39c | 2017-11-15 11:22:57 -0500 | [diff] [blame] | 42 | DEFAULT_OS_DEBIAN = "Debian-9.1" |
| 43 | DEFAULT_OS_LINUX_GCE = "Debian-9.2" |
Ben Wagner | 5a9df18 | 2018-02-09 11:21:15 -0500 | [diff] [blame] | 44 | DEFAULT_OS_MAC = "Mac-10.13.3" |
Eric Boren | 170c39c | 2017-11-15 11:22:57 -0500 | [diff] [blame] | 45 | DEFAULT_OS_UBUNTU = "Ubuntu-14.04" |
| 46 | DEFAULT_OS_WIN = "Windows-2016Server-14393" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 47 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 48 | // Name prefix for upload jobs. |
| 49 | PREFIX_UPLOAD = "Upload" |
| 50 | ) |
| 51 | |
| 52 | var ( |
| 53 | // "Constants" |
| 54 | |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 55 | // Top-level list of all jobs to run at each commit; loaded from |
| 56 | // jobs.json. |
| 57 | JOBS []string |
| 58 | |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 59 | // General configuration information. |
| 60 | CONFIG struct { |
Kevin Lubick | c795a4c | 2017-10-09 15:26:19 -0400 | [diff] [blame] | 61 | GsBucketCoverage string `json:"gs_bucket_coverage"` |
| 62 | GsBucketGm string `json:"gs_bucket_gm"` |
| 63 | GsBucketNano string `json:"gs_bucket_nano"` |
Yuqian Li | 2ebf3d1 | 2017-10-24 09:43:21 -0400 | [diff] [blame] | 64 | GsBucketCalm string `json:"gs_bucket_calm"` |
Kevin Lubick | c795a4c | 2017-10-09 15:26:19 -0400 | [diff] [blame] | 65 | NoUpload []string `json:"no_upload"` |
| 66 | Pool string `json:"pool"` |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 67 | } |
| 68 | |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 69 | // alternateSwarmDimensions can be set in an init function to override the default swarming bot |
| 70 | // dimensions for the given task. |
| 71 | alternateSwarmDimensions func(parts map[string]string) []string |
| 72 | |
Eric Boren | fd4d60e | 2017-09-15 10:35:44 -0400 | [diff] [blame] | 73 | // internalHardwareLabelFn can be set in an init function to provide an |
| 74 | // internal_hardware_label variable to the recipe. |
Eric Boren | 4dc4aaf | 2017-09-15 14:09:07 -0400 | [diff] [blame] | 75 | internalHardwareLabelFn func(parts map[string]string) *int |
Eric Boren | 053d7a4 | 2017-09-15 08:35:31 -0400 | [diff] [blame] | 76 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 77 | // Defines the structure of job names. |
| 78 | jobNameSchema *JobNameSchema |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 79 | |
Eric Boren | f4a5fc7 | 2017-06-06 08:27:09 -0400 | [diff] [blame] | 80 | // Git 2.13. |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 81 | cipdGit1 = &specs.CipdPackage{ |
| 82 | Name: fmt.Sprintf("infra/git/${platform}"), |
| 83 | Path: "git", |
| 84 | Version: fmt.Sprintf("version:2.13.0.chromium9"), |
Eric Boren | f4a5fc7 | 2017-06-06 08:27:09 -0400 | [diff] [blame] | 85 | } |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 86 | cipdGit2 = &specs.CipdPackage{ |
| 87 | Name: fmt.Sprintf("infra/tools/git/${platform}"), |
| 88 | Path: "git", |
| 89 | Version: fmt.Sprintf("git_revision:a78b5f3658c0578a017db48df97d20ac09822bcd"), |
| 90 | } |
Eric Boren | f4a5fc7 | 2017-06-06 08:27:09 -0400 | [diff] [blame] | 91 | |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 92 | // Flags. |
Eric Boren | 1f8be68 | 2017-02-07 09:16:30 -0500 | [diff] [blame] | 93 | builderNameSchemaFile = flag.String("builder_name_schema", "", "Path to the builder_name_schema.json file. If not specified, uses infra/bots/recipe_modules/builder_name_schema/builder_name_schema.json from this repo.") |
| 94 | assetsDir = flag.String("assets_dir", "", "Directory containing assets.") |
| 95 | cfgFile = flag.String("cfg_file", "", "JSON file containing general configuration information.") |
Eric Boren | 1f8be68 | 2017-02-07 09:16:30 -0500 | [diff] [blame] | 96 | jobsFile = flag.String("jobs", "", "JSON file containing jobs to run.") |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 97 | ) |
| 98 | |
Eric Boren | fd4d60e | 2017-09-15 10:35:44 -0400 | [diff] [blame] | 99 | // internalHardwareLabel returns the internal ID for the bot, if any. |
Eric Boren | 4dc4aaf | 2017-09-15 14:09:07 -0400 | [diff] [blame] | 100 | func internalHardwareLabel(parts map[string]string) *int { |
Eric Boren | fd4d60e | 2017-09-15 10:35:44 -0400 | [diff] [blame] | 101 | if internalHardwareLabelFn != nil { |
| 102 | return internalHardwareLabelFn(parts) |
Eric Boren | 053d7a4 | 2017-09-15 08:35:31 -0400 | [diff] [blame] | 103 | } |
| 104 | return nil |
| 105 | } |
| 106 | |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 107 | // linuxGceDimensions are the Swarming dimensions for Linux GCE |
| 108 | // instances. |
| 109 | func linuxGceDimensions() []string { |
| 110 | return []string{ |
Ben Wagner | 4c9842e | 2017-09-25 12:56:53 -0400 | [diff] [blame] | 111 | // Specify CPU to avoid running builds on bots with a more unique CPU. |
| 112 | "cpu:x86-64-Haswell_GCE", |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 113 | "gpu:none", |
Eric Boren | 170c39c | 2017-11-15 11:22:57 -0500 | [diff] [blame] | 114 | fmt.Sprintf("os:%s", DEFAULT_OS_LINUX_GCE), |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 115 | fmt.Sprintf("pool:%s", CONFIG.Pool), |
| 116 | } |
| 117 | } |
| 118 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 119 | // deriveCompileTaskName returns the name of a compile task based on the given |
| 120 | // job name. |
| 121 | func deriveCompileTaskName(jobName string, parts map[string]string) string { |
Ravi Mistry | d4731e9 | 2018-01-02 14:54:43 -0500 | [diff] [blame] | 122 | if strings.Contains(jobName, "Bookmaker") { |
Ravi Mistry | edc4f3e | 2017-12-08 12:58:20 -0500 | [diff] [blame] | 123 | return "Build-Debian9-GCC-x86_64-Release" |
| 124 | } else if parts["role"] == "Housekeeper" { |
Eric Boren | bb198fb | 2017-06-28 11:45:54 -0400 | [diff] [blame] | 125 | return "Build-Debian9-GCC-x86_64-Release-Shared" |
Yuqian Li | 4a577af | 2018-01-05 11:13:43 -0500 | [diff] [blame] | 126 | } else if parts["role"] == "Test" || parts["role"] == "Perf" || parts["role"] == "Calmbench" { |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 127 | task_os := parts["os"] |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 128 | ec := []string{} |
| 129 | if val := parts["extra_config"]; val != "" { |
| 130 | ec = strings.Split(val, "_") |
Ben Wagner | dba0bc8 | 2017-12-11 13:27:27 -0500 | [diff] [blame] | 131 | ignore := []string{"Skpbench", "AbandonGpuContext", "PreAbandonGpuContext", "Valgrind", "ReleaseAndAbandonGpuContext", "CCPR", "FSAA", "FAAA", "FDAA", "NativeFonts", "GDI", "NoGPUThreads"} |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 132 | keep := make([]string, 0, len(ec)) |
| 133 | for _, part := range ec { |
| 134 | if !util.In(part, ignore) { |
| 135 | keep = append(keep, part) |
| 136 | } |
| 137 | } |
| 138 | ec = keep |
Eric Boren | 6ec17e3 | 2017-04-26 14:25:29 -0400 | [diff] [blame] | 139 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 140 | if task_os == "Android" { |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 141 | if !util.In("Android", ec) { |
| 142 | ec = append([]string{"Android"}, ec...) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 143 | } |
Eric Boren | bb198fb | 2017-06-28 11:45:54 -0400 | [diff] [blame] | 144 | task_os = "Debian9" |
Kevin Lubick | dcd2a90 | 2017-03-08 14:01:01 -0500 | [diff] [blame] | 145 | } else if task_os == "Chromecast" { |
Eric Boren | bb198fb | 2017-06-28 11:45:54 -0400 | [diff] [blame] | 146 | task_os = "Debian9" |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 147 | ec = append([]string{"Chromecast"}, ec...) |
Kevin Lubick | cb6f398 | 2017-04-07 10:04:08 -0400 | [diff] [blame] | 148 | } else if strings.Contains(task_os, "ChromeOS") { |
Kevin Lubick | b718fbb | 2017-11-02 09:34:08 -0400 | [diff] [blame] | 149 | ec = append([]string{"Chromebook", "GLES"}, ec...) |
Eric Boren | bb198fb | 2017-06-28 11:45:54 -0400 | [diff] [blame] | 150 | task_os = "Debian9" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 151 | } else if task_os == "iOS" { |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 152 | ec = append([]string{task_os}, ec...) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 153 | task_os = "Mac" |
| 154 | } else if strings.Contains(task_os, "Win") { |
| 155 | task_os = "Win" |
Eric Boren | bb198fb | 2017-06-28 11:45:54 -0400 | [diff] [blame] | 156 | } else if strings.Contains(task_os, "Ubuntu") || strings.Contains(task_os, "Debian") { |
| 157 | task_os = "Debian9" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 158 | } |
Eric Boren | 5083130 | 2016-11-18 13:10:51 -0500 | [diff] [blame] | 159 | jobNameMap := map[string]string{ |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 160 | "role": "Build", |
| 161 | "os": task_os, |
| 162 | "compiler": parts["compiler"], |
| 163 | "target_arch": parts["arch"], |
| 164 | "configuration": parts["configuration"], |
Eric Boren | 5083130 | 2016-11-18 13:10:51 -0500 | [diff] [blame] | 165 | } |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 166 | if len(ec) > 0 { |
| 167 | jobNameMap["extra_config"] = strings.Join(ec, "_") |
Eric Boren | 5083130 | 2016-11-18 13:10:51 -0500 | [diff] [blame] | 168 | } |
| 169 | name, err := jobNameSchema.MakeJobName(jobNameMap) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 170 | if err != nil { |
| 171 | glog.Fatal(err) |
| 172 | } |
| 173 | return name |
| 174 | } else { |
| 175 | return jobName |
| 176 | } |
| 177 | } |
| 178 | |
| 179 | // swarmDimensions generates swarming bot dimensions for the given task. |
| 180 | func swarmDimensions(parts map[string]string) []string { |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 181 | if alternateSwarmDimensions != nil { |
| 182 | return alternateSwarmDimensions(parts) |
| 183 | } |
| 184 | return defaultSwarmDimensions(parts) |
| 185 | } |
| 186 | |
| 187 | // defaultSwarmDimensions generates default swarming bot dimensions for the given task. |
| 188 | func defaultSwarmDimensions(parts map[string]string) []string { |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 189 | d := map[string]string{ |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 190 | "pool": CONFIG.Pool, |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 191 | } |
| 192 | if os, ok := parts["os"]; ok { |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 193 | d["os"], ok = map[string]string{ |
Kevin Lubick | 291547d | 2017-03-21 09:25:34 -0400 | [diff] [blame] | 194 | "Android": "Android", |
| 195 | "Chromecast": "Android", |
Kevin Lubick | cb6f398 | 2017-04-07 10:04:08 -0400 | [diff] [blame] | 196 | "ChromeOS": "ChromeOS", |
Eric Boren | bb198fb | 2017-06-28 11:45:54 -0400 | [diff] [blame] | 197 | "Debian9": DEFAULT_OS_DEBIAN, |
Ben Wagner | d3fdcc9 | 2017-11-14 13:30:04 -0500 | [diff] [blame] | 198 | "Mac": DEFAULT_OS_MAC, |
Eric Boren | bb198fb | 2017-06-28 11:45:54 -0400 | [diff] [blame] | 199 | "Ubuntu14": DEFAULT_OS_UBUNTU, |
Kevin Lubick | 291547d | 2017-03-21 09:25:34 -0400 | [diff] [blame] | 200 | "Ubuntu16": "Ubuntu-16.10", |
Eric Boren | 810c2b6 | 2017-07-11 08:11:15 -0400 | [diff] [blame] | 201 | "Ubuntu17": "Ubuntu-17.04", |
Ben Wagner | d3fdcc9 | 2017-11-14 13:30:04 -0500 | [diff] [blame] | 202 | "Win": DEFAULT_OS_WIN, |
Ben Wagner | 40226b4 | 2017-05-02 13:13:13 -0400 | [diff] [blame] | 203 | "Win10": "Windows-10-15063", |
Kevin Lubick | 291547d | 2017-03-21 09:25:34 -0400 | [diff] [blame] | 204 | "Win2k8": "Windows-2008ServerR2-SP1", |
Ben Wagner | d3fdcc9 | 2017-11-14 13:30:04 -0500 | [diff] [blame] | 205 | "Win2016": DEFAULT_OS_WIN, |
Ben Wagner | 56738d8 | 2017-04-18 15:38:15 -0400 | [diff] [blame] | 206 | "Win7": "Windows-7-SP1", |
Kevin Lubick | 291547d | 2017-03-21 09:25:34 -0400 | [diff] [blame] | 207 | "Win8": "Windows-8.1-SP0", |
Stephan Altmueller | ddad85b | 2017-05-19 13:08:19 -0400 | [diff] [blame] | 208 | "iOS": "iOS-10.3.1", |
Eric Boren | 54ff2fc | 2016-12-02 12:09:10 -0500 | [diff] [blame] | 209 | }[os] |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 210 | if !ok { |
| 211 | glog.Fatalf("Entry %q not found in OS mapping.", os) |
| 212 | } |
Ben Wagner | b3c90fc | 2018-02-23 11:17:03 -0500 | [diff] [blame] | 213 | if os == "Win10" { |
| 214 | // Transition to new Win image by model name. |
| 215 | _, ok = map[string]bool{ |
Ben Wagner | e16ba2c | 2018-02-27 15:12:03 -0500 | [diff] [blame] | 216 | "AlphaR2": true, |
Ben Wagner | b3c90fc | 2018-02-23 11:17:03 -0500 | [diff] [blame] | 217 | "NUC5i7RYH": true, |
Ben Wagner | c657fa6 | 2018-02-26 16:42:21 -0500 | [diff] [blame] | 218 | "NUC6i5SYK": true, |
Ben Wagner | b3c90fc | 2018-02-23 11:17:03 -0500 | [diff] [blame] | 219 | "NUCD34010WYKH": true, |
Ben Wagner | c420525 | 2018-02-27 15:54:02 -0500 | [diff] [blame] | 220 | "ShuttleC": true, |
Ben Wagner | b3c90fc | 2018-02-23 11:17:03 -0500 | [diff] [blame] | 221 | }[parts["model"]] |
| 222 | if ok { |
| 223 | d["os"] = "Windows-10-16299.248" |
| 224 | } |
| 225 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 226 | } else { |
Eric Boren | bb198fb | 2017-06-28 11:45:54 -0400 | [diff] [blame] | 227 | d["os"] = DEFAULT_OS_DEBIAN |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 228 | } |
Yuqian Li | ab246cb | 2017-11-02 13:48:23 -0400 | [diff] [blame] | 229 | if parts["role"] == "Test" || parts["role"] == "Perf" || parts["role"] == "Calmbench" { |
Kevin Lubick | 291547d | 2017-03-21 09:25:34 -0400 | [diff] [blame] | 230 | if strings.Contains(parts["os"], "Android") || strings.Contains(parts["os"], "Chromecast") { |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 231 | // For Android, the device type is a better dimension |
| 232 | // than CPU or GPU. |
Ben Wagner | 3668278 | 2017-06-14 10:01:45 -0400 | [diff] [blame] | 233 | deviceInfo, ok := map[string][]string{ |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 234 | "AndroidOne": {"sprout", "MOB30Q"}, |
Kevin Lubick | c2f3e8d | 2018-01-24 15:48:26 -0500 | [diff] [blame] | 235 | "Chorizo": {"chorizo", "1.30_109591"}, |
Ben Wagner | 0762bdf | 2017-11-28 09:41:48 -0500 | [diff] [blame] | 236 | "GalaxyS6": {"zerofltetmo", "NRD90M_G920TUVU5FQK1"}, |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 237 | "GalaxyS7_G930A": {"heroqlteatt", "NRD90M_G930AUCS4BQC2"}, |
| 238 | "GalaxyS7_G930FD": {"herolte", "NRD90M_G930FXXU1DQAS"}, |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 239 | "MotoG4": {"athene", "NPJ25.93-14"}, |
Ben Wagner | ee3123c | 2017-12-06 16:29:04 -0500 | [diff] [blame] | 240 | "NVIDIA_Shield": {"foster", "NRD90M_1915764_848"}, |
Ben Wagner | ee3123c | 2017-12-06 16:29:04 -0500 | [diff] [blame] | 241 | "Nexus5": {"hammerhead", "M4B30Z_3437181"}, |
Ben Wagner | eb549c8 | 2017-11-17 08:59:44 -0500 | [diff] [blame] | 242 | "Nexus5x": {"bullhead", "OPR6.170623.023"}, |
Ben Wagner | ee3123c | 2017-12-06 16:29:04 -0500 | [diff] [blame] | 243 | "Nexus7": {"grouper", "LMY47V_1836172"}, // 2012 Nexus 7 |
Ben Wagner | 9539a8c | 2017-11-02 14:09:32 -0400 | [diff] [blame] | 244 | "NexusPlayer": {"fugu", "OPR6.170623.021"}, |
Kevin Lubick | b5d82b4 | 2018-02-20 10:29:45 -0500 | [diff] [blame] | 245 | "Pixel": {"sailfish", "OPM1.171019.016"}, |
Kevin Lubick | b018f7b | 2017-10-31 14:44:08 -0400 | [diff] [blame] | 246 | "Pixel2XL": {"taimen", "OPD1.170816.023"}, |
Kevin Lubick | 674027a | 2017-10-31 09:47:38 -0400 | [diff] [blame] | 247 | "PixelC": {"dragon", "OPR1.170623.034"}, |
Ben Wagner | 3668278 | 2017-06-14 10:01:45 -0400 | [diff] [blame] | 248 | }[parts["model"]] |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 249 | if !ok { |
Ben Wagner | 3668278 | 2017-06-14 10:01:45 -0400 | [diff] [blame] | 250 | glog.Fatalf("Entry %q not found in Android mapping.", parts["model"]) |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 251 | } |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 252 | d["device_type"] = deviceInfo[0] |
| 253 | d["device_os"] = deviceInfo[1] |
Kevin Lubick | 4fd283e | 2017-12-07 11:19:31 -0500 | [diff] [blame] | 254 | // TODO(kjlubick): Remove the python dimension after we have removed the |
| 255 | // Nexus5x devices from the local lab (on Monday, Dec 11, 2017 should be fine). |
Kevin Lubick | 0f727ff | 2017-12-06 15:05:29 -0500 | [diff] [blame] | 256 | d["python"] = "2.7.9" // This indicates a RPI, e.g. in Skolo. Golo is 2.7.12 |
Kevin Lubick | 4fd283e | 2017-12-07 11:19:31 -0500 | [diff] [blame] | 257 | if parts["model"] == "Nexus5x" { |
| 258 | d["python"] = "2.7.12" |
| 259 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 260 | } else if strings.Contains(parts["os"], "iOS") { |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 261 | device, ok := map[string]string{ |
Eric Boren | 792079c | 2016-11-09 14:03:20 -0500 | [diff] [blame] | 262 | "iPadMini4": "iPad5,1", |
Stephan Altmueller | 63e843d | 2017-04-25 11:38:38 -0400 | [diff] [blame] | 263 | "iPhone6": "iPhone7,2", |
| 264 | "iPhone7": "iPhone9,1", |
| 265 | "iPadPro": "iPad6,3", |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 266 | }[parts["model"]] |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 267 | if !ok { |
| 268 | glog.Fatalf("Entry %q not found in iOS mapping.", parts["model"]) |
| 269 | } |
| 270 | d["device"] = device |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 271 | } else if parts["cpu_or_gpu"] == "CPU" { |
Ben Wagner | 4c9842e | 2017-09-25 12:56:53 -0400 | [diff] [blame] | 272 | modelMapping, ok := map[string]map[string]string{ |
| 273 | "AVX": { |
| 274 | "MacMini7.1": "x86-64-E5-2697_v2", |
| 275 | "Golo": "x86-64-E5-2670", |
| 276 | }, |
| 277 | "AVX2": { |
Ben Wagner | 85fb42a | 2017-11-07 16:57:37 -0500 | [diff] [blame] | 278 | "GCE": "x86-64-Haswell_GCE", |
Mike Klein | 9a01a21 | 2017-11-03 12:19:54 -0400 | [diff] [blame] | 279 | "NUC5i7RYH": "x86-64-i7-5557U", |
Ben Wagner | 4c9842e | 2017-09-25 12:56:53 -0400 | [diff] [blame] | 280 | }, |
Ben Wagner | b268d23 | 2017-09-28 16:38:34 -0400 | [diff] [blame] | 281 | "AVX512": { |
| 282 | "GCE": "x86-64-Skylake_GCE", |
| 283 | }, |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 284 | }[parts["cpu_or_gpu_value"]] |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 285 | if !ok { |
| 286 | glog.Fatalf("Entry %q not found in CPU mapping.", parts["cpu_or_gpu_value"]) |
| 287 | } |
Ben Wagner | 4c9842e | 2017-09-25 12:56:53 -0400 | [diff] [blame] | 288 | cpu, ok := modelMapping[parts["model"]] |
| 289 | if !ok { |
| 290 | glog.Fatalf("Entry %q not found in %q model mapping.", parts["model"], parts["cpu_or_gpu_value"]) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 291 | } |
Ben Wagner | 4c9842e | 2017-09-25 12:56:53 -0400 | [diff] [blame] | 292 | d["cpu"] = cpu |
Eric Boren | 170c39c | 2017-11-15 11:22:57 -0500 | [diff] [blame] | 293 | if parts["model"] == "GCE" && d["os"] == DEFAULT_OS_DEBIAN { |
| 294 | d["os"] = DEFAULT_OS_LINUX_GCE |
| 295 | } |
Ben Wagner | f53e6c9 | 2017-12-14 13:15:01 -0500 | [diff] [blame] | 296 | if parts["model"] == "GCE" && d["os"] == DEFAULT_OS_WIN { |
Ben Wagner | 832415e | 2017-12-15 11:23:40 -0500 | [diff] [blame] | 297 | // Use normal-size machines for Test and Perf tasks on Win GCE. |
Ben Wagner | f53e6c9 | 2017-12-14 13:15:01 -0500 | [diff] [blame] | 298 | d["machine_type"] = "n1-standard-16" |
| 299 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 300 | } else { |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 301 | if strings.Contains(parts["os"], "Win") { |
| 302 | gpu, ok := map[string]string{ |
Ben Wagner | 0d2b091 | 2017-08-15 12:43:55 -0400 | [diff] [blame] | 303 | "GT610": "10de:104a-22.21.13.8205", |
Ben Wagner | 85fb42a | 2017-11-07 16:57:37 -0500 | [diff] [blame] | 304 | "GTX1070": "10de:1ba1-23.21.13.8813", |
| 305 | "GTX660": "10de:11c0-23.21.13.8813", |
| 306 | "GTX960": "10de:1401-23.21.13.8813", |
Ben Wagner | 90e88aa | 2018-02-26 23:38:52 -0500 | [diff] [blame] | 307 | "IntelHD4400": "8086:0a16-20.19.15.4835", |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 308 | "IntelIris540": "8086:1926-21.20.16.4590", |
Ben Wagner | 90e88aa | 2018-02-26 23:38:52 -0500 | [diff] [blame] | 309 | "IntelIris6100": "8086:162b-20.19.15.4835", |
Ben Wagner | 2040ed2 | 2017-11-22 11:22:22 -0500 | [diff] [blame] | 310 | "RadeonHD7770": "1002:683d-22.19.165.512", |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 311 | "RadeonR9M470X": "1002:6646-22.19.165.512", |
Ben Wagner | ae532f6 | 2017-08-02 23:24:16 -0400 | [diff] [blame] | 312 | "QuadroP400": "10de:1cb3-22.21.13.8205", |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 313 | }[parts["cpu_or_gpu_value"]] |
| 314 | if !ok { |
| 315 | glog.Fatalf("Entry %q not found in Win GPU mapping.", parts["cpu_or_gpu_value"]) |
| 316 | } |
| 317 | d["gpu"] = gpu |
Ben Wagner | 0843589 | 2017-02-18 23:28:26 -0500 | [diff] [blame] | 318 | |
Ben Wagner | 4b1df02 | 2017-06-15 12:28:04 -0400 | [diff] [blame] | 319 | // Specify cpu dimension for NUCs and ShuttleCs. We temporarily have two |
| 320 | // types of machines with a GTX960. |
| 321 | cpu, ok := map[string]string{ |
| 322 | "NUC6i7KYK": "x86-64-i7-6770HQ", |
| 323 | "ShuttleC": "x86-64-i7-6700K", |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 324 | }[parts["model"]] |
| 325 | if ok { |
Ben Wagner | 4b1df02 | 2017-06-15 12:28:04 -0400 | [diff] [blame] | 326 | d["cpu"] = cpu |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 327 | } |
Eric Boren | bb198fb | 2017-06-28 11:45:54 -0400 | [diff] [blame] | 328 | } else if strings.Contains(parts["os"], "Ubuntu") || strings.Contains(parts["os"], "Debian") { |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 329 | gpu, ok := map[string]string{ |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 330 | // Intel drivers come from CIPD, so no need to specify the version here. |
| 331 | "IntelBayTrail": "8086:0f31", |
| 332 | "IntelHD2000": "8086:0102", |
| 333 | "IntelHD405": "8086:22b1", |
Ben Wagner | ab10c82 | 2017-12-19 15:14:12 -0500 | [diff] [blame] | 334 | "IntelIris640": "8086:5926", |
Ben Wagner | c274ec4 | 2017-08-03 22:29:22 -0400 | [diff] [blame] | 335 | "QuadroP400": "10de:1cb3-384.59", |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 336 | }[parts["cpu_or_gpu_value"]] |
| 337 | if !ok { |
| 338 | glog.Fatalf("Entry %q not found in Ubuntu GPU mapping.", parts["cpu_or_gpu_value"]) |
| 339 | } |
| 340 | d["gpu"] = gpu |
| 341 | } else if strings.Contains(parts["os"], "Mac") { |
| 342 | gpu, ok := map[string]string{ |
Ben Wagner | 1d8726f | 2018-02-02 14:47:31 -0500 | [diff] [blame] | 343 | "IntelHD6000": "8086:1626", |
Ben Wagner | df43005 | 2018-02-08 16:57:04 -0500 | [diff] [blame] | 344 | "IntelHD615": "8086:591e", |
Ben Wagner | cc4221b | 2017-08-17 17:29:04 -0400 | [diff] [blame] | 345 | "IntelIris5100": "8086:0a2e", |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 346 | }[parts["cpu_or_gpu_value"]] |
| 347 | if !ok { |
| 348 | glog.Fatalf("Entry %q not found in Mac GPU mapping.", parts["cpu_or_gpu_value"]) |
| 349 | } |
| 350 | d["gpu"] = gpu |
Ben Wagner | e7b8fea | 2018-02-09 10:29:09 -0500 | [diff] [blame] | 351 | // Yuck. We have two different types of MacMini7,1 with the same GPU but different CPUs. |
| 352 | if parts["cpu_or_gpu_value"] == "IntelIris5100" { |
| 353 | // Run all tasks on Golo machines for now. |
| 354 | d["cpu"] = "x86-64-i7-4578U" |
| 355 | } |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 356 | } else if strings.Contains(parts["os"], "ChromeOS") { |
Kevin Lubick | 64ca6be | 2017-12-04 15:43:31 -0500 | [diff] [blame] | 357 | version, ok := map[string]string{ |
| 358 | "MaliT604": "9901.12.0", |
| 359 | "MaliT764": "10172.0.0", |
| 360 | "MaliT860": "10172.0.0", |
Kevin Lubick | 0b1b9c2 | 2017-12-08 14:14:38 -0500 | [diff] [blame] | 361 | "PowerVRGX6250": "10176.5.0", |
Kevin Lubick | 64ca6be | 2017-12-04 15:43:31 -0500 | [diff] [blame] | 362 | "TegraK1": "10172.0.0", |
| 363 | "IntelHDGraphics615": "10032.17.0", |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 364 | }[parts["cpu_or_gpu_value"]] |
| 365 | if !ok { |
| 366 | glog.Fatalf("Entry %q not found in ChromeOS GPU mapping.", parts["cpu_or_gpu_value"]) |
| 367 | } |
Kevin Lubick | 64ca6be | 2017-12-04 15:43:31 -0500 | [diff] [blame] | 368 | d["gpu"] = parts["cpu_or_gpu_value"] |
| 369 | d["release_version"] = version |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 370 | } else { |
| 371 | glog.Fatalf("Unknown GPU mapping for OS %q.", parts["os"]) |
Ben Wagner | 0843589 | 2017-02-18 23:28:26 -0500 | [diff] [blame] | 372 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 373 | } |
| 374 | } else { |
| 375 | d["gpu"] = "none" |
Eric Boren | bb198fb | 2017-06-28 11:45:54 -0400 | [diff] [blame] | 376 | if d["os"] == DEFAULT_OS_DEBIAN { |
Kevin Lubick | 4610a9b | 2017-03-22 15:54:54 -0400 | [diff] [blame] | 377 | return linuxGceDimensions() |
Ben Wagner | d3fdcc9 | 2017-11-14 13:30:04 -0500 | [diff] [blame] | 378 | } else if d["os"] == DEFAULT_OS_WIN { |
| 379 | // Windows CPU bots. |
Ben Wagner | a78f1bc | 2017-09-26 18:19:56 -0400 | [diff] [blame] | 380 | d["cpu"] = "x86-64-Haswell_GCE" |
Ben Wagner | 832415e | 2017-12-15 11:23:40 -0500 | [diff] [blame] | 381 | // Use many-core machines for Build tasks on Win GCE, except for Goma. |
| 382 | if strings.Contains(parts["extra_config"], "Goma") { |
| 383 | d["machine_type"] = "n1-standard-16" |
| 384 | } else { |
| 385 | d["machine_type"] = "n1-highcpu-64" |
| 386 | } |
Ben Wagner | d3fdcc9 | 2017-11-14 13:30:04 -0500 | [diff] [blame] | 387 | } else if d["os"] == DEFAULT_OS_MAC { |
| 388 | // Mac CPU bots. |
Ben Wagner | a78f1bc | 2017-09-26 18:19:56 -0400 | [diff] [blame] | 389 | d["cpu"] = "x86-64-E5-2697_v2" |
Kevin Lubick | 4610a9b | 2017-03-22 15:54:54 -0400 | [diff] [blame] | 390 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 391 | } |
Kevin Lubick | 4610a9b | 2017-03-22 15:54:54 -0400 | [diff] [blame] | 392 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 393 | rv := make([]string, 0, len(d)) |
| 394 | for k, v := range d { |
| 395 | rv = append(rv, fmt.Sprintf("%s:%s", k, v)) |
| 396 | } |
| 397 | sort.Strings(rv) |
| 398 | return rv |
| 399 | } |
| 400 | |
Eric Boren | 7e3a364 | 2017-06-14 15:25:31 -0400 | [diff] [blame] | 401 | // relpath returns the relative path to the given file from the config file. |
| 402 | func relpath(f string) string { |
| 403 | _, filename, _, _ := runtime.Caller(0) |
| 404 | dir := path.Dir(filename) |
| 405 | rel := dir |
| 406 | if *cfgFile != "" { |
| 407 | rel = path.Dir(*cfgFile) |
| 408 | } |
| 409 | rv, err := filepath.Rel(rel, path.Join(dir, f)) |
| 410 | if err != nil { |
| 411 | sklog.Fatal(err) |
| 412 | } |
| 413 | return rv |
| 414 | } |
| 415 | |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 416 | // bundleRecipes generates the task to bundle and isolate the recipes. |
| 417 | func bundleRecipes(b *specs.TasksCfgBuilder) string { |
| 418 | b.MustAddTask(BUNDLE_RECIPES_NAME, &specs.TaskSpec{ |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 419 | CipdPackages: []*specs.CipdPackage{cipdGit1, cipdGit2}, |
| 420 | Dimensions: linuxGceDimensions(), |
| 421 | ExtraArgs: []string{ |
| 422 | "--workdir", "../../..", "bundle_recipes", |
| 423 | fmt.Sprintf("buildername=%s", BUNDLE_RECIPES_NAME), |
| 424 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 425 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 426 | Isolate: relpath("bundle_recipes.isolate"), |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 427 | Priority: 0.7, |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 428 | }) |
| 429 | return BUNDLE_RECIPES_NAME |
| 430 | } |
| 431 | |
Eric Boren | 23a6ec6 | 2017-04-07 08:31:22 -0400 | [diff] [blame] | 432 | // useBundledRecipes returns true iff the given bot should use bundled recipes |
| 433 | // instead of syncing recipe DEPS itself. |
| 434 | func useBundledRecipes(parts map[string]string) bool { |
| 435 | // Use bundled recipes for all test/perf tasks. |
| 436 | return true |
| 437 | } |
| 438 | |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 439 | type isolateAssetCfg struct { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 440 | isolateFile string |
| 441 | cipdPkg string |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 442 | } |
| 443 | |
| 444 | var ISOLATE_ASSET_MAPPING = map[string]isolateAssetCfg{ |
| 445 | ISOLATE_SKIMAGE_NAME: { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 446 | isolateFile: "isolate_skimage.isolate", |
| 447 | cipdPkg: "skimage", |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 448 | }, |
| 449 | ISOLATE_SKP_NAME: { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 450 | isolateFile: "isolate_skp.isolate", |
| 451 | cipdPkg: "skp", |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 452 | }, |
| 453 | ISOLATE_SVG_NAME: { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 454 | isolateFile: "isolate_svg.isolate", |
| 455 | cipdPkg: "svg", |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 456 | }, |
Kevin Lubick | 814b149 | 2017-11-29 14:45:14 -0500 | [diff] [blame] | 457 | ISOLATE_NDK_LINUX_NAME: { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 458 | isolateFile: "isolate_ndk_linux.isolate", |
| 459 | cipdPkg: "android_ndk_linux", |
Kevin Lubick | 814b149 | 2017-11-29 14:45:14 -0500 | [diff] [blame] | 460 | }, |
Stephan Altmueller | 2a55217 | 2018-02-20 11:40:25 -0500 | [diff] [blame] | 461 | ISOLATE_SDK_LINUX_NAME: { |
| 462 | isolateFile: "isolate_android_sdk_linux.isolate", |
| 463 | cipdPkg: "android_sdk_linux", |
| 464 | }, |
Kevin Lubick | 814b149 | 2017-11-29 14:45:14 -0500 | [diff] [blame] | 465 | ISOLATE_WIN_TOOLCHAIN_NAME: { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 466 | isolateFile: "isolate_win_toolchain.isolate", |
| 467 | cipdPkg: "win_toolchain", |
Kevin Lubick | 814b149 | 2017-11-29 14:45:14 -0500 | [diff] [blame] | 468 | }, |
| 469 | ISOLATE_WIN_VULKAN_SDK_NAME: { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 470 | isolateFile: "isolate_win_vulkan_sdk.isolate", |
| 471 | cipdPkg: "win_vulkan_sdk", |
Kevin Lubick | 814b149 | 2017-11-29 14:45:14 -0500 | [diff] [blame] | 472 | }, |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 473 | } |
| 474 | |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 475 | // bundleRecipes generates the task to bundle and isolate the recipes. |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 476 | func isolateCIPDAsset(b *specs.TasksCfgBuilder, name string) string { |
| 477 | b.MustAddTask(name, &specs.TaskSpec{ |
| 478 | CipdPackages: []*specs.CipdPackage{ |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 479 | b.MustGetCipdPackageFromAsset(ISOLATE_ASSET_MAPPING[name].cipdPkg), |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 480 | }, |
| 481 | Dimensions: linuxGceDimensions(), |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 482 | Isolate: relpath(ISOLATE_ASSET_MAPPING[name].isolateFile), |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 483 | Priority: 0.7, |
| 484 | }) |
| 485 | return name |
| 486 | } |
| 487 | |
Kevin Lubick | 9018952 | 2017-05-15 08:30:27 -0400 | [diff] [blame] | 488 | // getIsolatedCIPDDeps returns the slice of Isolate_* tasks a given task needs. |
| 489 | // This allows us to save time on I/O bound bots, like the RPIs. |
| 490 | func getIsolatedCIPDDeps(parts map[string]string) []string { |
| 491 | deps := []string{} |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 492 | // Only do this on the RPIs for now. Other, faster machines shouldn't see much |
| 493 | // benefit and we don't need the extra complexity, for now |
Kevin Lubick | 9018952 | 2017-05-15 08:30:27 -0400 | [diff] [blame] | 494 | rpiOS := []string{"Android", "ChromeOS", "iOS"} |
| 495 | |
| 496 | if o := parts["os"]; strings.Contains(o, "Chromecast") { |
| 497 | // Chromecasts don't have enough disk space to fit all of the content, |
| 498 | // so we do a subset of the skps. |
| 499 | deps = append(deps, ISOLATE_SKP_NAME) |
| 500 | } else if e := parts["extra_config"]; strings.Contains(e, "Skpbench") { |
| 501 | // Skpbench only needs skps |
| 502 | deps = append(deps, ISOLATE_SKP_NAME) |
| 503 | } else if util.In(o, rpiOS) { |
| 504 | deps = append(deps, ISOLATE_SKP_NAME) |
| 505 | deps = append(deps, ISOLATE_SVG_NAME) |
| 506 | deps = append(deps, ISOLATE_SKIMAGE_NAME) |
| 507 | } |
| 508 | |
| 509 | return deps |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 510 | } |
| 511 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 512 | // compile generates a compile task. Returns the name of the last task in the |
| 513 | // generated chain of tasks, which the Job should add as a dependency. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 514 | func compile(b *specs.TasksCfgBuilder, name string, parts map[string]string) string { |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 515 | // Collect the necessary CIPD packages. |
| 516 | pkgs := []*specs.CipdPackage{} |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 517 | deps := []string{} |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 518 | |
| 519 | // Android bots require a toolchain. |
| 520 | if strings.Contains(name, "Android") { |
Ravi Mistry | 5e96742 | 2018-02-01 13:38:13 -0500 | [diff] [blame] | 521 | if parts["extra_config"] == "Android_Framework" { |
| 522 | // Do not need a toolchain when building the |
| 523 | // Android Framework. |
| 524 | } else if strings.Contains(name, "Mac") { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 525 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("android_ndk_darwin")) |
Mike Klein | 86c2c0f | 2016-11-02 13:13:16 -0400 | [diff] [blame] | 526 | } else if strings.Contains(name, "Win") { |
Mike Klein | e9215f0 | 2016-11-02 15:44:26 -0400 | [diff] [blame] | 527 | pkg := b.MustGetCipdPackageFromAsset("android_ndk_windows") |
| 528 | pkg.Path = "n" |
| 529 | pkgs = append(pkgs, pkg) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 530 | } else { |
Kevin Lubick | 814b149 | 2017-11-29 14:45:14 -0500 | [diff] [blame] | 531 | deps = append(deps, isolateCIPDAsset(b, ISOLATE_NDK_LINUX_NAME)) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 532 | } |
Kevin Lubick | dcd2a90 | 2017-03-08 14:01:01 -0500 | [diff] [blame] | 533 | } else if strings.Contains(name, "Chromecast") { |
| 534 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("cast_toolchain")) |
Kevin Lubick | ffce079 | 2017-05-24 15:30:35 -0400 | [diff] [blame] | 535 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("chromebook_arm_gles")) |
Kevin Lubick | 261ea19 | 2017-04-05 07:32:45 -0400 | [diff] [blame] | 536 | } else if strings.Contains(name, "Chromebook") { |
| 537 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("clang_linux")) |
Kevin Lubick | b718fbb | 2017-11-02 09:34:08 -0400 | [diff] [blame] | 538 | if parts["target_arch"] == "x86_64" { |
| 539 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("chromebook_x86_64_gles")) |
| 540 | } else if parts["target_arch"] == "arm" { |
| 541 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("armhf_sysroot")) |
| 542 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("chromebook_arm_gles")) |
| 543 | } |
Eric Boren | bb198fb | 2017-06-28 11:45:54 -0400 | [diff] [blame] | 544 | } else if strings.Contains(name, "Debian") { |
Kevin Lubick | 9c7dcac | 2017-01-18 09:24:56 -0500 | [diff] [blame] | 545 | if strings.Contains(name, "Clang") { |
| 546 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("clang_linux")) |
| 547 | } |
| 548 | if strings.Contains(name, "Vulkan") { |
| 549 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("linux_vulkan_sdk")) |
| 550 | } |
Kevin Lubick | ebf648e | 2017-09-21 13:45:16 -0400 | [diff] [blame] | 551 | if strings.Contains(name, "EMCC") { |
| 552 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("emscripten_sdk")) |
| 553 | } |
Mike Klein | 27dcee1 | 2016-11-09 16:31:42 -0500 | [diff] [blame] | 554 | } else if strings.Contains(name, "Win") { |
Kevin Lubick | 814b149 | 2017-11-29 14:45:14 -0500 | [diff] [blame] | 555 | deps = append(deps, isolateCIPDAsset(b, ISOLATE_WIN_TOOLCHAIN_NAME)) |
Mike Klein | 8e3c42b | 2017-07-31 14:57:20 -0400 | [diff] [blame] | 556 | if strings.Contains(name, "Clang") { |
| 557 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("clang_win")) |
| 558 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 559 | if strings.Contains(name, "Vulkan") { |
Kevin Lubick | 814b149 | 2017-11-29 14:45:14 -0500 | [diff] [blame] | 560 | deps = append(deps, isolateCIPDAsset(b, ISOLATE_WIN_VULKAN_SDK_NAME)) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 561 | } |
| 562 | } |
| 563 | |
Stephan Altmueller | 5f3b940 | 2017-03-20 13:38:45 -0400 | [diff] [blame] | 564 | dimensions := swarmDimensions(parts) |
Stephan Altmueller | 5f3b940 | 2017-03-20 13:38:45 -0400 | [diff] [blame] | 565 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 566 | // Add the task. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 567 | b.MustAddTask(name, &specs.TaskSpec{ |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 568 | CipdPackages: pkgs, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 569 | Dimensions: dimensions, |
| 570 | Dependencies: deps, |
| 571 | ExtraArgs: []string{ |
| 572 | "--workdir", "../../..", "compile", |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 573 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 574 | fmt.Sprintf("buildername=%s", name), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 575 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 576 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 577 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
borenet | 98b2e7a | 2016-10-13 06:23:45 -0700 | [diff] [blame] | 578 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 579 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 580 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 581 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 582 | Isolate: relpath("compile_skia.isolate"), |
| 583 | Priority: 0.8, |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 584 | }) |
Eric Boren | 8615fe5 | 2016-12-12 14:30:12 -0500 | [diff] [blame] | 585 | // All compile tasks are runnable as their own Job. Assert that the Job |
| 586 | // is listed in JOBS. |
| 587 | if !util.In(name, JOBS) { |
| 588 | glog.Fatalf("Job %q is missing from the JOBS list!", name) |
| 589 | } |
Ravi Mistry | 6f13622 | 2017-12-12 17:08:24 -0500 | [diff] [blame] | 590 | |
| 591 | // Upload the skiaserve binary only for Linux Android compile bots. |
| 592 | // See skbug.com/7399 for context. |
| 593 | if parts["configuration"] == "Release" && |
| 594 | parts["extra_config"] == "Android" && |
| 595 | !strings.Contains(parts["os"], "Win") && |
| 596 | !strings.Contains(parts["os"], "Mac") { |
| 597 | uploadName := fmt.Sprintf("%s%s%s", PREFIX_UPLOAD, jobNameSchema.Sep, name) |
| 598 | b.MustAddTask(uploadName, &specs.TaskSpec{ |
| 599 | Dependencies: []string{name}, |
| 600 | Dimensions: linuxGceDimensions(), |
| 601 | ExtraArgs: []string{ |
| 602 | "--workdir", "../../..", "upload_skiaserve", |
| 603 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 604 | fmt.Sprintf("buildername=%s", name), |
| 605 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 606 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
| 607 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
| 608 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 609 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 610 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 611 | }, |
| 612 | // We're using the same isolate as upload_dm_results |
| 613 | Isolate: relpath("upload_dm_results.isolate"), |
| 614 | Priority: 0.8, |
| 615 | }) |
| 616 | return uploadName |
| 617 | } |
| 618 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 619 | return name |
| 620 | } |
| 621 | |
| 622 | // recreateSKPs generates a RecreateSKPs task. Returns the name of the last |
| 623 | // task in the generated chain of tasks, which the Job should add as a |
| 624 | // dependency. |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 625 | func recreateSKPs(b *specs.TasksCfgBuilder, name string) string { |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 626 | b.MustAddTask(name, &specs.TaskSpec{ |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 627 | CipdPackages: []*specs.CipdPackage{b.MustGetCipdPackageFromAsset("go")}, |
| 628 | Dimensions: linuxGceDimensions(), |
| 629 | ExecutionTimeout: 4 * time.Hour, |
| 630 | ExtraArgs: []string{ |
| 631 | "--workdir", "../../..", "recreate_skps", |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 632 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 633 | fmt.Sprintf("buildername=%s", name), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 634 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 635 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 636 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 637 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 638 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 639 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 640 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 641 | IoTimeout: 40 * time.Minute, |
| 642 | Isolate: relpath("compile_skia.isolate"), |
| 643 | Priority: 0.8, |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 644 | }) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 645 | return name |
| 646 | } |
| 647 | |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 648 | // updateMetaConfig generates a UpdateMetaConfig task. Returns the name of the |
| 649 | // last task in the generated chain of tasks, which the Job should add as a |
| 650 | // dependency. |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 651 | func updateMetaConfig(b *specs.TasksCfgBuilder, name string) string { |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 652 | b.MustAddTask(name, &specs.TaskSpec{ |
Stephan Altmueller | ddad85b | 2017-05-19 13:08:19 -0400 | [diff] [blame] | 653 | CipdPackages: []*specs.CipdPackage{}, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 654 | Dimensions: linuxGceDimensions(), |
| 655 | ExtraArgs: []string{ |
| 656 | "--workdir", "../../..", "update_meta_config", |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 657 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 658 | fmt.Sprintf("buildername=%s", name), |
| 659 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 660 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
| 661 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
| 662 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 663 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 664 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 665 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 666 | Isolate: relpath("meta_config.isolate"), |
| 667 | Priority: 0.8, |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 668 | }) |
| 669 | return name |
| 670 | } |
| 671 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 672 | // ctSKPs generates a CT SKPs task. Returns the name of the last task in the |
| 673 | // generated chain of tasks, which the Job should add as a dependency. |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 674 | func ctSKPs(b *specs.TasksCfgBuilder, name string) string { |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 675 | b.MustAddTask(name, &specs.TaskSpec{ |
Ben Wagner | 21c3fb9 | 2017-08-04 14:13:27 -0400 | [diff] [blame] | 676 | CipdPackages: []*specs.CipdPackage{}, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 677 | Dimensions: []string{ |
| 678 | "pool:SkiaCT", |
| 679 | fmt.Sprintf("os:%s", DEFAULT_OS_LINUX_GCE), |
| 680 | }, |
| 681 | ExecutionTimeout: 24 * time.Hour, |
| 682 | ExtraArgs: []string{ |
| 683 | "--workdir", "../../..", "ct_skps", |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 684 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 685 | fmt.Sprintf("buildername=%s", name), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 686 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 687 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 688 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 689 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 690 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 691 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 692 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 693 | IoTimeout: time.Hour, |
| 694 | Isolate: relpath("ct_skps_skia.isolate"), |
| 695 | Priority: 0.8, |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 696 | }) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 697 | return name |
| 698 | } |
| 699 | |
Eric Boren | f7928b4 | 2017-07-28 07:35:28 -0400 | [diff] [blame] | 700 | // checkGeneratedFiles verifies that no generated SKSL files have been edited |
| 701 | // by hand. |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 702 | func checkGeneratedFiles(b *specs.TasksCfgBuilder, name string) string { |
Eric Boren | f7928b4 | 2017-07-28 07:35:28 -0400 | [diff] [blame] | 703 | b.MustAddTask(name, &specs.TaskSpec{ |
| 704 | CipdPackages: []*specs.CipdPackage{}, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 705 | Dimensions: linuxGceDimensions(), |
| 706 | ExtraArgs: []string{ |
| 707 | "--workdir", "../../..", "check_generated_files", |
Eric Boren | f7928b4 | 2017-07-28 07:35:28 -0400 | [diff] [blame] | 708 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 709 | fmt.Sprintf("buildername=%s", name), |
| 710 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 711 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
| 712 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
| 713 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 714 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 715 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 716 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 717 | Isolate: relpath("compile_skia.isolate"), |
| 718 | Priority: 0.8, |
Eric Boren | f7928b4 | 2017-07-28 07:35:28 -0400 | [diff] [blame] | 719 | }) |
| 720 | return name |
| 721 | } |
| 722 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 723 | // housekeeper generates a Housekeeper task. Returns the name of the last task |
| 724 | // in the generated chain of tasks, which the Job should add as a dependency. |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 725 | func housekeeper(b *specs.TasksCfgBuilder, name, compileTaskName string) string { |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 726 | b.MustAddTask(name, &specs.TaskSpec{ |
Eric Boren | 22f5ef7 | 2016-12-02 11:01:33 -0500 | [diff] [blame] | 727 | CipdPackages: []*specs.CipdPackage{b.MustGetCipdPackageFromAsset("go")}, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 728 | Dependencies: []string{compileTaskName}, |
| 729 | Dimensions: linuxGceDimensions(), |
| 730 | ExtraArgs: []string{ |
| 731 | "--workdir", "../../..", "housekeeper", |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 732 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 733 | fmt.Sprintf("buildername=%s", name), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 734 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 735 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 736 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 737 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 738 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 739 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 740 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 741 | Isolate: relpath("housekeeper_skia.isolate"), |
| 742 | Priority: 0.8, |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 743 | }) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 744 | return name |
| 745 | } |
| 746 | |
Ravi Mistry | edc4f3e | 2017-12-08 12:58:20 -0500 | [diff] [blame] | 747 | // bookmaker generates a Bookmaker task. Returns the name of the last task |
| 748 | // in the generated chain of tasks, which the Job should add as a dependency. |
| 749 | func bookmaker(b *specs.TasksCfgBuilder, name, compileTaskName string) string { |
| 750 | b.MustAddTask(name, &specs.TaskSpec{ |
| 751 | CipdPackages: []*specs.CipdPackage{b.MustGetCipdPackageFromAsset("go")}, |
| 752 | Dependencies: []string{compileTaskName}, |
| 753 | Dimensions: linuxGceDimensions(), |
| 754 | ExtraArgs: []string{ |
| 755 | "--workdir", "../../..", "bookmaker", |
| 756 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 757 | fmt.Sprintf("buildername=%s", name), |
| 758 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 759 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
| 760 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
| 761 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 762 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 763 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 764 | }, |
| 765 | Isolate: relpath("compile_skia.isolate"), |
| 766 | Priority: 0.8, |
| 767 | ExecutionTimeout: 2 * time.Hour, |
| 768 | IoTimeout: 2 * time.Hour, |
| 769 | }) |
| 770 | return name |
| 771 | } |
| 772 | |
Ravi Mistry | 5e96742 | 2018-02-01 13:38:13 -0500 | [diff] [blame] | 773 | // androidFrameworkCompile generates an Android Framework Compile task. Returns |
| 774 | // the name of the last task in the generated chain of tasks, which the Job |
| 775 | // should add as a dependency. |
| 776 | func androidFrameworkCompile(b *specs.TasksCfgBuilder, name string) string { |
| 777 | b.MustAddTask(name, &specs.TaskSpec{ |
| 778 | Dimensions: linuxGceDimensions(), |
| 779 | ExtraArgs: []string{ |
| 780 | "--workdir", "../../..", "android_compile", |
| 781 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 782 | fmt.Sprintf("buildername=%s", name), |
| 783 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 784 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
| 785 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
| 786 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 787 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 788 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 789 | }, |
| 790 | Isolate: relpath("compile_skia.isolate"), |
| 791 | Priority: 0.8, |
| 792 | }) |
| 793 | return name |
| 794 | } |
| 795 | |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 796 | // infra generates an infra_tests task. Returns the name of the last task in the |
| 797 | // generated chain of tasks, which the Job should add as a dependency. |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 798 | func infra(b *specs.TasksCfgBuilder, name string) string { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 799 | b.MustAddTask(name, &specs.TaskSpec{ |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 800 | CipdPackages: []*specs.CipdPackage{b.MustGetCipdPackageFromAsset("go")}, |
| 801 | Dimensions: linuxGceDimensions(), |
| 802 | ExtraArgs: []string{ |
| 803 | "--workdir", "../../..", "infra", |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 804 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 805 | fmt.Sprintf("buildername=%s", name), |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 806 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 807 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 808 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 809 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 810 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 811 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 812 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 813 | Isolate: relpath("infra_skia.isolate"), |
| 814 | Priority: 0.8, |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 815 | }) |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 816 | return name |
| 817 | } |
| 818 | |
Yuqian Li | 4a577af | 2018-01-05 11:13:43 -0500 | [diff] [blame] | 819 | func getParentRevisionName(compileTaskName string, parts map[string]string) string { |
| 820 | if parts["extra_config"] == "" { |
| 821 | return compileTaskName + "-ParentRevision" |
| 822 | } else { |
| 823 | return compileTaskName + "_ParentRevision" |
| 824 | } |
| 825 | } |
| 826 | |
Yuqian Li | c81aaaa | 2017-10-16 12:24:43 -0400 | [diff] [blame] | 827 | // calmbench generates a calmbench task. Returns the name of the last task in the |
| 828 | // generated chain of tasks, which the Job should add as a dependency. |
Yuqian Li | 4a577af | 2018-01-05 11:13:43 -0500 | [diff] [blame] | 829 | func calmbench(b *specs.TasksCfgBuilder, name string, parts map[string]string, compileTaskName string, compileParentName string) string { |
Yuqian Li | c81aaaa | 2017-10-16 12:24:43 -0400 | [diff] [blame] | 830 | s := &specs.TaskSpec{ |
Yuqian Li | 4a577af | 2018-01-05 11:13:43 -0500 | [diff] [blame] | 831 | Dependencies: []string{compileTaskName, compileParentName}, |
Yuqian Li | c81aaaa | 2017-10-16 12:24:43 -0400 | [diff] [blame] | 832 | CipdPackages: []*specs.CipdPackage{b.MustGetCipdPackageFromAsset("clang_linux")}, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 833 | Dimensions: swarmDimensions(parts), |
| 834 | ExtraArgs: []string{ |
| 835 | "--workdir", "../../..", "calmbench", |
Yuqian Li | c81aaaa | 2017-10-16 12:24:43 -0400 | [diff] [blame] | 836 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 837 | fmt.Sprintf("buildername=%s", name), |
| 838 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 839 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
| 840 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
| 841 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 842 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 843 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 844 | }, |
Yuqian Li | 4a577af | 2018-01-05 11:13:43 -0500 | [diff] [blame] | 845 | Isolate: relpath("calmbench.isolate"), |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 846 | Priority: 0.8, |
Yuqian Li | c81aaaa | 2017-10-16 12:24:43 -0400 | [diff] [blame] | 847 | } |
| 848 | |
| 849 | s.Dependencies = append(s.Dependencies, ISOLATE_SKP_NAME, ISOLATE_SVG_NAME) |
| 850 | |
| 851 | b.MustAddTask(name, s) |
| 852 | |
Yuqian Li | 2ebf3d1 | 2017-10-24 09:43:21 -0400 | [diff] [blame] | 853 | // Upload results if necessary. |
| 854 | if strings.Contains(name, "Release") && doUpload(name) { |
| 855 | uploadName := fmt.Sprintf("%s%s%s", PREFIX_UPLOAD, jobNameSchema.Sep, name) |
| 856 | b.MustAddTask(uploadName, &specs.TaskSpec{ |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 857 | Dependencies: []string{name}, |
| 858 | Dimensions: linuxGceDimensions(), |
| 859 | ExtraArgs: []string{ |
| 860 | "--workdir", "../../..", "upload_calmbench_results", |
Yuqian Li | 2ebf3d1 | 2017-10-24 09:43:21 -0400 | [diff] [blame] | 861 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 862 | fmt.Sprintf("buildername=%s", name), |
| 863 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 864 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
| 865 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
| 866 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 867 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 868 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 869 | fmt.Sprintf("gs_bucket=%s", CONFIG.GsBucketCalm), |
| 870 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 871 | // We're using the same isolate as upload_nano_results |
| 872 | Isolate: relpath("upload_nano_results.isolate"), |
| 873 | Priority: 0.8, |
Yuqian Li | 2ebf3d1 | 2017-10-24 09:43:21 -0400 | [diff] [blame] | 874 | }) |
| 875 | return uploadName |
| 876 | } |
| 877 | |
Yuqian Li | c81aaaa | 2017-10-16 12:24:43 -0400 | [diff] [blame] | 878 | return name |
| 879 | } |
| 880 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 881 | // doUpload indicates whether the given Job should upload its results. |
| 882 | func doUpload(name string) bool { |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 883 | for _, s := range CONFIG.NoUpload { |
| 884 | m, err := regexp.MatchString(s, name) |
| 885 | if err != nil { |
| 886 | glog.Fatal(err) |
| 887 | } |
| 888 | if m { |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 889 | return false |
| 890 | } |
| 891 | } |
| 892 | return true |
| 893 | } |
| 894 | |
| 895 | // test generates a Test task. Returns the name of the last task in the |
| 896 | // generated chain of tasks, which the Job should add as a dependency. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 897 | func test(b *specs.TasksCfgBuilder, name string, parts map[string]string, compileTaskName string, pkgs []*specs.CipdPackage) string { |
Kevin Lubick | 4f0f933 | 2018-01-12 14:31:48 -0500 | [diff] [blame] | 898 | deps := []string{compileTaskName} |
| 899 | if strings.Contains(name, "Android_ASAN") { |
| 900 | deps = append(deps, isolateCIPDAsset(b, ISOLATE_NDK_LINUX_NAME)) |
| 901 | } |
| 902 | |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 903 | s := &specs.TaskSpec{ |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 904 | CipdPackages: pkgs, |
Kevin Lubick | 4f0f933 | 2018-01-12 14:31:48 -0500 | [diff] [blame] | 905 | Dependencies: deps, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 906 | Dimensions: swarmDimensions(parts), |
| 907 | ExecutionTimeout: 4 * time.Hour, |
| 908 | Expiration: 20 * time.Hour, |
| 909 | ExtraArgs: []string{ |
| 910 | "--workdir", "../../..", "test", |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 911 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
Eric Boren | 9a9e387 | 2017-11-29 12:33:22 -0500 | [diff] [blame] | 912 | fmt.Sprintf("buildbucket_build_id=%s", specs.PLACEHOLDER_BUILDBUCKET_BUILD_ID), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 913 | fmt.Sprintf("buildername=%s", name), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 914 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 915 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 916 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
borenet | 98b2e7a | 2016-10-13 06:23:45 -0700 | [diff] [blame] | 917 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 918 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 919 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 920 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 921 | IoTimeout: 40 * time.Minute, |
| 922 | Isolate: relpath("test_skia.isolate"), |
| 923 | MaxAttempts: 1, |
| 924 | Priority: 0.8, |
| 925 | } |
| 926 | if useBundledRecipes(parts) { |
| 927 | s.Dependencies = append(s.Dependencies, BUNDLE_RECIPES_NAME) |
| 928 | if strings.Contains(parts["os"], "Win") { |
| 929 | s.Isolate = relpath("test_skia_bundled_win.isolate") |
| 930 | } else { |
| 931 | s.Isolate = relpath("test_skia_bundled_unix.isolate") |
| 932 | } |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 933 | } |
Kevin Lubick | 9018952 | 2017-05-15 08:30:27 -0400 | [diff] [blame] | 934 | if deps := getIsolatedCIPDDeps(parts); len(deps) > 0 { |
| 935 | s.Dependencies = append(s.Dependencies, deps...) |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 936 | } |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 937 | if strings.Contains(parts["extra_config"], "Valgrind") { |
| 938 | s.ExecutionTimeout = 9 * time.Hour |
| 939 | s.Expiration = 48 * time.Hour |
| 940 | s.IoTimeout = time.Hour |
Eric Boren | d696df7 | 2017-05-31 15:09:10 -0400 | [diff] [blame] | 941 | s.CipdPackages = append(s.CipdPackages, b.MustGetCipdPackageFromAsset("valgrind")) |
Kevin Lubick | ea61382 | 2017-12-04 10:20:23 -0500 | [diff] [blame] | 942 | s.Dimensions = append(s.Dimensions, "valgrind:1") |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 943 | } else if strings.Contains(parts["extra_config"], "MSAN") { |
| 944 | s.ExecutionTimeout = 9 * time.Hour |
Ben Wagner | a6b2ba2 | 2017-06-08 10:34:17 -0400 | [diff] [blame] | 945 | } else if parts["arch"] == "x86" && parts["configuration"] == "Debug" { |
| 946 | // skia:6737 |
| 947 | s.ExecutionTimeout = 6 * time.Hour |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 948 | } |
Eric Boren | fd4d60e | 2017-09-15 10:35:44 -0400 | [diff] [blame] | 949 | iid := internalHardwareLabel(parts) |
Eric Boren | 053d7a4 | 2017-09-15 08:35:31 -0400 | [diff] [blame] | 950 | if iid != nil { |
Eric Boren | 4dc4aaf | 2017-09-15 14:09:07 -0400 | [diff] [blame] | 951 | s.ExtraArgs = append(s.ExtraArgs, fmt.Sprintf("internal_hardware_label=%d", *iid)) |
Eric Boren | 053d7a4 | 2017-09-15 08:35:31 -0400 | [diff] [blame] | 952 | } |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 953 | b.MustAddTask(name, s) |
| 954 | |
Kevin Lubick | c795a4c | 2017-10-09 15:26:19 -0400 | [diff] [blame] | 955 | // Upload results if necessary. TODO(kjlubick): If we do coverage analysis at the same |
| 956 | // time as normal tests (which would be nice), cfg.json needs to have Coverage removed. |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 957 | if doUpload(name) { |
| 958 | uploadName := fmt.Sprintf("%s%s%s", PREFIX_UPLOAD, jobNameSchema.Sep, name) |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 959 | b.MustAddTask(uploadName, &specs.TaskSpec{ |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 960 | Dependencies: []string{name}, |
| 961 | Dimensions: linuxGceDimensions(), |
| 962 | ExtraArgs: []string{ |
| 963 | "--workdir", "../../..", "upload_dm_results", |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 964 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 965 | fmt.Sprintf("buildername=%s", name), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 966 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 967 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 968 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
borenet | 98b2e7a | 2016-10-13 06:23:45 -0700 | [diff] [blame] | 969 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 970 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 971 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
Eric Boren | 965861b | 2017-02-06 15:38:41 -0500 | [diff] [blame] | 972 | fmt.Sprintf("gs_bucket=%s", CONFIG.GsBucketGm), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 973 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 974 | Isolate: relpath("upload_dm_results.isolate"), |
| 975 | Priority: 0.8, |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 976 | }) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 977 | return uploadName |
Kevin Lubick | 32f318b | 2017-10-17 13:40:52 -0400 | [diff] [blame] | 978 | } |
| 979 | |
| 980 | return name |
| 981 | } |
| 982 | |
| 983 | func coverage(b *specs.TasksCfgBuilder, name string, parts map[string]string, compileTaskName string, pkgs []*specs.CipdPackage) string { |
| 984 | shards := 1 |
| 985 | deps := []string{} |
| 986 | |
| 987 | tf := parts["test_filter"] |
| 988 | if strings.Contains(tf, "Shard") { |
| 989 | // Expected Shard_NN |
| 990 | shardstr := strings.Split(tf, "_")[1] |
| 991 | var err error |
| 992 | shards, err = strconv.Atoi(shardstr) |
| 993 | if err != nil { |
| 994 | glog.Fatalf("Expected int for number of shards %q in %s: %s", shardstr, name, err) |
| 995 | } |
| 996 | } |
| 997 | for i := 0; i < shards; i++ { |
| 998 | n := strings.Replace(name, tf, fmt.Sprintf("shard_%02d_%02d", i, shards), 1) |
| 999 | s := &specs.TaskSpec{ |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1000 | CipdPackages: pkgs, |
| 1001 | Dependencies: []string{compileTaskName}, |
| 1002 | Dimensions: swarmDimensions(parts), |
| 1003 | ExecutionTimeout: 4 * time.Hour, |
| 1004 | Expiration: 20 * time.Hour, |
| 1005 | ExtraArgs: []string{ |
| 1006 | "--workdir", "../../..", "test", |
Kevin Lubick | c795a4c | 2017-10-09 15:26:19 -0400 | [diff] [blame] | 1007 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
Kevin Lubick | 32f318b | 2017-10-17 13:40:52 -0400 | [diff] [blame] | 1008 | fmt.Sprintf("buildername=%s", n), |
Kevin Lubick | c795a4c | 2017-10-09 15:26:19 -0400 | [diff] [blame] | 1009 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 1010 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
| 1011 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
| 1012 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 1013 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 1014 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
Kevin Lubick | c795a4c | 2017-10-09 15:26:19 -0400 | [diff] [blame] | 1015 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1016 | IoTimeout: 40 * time.Minute, |
| 1017 | Isolate: relpath("test_skia.isolate"), |
| 1018 | MaxAttempts: 1, |
| 1019 | Priority: 0.8, |
| 1020 | } |
| 1021 | if useBundledRecipes(parts) { |
| 1022 | s.Dependencies = append(s.Dependencies, BUNDLE_RECIPES_NAME) |
| 1023 | if strings.Contains(parts["os"], "Win") { |
| 1024 | s.Isolate = relpath("test_skia_bundled_win.isolate") |
| 1025 | } else { |
| 1026 | s.Isolate = relpath("test_skia_bundled_unix.isolate") |
| 1027 | } |
Kevin Lubick | 32f318b | 2017-10-17 13:40:52 -0400 | [diff] [blame] | 1028 | } |
| 1029 | if deps := getIsolatedCIPDDeps(parts); len(deps) > 0 { |
| 1030 | s.Dependencies = append(s.Dependencies, deps...) |
| 1031 | } |
| 1032 | b.MustAddTask(n, s) |
| 1033 | deps = append(deps, n) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1034 | } |
Kevin Lubick | c795a4c | 2017-10-09 15:26:19 -0400 | [diff] [blame] | 1035 | |
Kevin Lubick | 32f318b | 2017-10-17 13:40:52 -0400 | [diff] [blame] | 1036 | uploadName := fmt.Sprintf("%s%s%s", "Upload", jobNameSchema.Sep, name) |
| 1037 | // We need clang_linux to get access to the llvm-profdata and llvm-cov binaries |
| 1038 | // which are used to deal with the raw coverage data output by the Test step. |
| 1039 | pkgs = append([]*specs.CipdPackage{}, b.MustGetCipdPackageFromAsset("clang_linux")) |
| 1040 | deps = append(deps, compileTaskName) |
| 1041 | |
| 1042 | b.MustAddTask(uploadName, &specs.TaskSpec{ |
| 1043 | // A dependency on compileTaskName makes the TaskScheduler link the |
| 1044 | // isolated output of the compile step to the input of the upload step, |
| 1045 | // which gives us access to the instrumented binary. The binary is |
| 1046 | // needed to figure out symbol names and line numbers. |
| 1047 | Dependencies: deps, |
| 1048 | Dimensions: linuxGceDimensions(), |
| 1049 | CipdPackages: pkgs, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1050 | ExtraArgs: []string{ |
| 1051 | "--workdir", "../../..", "upload_coverage_results", |
Kevin Lubick | 32f318b | 2017-10-17 13:40:52 -0400 | [diff] [blame] | 1052 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 1053 | fmt.Sprintf("buildername=%s", name), |
| 1054 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 1055 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
| 1056 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
| 1057 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 1058 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 1059 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 1060 | fmt.Sprintf("gs_bucket=%s", CONFIG.GsBucketCoverage), |
| 1061 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1062 | Isolate: relpath("upload_coverage_results.isolate"), |
Kevin Lubick | 32f318b | 2017-10-17 13:40:52 -0400 | [diff] [blame] | 1063 | Priority: 0.8, |
| 1064 | }) |
| 1065 | return uploadName |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1066 | } |
| 1067 | |
| 1068 | // perf generates a Perf task. Returns the name of the last task in the |
| 1069 | // generated chain of tasks, which the Job should add as a dependency. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 1070 | func perf(b *specs.TasksCfgBuilder, name string, parts map[string]string, compileTaskName string, pkgs []*specs.CipdPackage) string { |
Eric Boren | 768f52f | 2017-04-10 08:14:33 -0400 | [diff] [blame] | 1071 | recipe := "perf" |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1072 | isolate := relpath("perf_skia.isolate") |
Kevin Lubick | b03b5ac | 2016-11-14 13:42:27 -0500 | [diff] [blame] | 1073 | if strings.Contains(parts["extra_config"], "Skpbench") { |
Eric Boren | 768f52f | 2017-04-10 08:14:33 -0400 | [diff] [blame] | 1074 | recipe = "skpbench" |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1075 | isolate = relpath("skpbench_skia.isolate") |
| 1076 | if useBundledRecipes(parts) { |
| 1077 | if strings.Contains(parts["os"], "Win") { |
| 1078 | isolate = relpath("skpbench_skia_bundled_win.isolate") |
| 1079 | } else { |
| 1080 | isolate = relpath("skpbench_skia_bundled_unix.isolate") |
| 1081 | } |
| 1082 | } |
| 1083 | } else if useBundledRecipes(parts) { |
| 1084 | if strings.Contains(parts["os"], "Win") { |
| 1085 | isolate = relpath("perf_skia_bundled_win.isolate") |
| 1086 | } else { |
| 1087 | isolate = relpath("perf_skia_bundled_unix.isolate") |
| 1088 | } |
Kevin Lubick | b03b5ac | 2016-11-14 13:42:27 -0500 | [diff] [blame] | 1089 | } |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 1090 | s := &specs.TaskSpec{ |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1091 | CipdPackages: pkgs, |
| 1092 | Dependencies: []string{compileTaskName}, |
| 1093 | Dimensions: swarmDimensions(parts), |
| 1094 | ExecutionTimeout: 4 * time.Hour, |
| 1095 | Expiration: 20 * time.Hour, |
| 1096 | ExtraArgs: []string{ |
| 1097 | "--workdir", "../../..", recipe, |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 1098 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1099 | fmt.Sprintf("buildername=%s", name), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1100 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 1101 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 1102 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
borenet | 98b2e7a | 2016-10-13 06:23:45 -0700 | [diff] [blame] | 1103 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 1104 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 1105 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1106 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1107 | IoTimeout: 40 * time.Minute, |
| 1108 | Isolate: isolate, |
| 1109 | MaxAttempts: 1, |
| 1110 | Priority: 0.8, |
| 1111 | } |
| 1112 | if useBundledRecipes(parts) { |
| 1113 | s.Dependencies = append(s.Dependencies, BUNDLE_RECIPES_NAME) |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 1114 | } |
Kevin Lubick | 9018952 | 2017-05-15 08:30:27 -0400 | [diff] [blame] | 1115 | if deps := getIsolatedCIPDDeps(parts); len(deps) > 0 { |
| 1116 | s.Dependencies = append(s.Dependencies, deps...) |
| 1117 | } |
| 1118 | |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 1119 | if strings.Contains(parts["extra_config"], "Valgrind") { |
| 1120 | s.ExecutionTimeout = 9 * time.Hour |
| 1121 | s.Expiration = 48 * time.Hour |
| 1122 | s.IoTimeout = time.Hour |
Eric Boren | c5a073d | 2017-06-01 07:13:33 -0400 | [diff] [blame] | 1123 | s.CipdPackages = append(s.CipdPackages, b.MustGetCipdPackageFromAsset("valgrind")) |
Kevin Lubick | ea61382 | 2017-12-04 10:20:23 -0500 | [diff] [blame] | 1124 | s.Dimensions = append(s.Dimensions, "valgrind:1") |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 1125 | } else if strings.Contains(parts["extra_config"], "MSAN") { |
| 1126 | s.ExecutionTimeout = 9 * time.Hour |
Ben Wagner | a6b2ba2 | 2017-06-08 10:34:17 -0400 | [diff] [blame] | 1127 | } else if parts["arch"] == "x86" && parts["configuration"] == "Debug" { |
| 1128 | // skia:6737 |
| 1129 | s.ExecutionTimeout = 6 * time.Hour |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 1130 | } |
Eric Boren | fd4d60e | 2017-09-15 10:35:44 -0400 | [diff] [blame] | 1131 | iid := internalHardwareLabel(parts) |
Eric Boren | 053d7a4 | 2017-09-15 08:35:31 -0400 | [diff] [blame] | 1132 | if iid != nil { |
Eric Boren | 4dc4aaf | 2017-09-15 14:09:07 -0400 | [diff] [blame] | 1133 | s.ExtraArgs = append(s.ExtraArgs, fmt.Sprintf("internal_hardware_label=%d", *iid)) |
Eric Boren | 053d7a4 | 2017-09-15 08:35:31 -0400 | [diff] [blame] | 1134 | } |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 1135 | b.MustAddTask(name, s) |
| 1136 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1137 | // Upload results if necessary. |
| 1138 | if strings.Contains(name, "Release") && doUpload(name) { |
| 1139 | uploadName := fmt.Sprintf("%s%s%s", PREFIX_UPLOAD, jobNameSchema.Sep, name) |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 1140 | b.MustAddTask(uploadName, &specs.TaskSpec{ |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1141 | Dependencies: []string{name}, |
| 1142 | Dimensions: linuxGceDimensions(), |
| 1143 | ExtraArgs: []string{ |
| 1144 | "--workdir", "../../..", "upload_nano_results", |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 1145 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1146 | fmt.Sprintf("buildername=%s", name), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1147 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 1148 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 1149 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
borenet | 98b2e7a | 2016-10-13 06:23:45 -0700 | [diff] [blame] | 1150 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 1151 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 1152 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
Eric Boren | 965861b | 2017-02-06 15:38:41 -0500 | [diff] [blame] | 1153 | fmt.Sprintf("gs_bucket=%s", CONFIG.GsBucketNano), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1154 | }, |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1155 | Isolate: relpath("upload_nano_results.isolate"), |
| 1156 | Priority: 0.8, |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 1157 | }) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1158 | return uploadName |
| 1159 | } |
| 1160 | return name |
| 1161 | } |
| 1162 | |
| 1163 | // process generates tasks and jobs for the given job name. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 1164 | func process(b *specs.TasksCfgBuilder, name string) { |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1165 | deps := []string{} |
| 1166 | |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 1167 | // Bundle Recipes. |
| 1168 | if name == BUNDLE_RECIPES_NAME { |
| 1169 | deps = append(deps, bundleRecipes(b)) |
| 1170 | } |
| 1171 | |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 1172 | // Isolate CIPD assets. |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 1173 | if _, ok := ISOLATE_ASSET_MAPPING[name]; ok { |
| 1174 | deps = append(deps, isolateCIPDAsset(b, name)) |
| 1175 | } |
| 1176 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1177 | parts, err := jobNameSchema.ParseJobName(name) |
| 1178 | if err != nil { |
| 1179 | glog.Fatal(err) |
| 1180 | } |
| 1181 | |
| 1182 | // RecreateSKPs. |
| 1183 | if strings.Contains(name, "RecreateSKPs") { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1184 | deps = append(deps, recreateSKPs(b, name)) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1185 | } |
| 1186 | |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 1187 | // UpdateMetaConfig bot. |
| 1188 | if strings.Contains(name, "UpdateMetaConfig") { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1189 | deps = append(deps, updateMetaConfig(b, name)) |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 1190 | } |
| 1191 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1192 | // CT bots. |
| 1193 | if strings.Contains(name, "-CT_") { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1194 | deps = append(deps, ctSKPs(b, name)) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1195 | } |
| 1196 | |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 1197 | // Infra tests. |
| 1198 | if name == "Housekeeper-PerCommit-InfraTests" { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1199 | deps = append(deps, infra(b, name)) |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 1200 | } |
| 1201 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1202 | // Compile bots. |
| 1203 | if parts["role"] == "Build" { |
Ravi Mistry | 5e96742 | 2018-02-01 13:38:13 -0500 | [diff] [blame] | 1204 | if parts["extra_config"] == "Android_Framework" { |
| 1205 | // Android Framework compile tasks use a different recipe. |
| 1206 | deps = append(deps, androidFrameworkCompile(b, name)) |
| 1207 | } else { |
| 1208 | deps = append(deps, compile(b, name, parts)) |
| 1209 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1210 | } |
| 1211 | |
Eric Boren | f5a90e8 | 2016-11-15 15:18:20 -0500 | [diff] [blame] | 1212 | // Most remaining bots need a compile task. |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1213 | compileTaskName := deriveCompileTaskName(name, parts) |
borenet | 5238343 | 2016-10-17 10:17:53 -0700 | [diff] [blame] | 1214 | compileTaskParts, err := jobNameSchema.ParseJobName(compileTaskName) |
| 1215 | if err != nil { |
| 1216 | glog.Fatal(err) |
| 1217 | } |
Yuqian Li | 4a577af | 2018-01-05 11:13:43 -0500 | [diff] [blame] | 1218 | compileParentName := getParentRevisionName(compileTaskName, compileTaskParts) |
| 1219 | compileParentParts, err := jobNameSchema.ParseJobName(compileParentName) |
| 1220 | if err != nil { |
| 1221 | glog.Fatal(err) |
| 1222 | } |
| 1223 | |
Eric Boren | 628e78b | 2016-11-17 11:33:27 -0500 | [diff] [blame] | 1224 | // These bots do not need a compile task. |
Yuqian Li | 4a577af | 2018-01-05 11:13:43 -0500 | [diff] [blame] | 1225 | if parts["role"] != "Build" && |
Eric Boren | b8ab7f7 | 2017-04-10 11:00:09 -0400 | [diff] [blame] | 1226 | name != "Housekeeper-PerCommit-BundleRecipes" && |
Eric Boren | f5a90e8 | 2016-11-15 15:18:20 -0500 | [diff] [blame] | 1227 | name != "Housekeeper-PerCommit-InfraTests" && |
Eric Boren | f7928b4 | 2017-07-28 07:35:28 -0400 | [diff] [blame] | 1228 | name != "Housekeeper-PerCommit-CheckGeneratedFiles" && |
Ravi Mistry | 5e96742 | 2018-02-01 13:38:13 -0500 | [diff] [blame] | 1229 | !strings.Contains(name, "Android_Framework") && |
Eric Boren | 71b762f | 2016-11-30 14:05:16 -0500 | [diff] [blame] | 1230 | !strings.Contains(name, "RecreateSKPs") && |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 1231 | !strings.Contains(name, "UpdateMetaConfig") && |
Ben Wagner | 50b8468 | 2017-06-12 13:03:29 -0400 | [diff] [blame] | 1232 | !strings.Contains(name, "-CT_") && |
| 1233 | !strings.Contains(name, "Housekeeper-PerCommit-Isolate") { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 1234 | compile(b, compileTaskName, compileTaskParts) |
Ben Wagner | 4c39c0d | 2018-01-10 11:14:52 -0500 | [diff] [blame] | 1235 | if parts["role"] == "Calmbench" { |
Yuqian Li | 4a577af | 2018-01-05 11:13:43 -0500 | [diff] [blame] | 1236 | compile(b, compileParentName, compileParentParts) |
| 1237 | } |
borenet | 5238343 | 2016-10-17 10:17:53 -0700 | [diff] [blame] | 1238 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1239 | |
Eric Boren | f7928b4 | 2017-07-28 07:35:28 -0400 | [diff] [blame] | 1240 | // Housekeepers. |
Eric Boren | 22f5ef7 | 2016-12-02 11:01:33 -0500 | [diff] [blame] | 1241 | if name == "Housekeeper-PerCommit" { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1242 | deps = append(deps, housekeeper(b, name, compileTaskName)) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1243 | } |
Eric Boren | f7928b4 | 2017-07-28 07:35:28 -0400 | [diff] [blame] | 1244 | if name == "Housekeeper-PerCommit-CheckGeneratedFiles" { |
Eric Boren | 9d78afd | 2017-12-07 14:54:05 +0000 | [diff] [blame] | 1245 | deps = append(deps, checkGeneratedFiles(b, name)) |
Eric Boren | f7928b4 | 2017-07-28 07:35:28 -0400 | [diff] [blame] | 1246 | } |
Ravi Mistry | d4731e9 | 2018-01-02 14:54:43 -0500 | [diff] [blame] | 1247 | if strings.Contains(name, "Bookmaker") { |
Ravi Mistry | edc4f3e | 2017-12-08 12:58:20 -0500 | [diff] [blame] | 1248 | deps = append(deps, bookmaker(b, name, compileTaskName)) |
| 1249 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1250 | |
| 1251 | // Common assets needed by the remaining bots. |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 1252 | |
| 1253 | pkgs := []*specs.CipdPackage{} |
| 1254 | |
Kevin Lubick | 9018952 | 2017-05-15 08:30:27 -0400 | [diff] [blame] | 1255 | if deps := getIsolatedCIPDDeps(parts); len(deps) == 0 { |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 1256 | pkgs = []*specs.CipdPackage{ |
| 1257 | b.MustGetCipdPackageFromAsset("skimage"), |
| 1258 | b.MustGetCipdPackageFromAsset("skp"), |
| 1259 | b.MustGetCipdPackageFromAsset("svg"), |
| 1260 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1261 | } |
Kevin Lubick | 9018952 | 2017-05-15 08:30:27 -0400 | [diff] [blame] | 1262 | |
Ben Wagner | 5655ba4 | 2017-10-02 10:48:32 -0400 | [diff] [blame] | 1263 | if strings.Contains(name, "Ubuntu") || strings.Contains(name, "Debian") { |
| 1264 | if strings.Contains(name, "SAN") { |
| 1265 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("clang_linux")) |
| 1266 | } |
Kevin Lubick | 35115eb | 2017-02-17 10:25:34 -0500 | [diff] [blame] | 1267 | if strings.Contains(name, "Vulkan") { |
| 1268 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("linux_vulkan_sdk")) |
| 1269 | } |
Ben Wagner | 5655ba4 | 2017-10-02 10:48:32 -0400 | [diff] [blame] | 1270 | if strings.Contains(name, "Intel") && strings.Contains(name, "GPU") { |
| 1271 | if strings.Contains(name, "Release") { |
| 1272 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("linux_vulkan_intel_driver_release")) |
| 1273 | } else { |
| 1274 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("linux_vulkan_intel_driver_debug")) |
| 1275 | } |
Kevin Lubick | 0a51b48 | 2017-02-06 12:45:29 -0500 | [diff] [blame] | 1276 | } |
| 1277 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1278 | |
| 1279 | // Test bots. |
Kevin Lubick | 32f318b | 2017-10-17 13:40:52 -0400 | [diff] [blame] | 1280 | |
| 1281 | if parts["role"] == "Test" { |
| 1282 | if strings.Contains(parts["extra_config"], "Coverage") { |
| 1283 | deps = append(deps, coverage(b, name, parts, compileTaskName, pkgs)) |
| 1284 | } else if !strings.Contains(name, "-CT_") { |
| 1285 | deps = append(deps, test(b, name, parts, compileTaskName, pkgs)) |
| 1286 | } |
| 1287 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1288 | } |
| 1289 | |
| 1290 | // Perf bots. |
Eric Boren | 71b762f | 2016-11-30 14:05:16 -0500 | [diff] [blame] | 1291 | if parts["role"] == "Perf" && !strings.Contains(name, "-CT_") { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 1292 | deps = append(deps, perf(b, name, parts, compileTaskName, pkgs)) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1293 | } |
| 1294 | |
Yuqian Li | 4a577af | 2018-01-05 11:13:43 -0500 | [diff] [blame] | 1295 | // Calmbench bots. |
| 1296 | if parts["role"] == "Calmbench" { |
| 1297 | deps = append(deps, calmbench(b, name, parts, compileTaskName, compileParentName)) |
| 1298 | } |
| 1299 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1300 | // Add the Job spec. |
Eric Boren | f5a90e8 | 2016-11-15 15:18:20 -0500 | [diff] [blame] | 1301 | j := &specs.JobSpec{ |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1302 | Priority: 0.8, |
| 1303 | TaskSpecs: deps, |
Eric Boren | ba937a4 | 2017-07-31 10:41:15 -0400 | [diff] [blame] | 1304 | Trigger: specs.TRIGGER_ANY_BRANCH, |
Eric Boren | f5a90e8 | 2016-11-15 15:18:20 -0500 | [diff] [blame] | 1305 | } |
Eric Boren | ba937a4 | 2017-07-31 10:41:15 -0400 | [diff] [blame] | 1306 | if strings.Contains(name, "-Nightly-") { |
| 1307 | j.Trigger = specs.TRIGGER_NIGHTLY |
Ravi Mistry | f06dae8 | 2017-10-16 10:31:41 -0400 | [diff] [blame] | 1308 | } else if strings.Contains(name, "-Weekly-") || strings.Contains(name, "CT_DM_1m_SKPs") { |
Eric Boren | ba937a4 | 2017-07-31 10:41:15 -0400 | [diff] [blame] | 1309 | j.Trigger = specs.TRIGGER_WEEKLY |
| 1310 | } else if strings.Contains(name, "Flutter") || strings.Contains(name, "PDFium") || strings.Contains(name, "CommandBuffer") { |
| 1311 | j.Trigger = specs.TRIGGER_MASTER_ONLY |
Eric Boren | 71b762f | 2016-11-30 14:05:16 -0500 | [diff] [blame] | 1312 | } |
Eric Boren | 8615fe5 | 2016-12-12 14:30:12 -0500 | [diff] [blame] | 1313 | b.MustAddJob(name, j) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1314 | } |
| 1315 | |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 1316 | func loadJson(flag *string, defaultFlag string, val interface{}) { |
| 1317 | if *flag == "" { |
| 1318 | *flag = defaultFlag |
| 1319 | } |
| 1320 | b, err := ioutil.ReadFile(*flag) |
| 1321 | if err != nil { |
| 1322 | glog.Fatal(err) |
| 1323 | } |
| 1324 | if err := json.Unmarshal(b, val); err != nil { |
| 1325 | glog.Fatal(err) |
| 1326 | } |
| 1327 | } |
| 1328 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1329 | // Regenerate the tasks.json file. |
| 1330 | func main() { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 1331 | b := specs.MustNewTasksCfgBuilder() |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 1332 | b.SetAssetsDir(*assetsDir) |
| 1333 | infraBots := path.Join(b.CheckoutRoot(), "infra", "bots") |
| 1334 | |
| 1335 | // Load the jobs from a JSON file. |
| 1336 | loadJson(jobsFile, path.Join(infraBots, "jobs.json"), &JOBS) |
| 1337 | |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 1338 | // Load general config information from a JSON file. |
| 1339 | loadJson(cfgFile, path.Join(infraBots, "cfg.json"), &CONFIG) |
| 1340 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1341 | // Create the JobNameSchema. |
Eric Boren | 1f8be68 | 2017-02-07 09:16:30 -0500 | [diff] [blame] | 1342 | if *builderNameSchemaFile == "" { |
| 1343 | *builderNameSchemaFile = path.Join(b.CheckoutRoot(), "infra", "bots", "recipe_modules", "builder_name_schema", "builder_name_schema.json") |
| 1344 | } |
| 1345 | schema, err := NewJobNameSchema(*builderNameSchemaFile) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1346 | if err != nil { |
| 1347 | glog.Fatal(err) |
| 1348 | } |
| 1349 | jobNameSchema = schema |
| 1350 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1351 | // Create Tasks and Jobs. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 1352 | for _, name := range JOBS { |
| 1353 | process(b, name) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1354 | } |
| 1355 | |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 1356 | b.MustFinish() |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 1357 | } |
| 1358 | |
| 1359 | // TODO(borenet): The below really belongs in its own file, probably next to the |
| 1360 | // builder_name_schema.json file. |
| 1361 | |
| 1362 | // JobNameSchema is a struct used for (de)constructing Job names in a |
| 1363 | // predictable format. |
| 1364 | type JobNameSchema struct { |
| 1365 | Schema map[string][]string `json:"builder_name_schema"` |
| 1366 | Sep string `json:"builder_name_sep"` |
| 1367 | } |
| 1368 | |
| 1369 | // NewJobNameSchema returns a JobNameSchema instance based on the given JSON |
| 1370 | // file. |
| 1371 | func NewJobNameSchema(jsonFile string) (*JobNameSchema, error) { |
| 1372 | var rv JobNameSchema |
| 1373 | f, err := os.Open(jsonFile) |
| 1374 | if err != nil { |
| 1375 | return nil, err |
| 1376 | } |
| 1377 | defer util.Close(f) |
| 1378 | if err := json.NewDecoder(f).Decode(&rv); err != nil { |
| 1379 | return nil, err |
| 1380 | } |
| 1381 | return &rv, nil |
| 1382 | } |
| 1383 | |
| 1384 | // ParseJobName splits the given Job name into its component parts, according |
| 1385 | // to the schema. |
| 1386 | func (s *JobNameSchema) ParseJobName(n string) (map[string]string, error) { |
| 1387 | split := strings.Split(n, s.Sep) |
| 1388 | if len(split) < 2 { |
| 1389 | return nil, fmt.Errorf("Invalid job name: %q", n) |
| 1390 | } |
| 1391 | role := split[0] |
| 1392 | split = split[1:] |
| 1393 | keys, ok := s.Schema[role] |
| 1394 | if !ok { |
| 1395 | return nil, fmt.Errorf("Invalid job name; %q is not a valid role.", role) |
| 1396 | } |
| 1397 | extraConfig := "" |
| 1398 | if len(split) == len(keys)+1 { |
| 1399 | extraConfig = split[len(split)-1] |
| 1400 | split = split[:len(split)-1] |
| 1401 | } |
| 1402 | if len(split) != len(keys) { |
| 1403 | return nil, fmt.Errorf("Invalid job name; %q has incorrect number of parts.", n) |
| 1404 | } |
| 1405 | rv := make(map[string]string, len(keys)+2) |
| 1406 | rv["role"] = role |
| 1407 | if extraConfig != "" { |
| 1408 | rv["extra_config"] = extraConfig |
| 1409 | } |
| 1410 | for i, k := range keys { |
| 1411 | rv[k] = split[i] |
| 1412 | } |
| 1413 | return rv, nil |
| 1414 | } |
| 1415 | |
| 1416 | // MakeJobName assembles the given parts of a Job name, according to the schema. |
| 1417 | func (s *JobNameSchema) MakeJobName(parts map[string]string) (string, error) { |
| 1418 | role, ok := parts["role"] |
| 1419 | if !ok { |
| 1420 | return "", fmt.Errorf("Invalid job parts; jobs must have a role.") |
| 1421 | } |
| 1422 | keys, ok := s.Schema[role] |
| 1423 | if !ok { |
| 1424 | return "", fmt.Errorf("Invalid job parts; unknown role %q", role) |
| 1425 | } |
| 1426 | rvParts := make([]string, 0, len(parts)) |
| 1427 | rvParts = append(rvParts, role) |
| 1428 | for _, k := range keys { |
| 1429 | v, ok := parts[k] |
| 1430 | if !ok { |
| 1431 | return "", fmt.Errorf("Invalid job parts; missing %q", k) |
| 1432 | } |
| 1433 | rvParts = append(rvParts, v) |
| 1434 | } |
| 1435 | if _, ok := parts["extra_config"]; ok { |
| 1436 | rvParts = append(rvParts, parts["extra_config"]) |
| 1437 | } |
| 1438 | return strings.Join(rvParts, s.Sep), nil |
| 1439 | } |