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 | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 18 | "regexp" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 19 | "sort" |
| 20 | "strings" |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 21 | "time" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 22 | |
| 23 | "github.com/skia-dev/glog" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 24 | "go.skia.org/infra/go/util" |
| 25 | "go.skia.org/infra/task_scheduler/go/specs" |
| 26 | ) |
| 27 | |
| 28 | const ( |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 29 | BUNDLE_RECIPES_NAME = "Housekeeper-PerCommit-BundleRecipes" |
| 30 | ISOLATE_SKIMAGE_NAME = "Housekeeper-PerCommit-IsolateSkImage" |
| 31 | ISOLATE_SKP_NAME = "Housekeeper-PerCommit-IsolateSKP" |
| 32 | ISOLATE_SVG_NAME = "Housekeeper-PerCommit-IsolateSVG" |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 33 | |
Kevin Lubick | 797ef16 | 2016-12-15 10:45:08 -0500 | [diff] [blame] | 34 | DEFAULT_OS = DEFAULT_OS_LINUX |
| 35 | DEFAULT_OS_LINUX = "Ubuntu-14.04" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 36 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 37 | // Name prefix for upload jobs. |
| 38 | PREFIX_UPLOAD = "Upload" |
| 39 | ) |
| 40 | |
| 41 | var ( |
| 42 | // "Constants" |
| 43 | |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 44 | // Top-level list of all jobs to run at each commit; loaded from |
| 45 | // jobs.json. |
| 46 | JOBS []string |
| 47 | |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 48 | // General configuration information. |
| 49 | CONFIG struct { |
Eric Boren | 965861b | 2017-02-06 15:38:41 -0500 | [diff] [blame] | 50 | GsBucketGm string `json:"gs_bucket_gm"` |
| 51 | GsBucketNano string `json:"gs_bucket_nano"` |
| 52 | NoUpload []string `json:"no_upload"` |
| 53 | Pool string `json:"pool"` |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 54 | } |
| 55 | |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 56 | // alternateSwarmDimensions can be set in an init function to override the default swarming bot |
| 57 | // dimensions for the given task. |
| 58 | alternateSwarmDimensions func(parts map[string]string) []string |
| 59 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 60 | // Defines the structure of job names. |
| 61 | jobNameSchema *JobNameSchema |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 62 | |
Eric Boren | f4a5fc7 | 2017-06-06 08:27:09 -0400 | [diff] [blame] | 63 | // Git 2.13. |
| 64 | cipdGit1 = &specs.CipdPackage{ |
| 65 | Name: fmt.Sprintf("infra/git/${platform}"), |
| 66 | Path: "git", |
| 67 | Version: fmt.Sprintf("version:2.13.0.chromium9"), |
| 68 | } |
| 69 | cipdGit2 = &specs.CipdPackage{ |
| 70 | Name: fmt.Sprintf("infra/tools/git/${platform}"), |
| 71 | Path: "git", |
| 72 | Version: fmt.Sprintf("git_revision:a78b5f3658c0578a017db48df97d20ac09822bcd"), |
| 73 | } |
| 74 | |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 75 | // Flags. |
Eric Boren | 1f8be68 | 2017-02-07 09:16:30 -0500 | [diff] [blame] | 76 | 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.") |
| 77 | assetsDir = flag.String("assets_dir", "", "Directory containing assets.") |
| 78 | cfgFile = flag.String("cfg_file", "", "JSON file containing general configuration information.") |
Eric Boren | 1f8be68 | 2017-02-07 09:16:30 -0500 | [diff] [blame] | 79 | jobsFile = flag.String("jobs", "", "JSON file containing jobs to run.") |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 80 | ) |
| 81 | |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 82 | // linuxGceDimensions are the Swarming dimensions for Linux GCE |
| 83 | // instances. |
| 84 | func linuxGceDimensions() []string { |
| 85 | return []string{ |
| 86 | "cpu:x86-64-avx2", |
| 87 | "gpu:none", |
| 88 | fmt.Sprintf("os:%s", DEFAULT_OS_LINUX), |
| 89 | fmt.Sprintf("pool:%s", CONFIG.Pool), |
| 90 | } |
| 91 | } |
| 92 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 93 | // deriveCompileTaskName returns the name of a compile task based on the given |
| 94 | // job name. |
| 95 | func deriveCompileTaskName(jobName string, parts map[string]string) string { |
| 96 | if parts["role"] == "Housekeeper" { |
| 97 | return "Build-Ubuntu-GCC-x86_64-Release-Shared" |
| 98 | } else if parts["role"] == "Test" || parts["role"] == "Perf" { |
| 99 | task_os := parts["os"] |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 100 | ec := []string{} |
| 101 | if val := parts["extra_config"]; val != "" { |
| 102 | ec = strings.Split(val, "_") |
Stephan Altmueller | ddad85b | 2017-05-19 13:08:19 -0400 | [diff] [blame] | 103 | ignore := []string{"Skpbench", "AbandonGpuContext", "PreAbandonGpuContext", "Valgrind", "ReleaseAndAbandonGpuContext"} |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 104 | keep := make([]string, 0, len(ec)) |
| 105 | for _, part := range ec { |
| 106 | if !util.In(part, ignore) { |
| 107 | keep = append(keep, part) |
| 108 | } |
| 109 | } |
| 110 | ec = keep |
Eric Boren | 6ec17e3 | 2017-04-26 14:25:29 -0400 | [diff] [blame] | 111 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 112 | if task_os == "Android" { |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 113 | if !util.In("Android", ec) { |
| 114 | ec = append([]string{"Android"}, ec...) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 115 | } |
borenet | 5238343 | 2016-10-17 10:17:53 -0700 | [diff] [blame] | 116 | task_os = "Ubuntu" |
Kevin Lubick | dcd2a90 | 2017-03-08 14:01:01 -0500 | [diff] [blame] | 117 | } else if task_os == "Chromecast" { |
| 118 | task_os = "Ubuntu" |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 119 | ec = append([]string{"Chromecast"}, ec...) |
Kevin Lubick | cb6f398 | 2017-04-07 10:04:08 -0400 | [diff] [blame] | 120 | } else if strings.Contains(task_os, "ChromeOS") { |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 121 | ec = append([]string{"Chromebook", "ARM", "GLES"}, ec...) |
Kevin Lubick | 261ea19 | 2017-04-05 07:32:45 -0400 | [diff] [blame] | 122 | task_os = "Ubuntu" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 123 | } else if task_os == "iOS" { |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 124 | ec = append([]string{task_os}, ec...) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 125 | task_os = "Mac" |
| 126 | } else if strings.Contains(task_os, "Win") { |
| 127 | task_os = "Win" |
Kevin Lubick | 893c49e | 2017-01-17 15:15:40 -0500 | [diff] [blame] | 128 | } else if strings.Contains(task_os, "Ubuntu") { |
| 129 | task_os = "Ubuntu" |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 130 | } |
Eric Boren | 5083130 | 2016-11-18 13:10:51 -0500 | [diff] [blame] | 131 | jobNameMap := map[string]string{ |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 132 | "role": "Build", |
| 133 | "os": task_os, |
| 134 | "compiler": parts["compiler"], |
| 135 | "target_arch": parts["arch"], |
| 136 | "configuration": parts["configuration"], |
Eric Boren | 5083130 | 2016-11-18 13:10:51 -0500 | [diff] [blame] | 137 | } |
Ben Wagner | 988d15e | 2017-04-27 13:08:50 -0400 | [diff] [blame] | 138 | if len(ec) > 0 { |
| 139 | jobNameMap["extra_config"] = strings.Join(ec, "_") |
Eric Boren | 5083130 | 2016-11-18 13:10:51 -0500 | [diff] [blame] | 140 | } |
| 141 | name, err := jobNameSchema.MakeJobName(jobNameMap) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 142 | if err != nil { |
| 143 | glog.Fatal(err) |
| 144 | } |
| 145 | return name |
| 146 | } else { |
| 147 | return jobName |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | // swarmDimensions generates swarming bot dimensions for the given task. |
| 152 | func swarmDimensions(parts map[string]string) []string { |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 153 | if alternateSwarmDimensions != nil { |
| 154 | return alternateSwarmDimensions(parts) |
| 155 | } |
| 156 | return defaultSwarmDimensions(parts) |
| 157 | } |
| 158 | |
| 159 | // defaultSwarmDimensions generates default swarming bot dimensions for the given task. |
| 160 | func defaultSwarmDimensions(parts map[string]string) []string { |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 161 | d := map[string]string{ |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 162 | "pool": CONFIG.Pool, |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 163 | } |
| 164 | if os, ok := parts["os"]; ok { |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 165 | d["os"], ok = map[string]string{ |
Kevin Lubick | 291547d | 2017-03-21 09:25:34 -0400 | [diff] [blame] | 166 | "Android": "Android", |
| 167 | "Chromecast": "Android", |
Kevin Lubick | cb6f398 | 2017-04-07 10:04:08 -0400 | [diff] [blame] | 168 | "ChromeOS": "ChromeOS", |
Kevin Lubick | 291547d | 2017-03-21 09:25:34 -0400 | [diff] [blame] | 169 | "Mac": "Mac-10.11", |
| 170 | "Ubuntu": DEFAULT_OS_LINUX, |
| 171 | "Ubuntu16": "Ubuntu-16.10", |
| 172 | "Win": "Windows-2008ServerR2-SP1", |
Ben Wagner | 40226b4 | 2017-05-02 13:13:13 -0400 | [diff] [blame] | 173 | "Win10": "Windows-10-15063", |
Kevin Lubick | 291547d | 2017-03-21 09:25:34 -0400 | [diff] [blame] | 174 | "Win2k8": "Windows-2008ServerR2-SP1", |
Ben Wagner | 56738d8 | 2017-04-18 15:38:15 -0400 | [diff] [blame] | 175 | "Win7": "Windows-7-SP1", |
Kevin Lubick | 291547d | 2017-03-21 09:25:34 -0400 | [diff] [blame] | 176 | "Win8": "Windows-8.1-SP0", |
Stephan Altmueller | ddad85b | 2017-05-19 13:08:19 -0400 | [diff] [blame] | 177 | "iOS": "iOS-10.3.1", |
Eric Boren | 54ff2fc | 2016-12-02 12:09:10 -0500 | [diff] [blame] | 178 | }[os] |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 179 | if !ok { |
| 180 | glog.Fatalf("Entry %q not found in OS mapping.", os) |
| 181 | } |
Ben Wagner | 7355737 | 2016-12-29 16:27:03 -0500 | [diff] [blame] | 182 | // Chrome Golo has a different Windows image. |
| 183 | if parts["model"] == "Golo" && os == "Win10" { |
| 184 | d["os"] = "Windows-10-10586" |
Ben Wagner | 17f811b | 2016-12-22 08:40:14 -0500 | [diff] [blame] | 185 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 186 | } else { |
| 187 | d["os"] = DEFAULT_OS |
| 188 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 189 | if parts["role"] == "Test" || parts["role"] == "Perf" { |
Kevin Lubick | 291547d | 2017-03-21 09:25:34 -0400 | [diff] [blame] | 190 | if strings.Contains(parts["os"], "Android") || strings.Contains(parts["os"], "Chromecast") { |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 191 | // For Android, the device type is a better dimension |
| 192 | // than CPU or GPU. |
Ben Wagner | 3668278 | 2017-06-14 10:01:45 -0400 | [diff] [blame] | 193 | deviceInfo, ok := map[string][]string{ |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 194 | "AndroidOne": {"sprout", "MOB30Q"}, |
| 195 | "Chorizo": {"chorizo", "1.24_82923"}, |
| 196 | "Ci20": {"ci20", "NRD90M"}, |
| 197 | "GalaxyJ5": {"j5xnlte", "MMB29M"}, |
| 198 | "GalaxyS6": {"zerofltetmo", "MMB29K"}, |
| 199 | "GalaxyS7_G930A": {"heroqlteatt", "NRD90M_G930AUCS4BQC2"}, |
| 200 | "GalaxyS7_G930FD": {"herolte", "NRD90M_G930FXXU1DQAS"}, |
| 201 | "GalaxyTab3": {"goyawifi", "JDQ39"}, |
| 202 | "MotoG4": {"athene", "NPJ25.93-14"}, |
| 203 | "NVIDIA_Shield": {"foster", "NRD90M"}, |
| 204 | "Nexus10": {"manta", "LMY49J"}, |
| 205 | "Nexus5": {"hammerhead", "M4B30Z"}, |
| 206 | "Nexus6": {"shamu", "M"}, |
| 207 | "Nexus6p": {"angler", "OPP1.170223.012"}, |
| 208 | "Nexus7": {"grouper", "LMY47V"}, |
| 209 | "Nexus7v2": {"flo", "M"}, |
| 210 | "NexusPlayer": {"fugu", "OPP2.170420.017"}, |
| 211 | "Pixel": {"sailfish", "NMF26Q"}, |
| 212 | "PixelC": {"dragon", "N2G47D"}, |
Greg Daniel | c34aeb7 | 2017-06-14 11:09:19 -0400 | [diff] [blame^] | 213 | "PixelXL": {"marlin", "OPP3.170518.006"}, |
Ben Wagner | 3668278 | 2017-06-14 10:01:45 -0400 | [diff] [blame] | 214 | }[parts["model"]] |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 215 | if !ok { |
Ben Wagner | 3668278 | 2017-06-14 10:01:45 -0400 | [diff] [blame] | 216 | glog.Fatalf("Entry %q not found in Android mapping.", parts["model"]) |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 217 | } |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 218 | d["device_type"] = deviceInfo[0] |
| 219 | d["device_os"] = deviceInfo[1] |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 220 | } else if strings.Contains(parts["os"], "iOS") { |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 221 | device, ok := map[string]string{ |
Eric Boren | 792079cf | 2016-11-09 14:03:20 -0500 | [diff] [blame] | 222 | "iPadMini4": "iPad5,1", |
Stephan Altmueller | 63e843d | 2017-04-25 11:38:38 -0400 | [diff] [blame] | 223 | "iPhone6": "iPhone7,2", |
| 224 | "iPhone7": "iPhone9,1", |
| 225 | "iPadPro": "iPad6,3", |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 226 | }[parts["model"]] |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 227 | if !ok { |
| 228 | glog.Fatalf("Entry %q not found in iOS mapping.", parts["model"]) |
| 229 | } |
| 230 | d["device"] = device |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 231 | } else if parts["cpu_or_gpu"] == "CPU" { |
| 232 | d["gpu"] = "none" |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 233 | cpu, ok := map[string]string{ |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 234 | "AVX": "x86-64", |
| 235 | "AVX2": "x86-64-avx2", |
| 236 | "SSE4": "x86-64", |
| 237 | }[parts["cpu_or_gpu_value"]] |
Ben Wagner | 3d2a2f7 | 2017-06-13 17:01:16 -0400 | [diff] [blame] | 238 | if !ok { |
| 239 | glog.Fatalf("Entry %q not found in CPU mapping.", parts["cpu_or_gpu_value"]) |
| 240 | } |
| 241 | d["cpu"] = cpu |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 242 | if strings.Contains(parts["os"], "Win") && parts["cpu_or_gpu_value"] == "AVX2" { |
| 243 | // AVX2 is not correctly detected on Windows. Fall back on other |
| 244 | // dimensions to ensure that we correctly target machines which we know |
| 245 | // have AVX2 support. |
Eric Boren | 085bf7c | 2017-04-06 17:32:44 +0000 | [diff] [blame] | 246 | d["cpu"] = "x86-64" |
Ben Wagner | 56738d8 | 2017-04-18 15:38:15 -0400 | [diff] [blame] | 247 | if parts["model"] != "GCE" { |
| 248 | glog.Fatalf("Please double-check that %q supports AVX2 and update this assertion.", parts["model"]) |
| 249 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 250 | } |
| 251 | } else { |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 252 | if strings.Contains(parts["os"], "Win") { |
| 253 | gpu, ok := map[string]string{ |
| 254 | "AMDHD7770": "1002:683d-22.19.165.512", |
| 255 | "GT610": "10de:104a-21.21.13.7619", |
| 256 | "GTX1070": "10de:1ba1-22.21.13.8205", |
| 257 | "GTX660": "10de:11c0-22.21.13.8205", |
| 258 | "GTX960": "10de:1401-22.21.13.8205", |
| 259 | "IntelHD530": "8086:1912-21.20.16.4590", |
| 260 | "IntelHD4400": "8086:0a16-20.19.15.4531", |
| 261 | "IntelHD4600": "8086:0412-20.19.15.4531", |
| 262 | "IntelIris540": "8086:1926-21.20.16.4590", |
| 263 | "IntelIris6100": "8086:162b-20.19.15.4531", |
| 264 | "RadeonR9M470X": "1002:6646-22.19.165.512", |
| 265 | }[parts["cpu_or_gpu_value"]] |
| 266 | if !ok { |
| 267 | glog.Fatalf("Entry %q not found in Win GPU mapping.", parts["cpu_or_gpu_value"]) |
| 268 | } |
| 269 | d["gpu"] = gpu |
Ben Wagner | 0843589 | 2017-02-18 23:28:26 -0500 | [diff] [blame] | 270 | |
Ben Wagner | 1d06078 | 2017-06-14 10:34:18 -0400 | [diff] [blame] | 271 | // Hack: Specify machine_type dimension for NUCs and ShuttleCs. We |
| 272 | // temporarily have two types of machines with a GTX960. The only way to |
| 273 | // distinguish these bots is by machine_type. |
| 274 | machine_type, ok := map[string]string{ |
| 275 | "NUC6i7KYK": "n1-highcpu-8", |
| 276 | "ShuttleC": "n1-standard-8", |
| 277 | }[parts["model"]] |
| 278 | if ok { |
| 279 | d["machine_type"] = machine_type |
| 280 | } |
| 281 | } else if strings.Contains(parts["os"], "Ubuntu") { |
| 282 | gpu, ok := map[string]string{ |
| 283 | "GT610": "10de:104a-340.96", |
| 284 | "GTX550Ti": "10de:1244-340.76", |
| 285 | "GTX660": "10de:11c0-367.57", |
| 286 | "GTX960": "10de:1401-367.57", |
| 287 | // Intel drivers come from CIPD, so no need to specify the version here. |
| 288 | "IntelBayTrail": "8086:0f31", |
| 289 | "IntelHD2000": "8086:0102", |
| 290 | "IntelHD405": "8086:22b1", |
| 291 | "IntelIris540": "8086:1926", |
| 292 | }[parts["cpu_or_gpu_value"]] |
| 293 | if !ok { |
| 294 | glog.Fatalf("Entry %q not found in Ubuntu GPU mapping.", parts["cpu_or_gpu_value"]) |
| 295 | } |
| 296 | d["gpu"] = gpu |
| 297 | } else if strings.Contains(parts["os"], "Mac") { |
| 298 | gpu, ok := map[string]string{ |
| 299 | // TODO(benjaminwagner): GPU name doesn't match device ID. |
| 300 | "IntelHD4000": "8086:0a2e", |
| 301 | }[parts["cpu_or_gpu_value"]] |
| 302 | if !ok { |
| 303 | glog.Fatalf("Entry %q not found in Mac GPU mapping.", parts["cpu_or_gpu_value"]) |
| 304 | } |
| 305 | d["gpu"] = gpu |
| 306 | } else if strings.Contains(parts["os"], "ChromeOS") { |
| 307 | gpu, ok := map[string]string{ |
| 308 | "MaliT604": "MaliT604", |
| 309 | "MaliT764": "MaliT764", |
| 310 | "MaliT860": "MaliT860", |
| 311 | "TegraK1": "TegraK1", |
| 312 | }[parts["cpu_or_gpu_value"]] |
| 313 | if !ok { |
| 314 | glog.Fatalf("Entry %q not found in ChromeOS GPU mapping.", parts["cpu_or_gpu_value"]) |
| 315 | } |
| 316 | d["gpu"] = gpu |
| 317 | } else { |
| 318 | glog.Fatalf("Unknown GPU mapping for OS %q.", parts["os"]) |
Ben Wagner | 0843589 | 2017-02-18 23:28:26 -0500 | [diff] [blame] | 319 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 320 | } |
| 321 | } else { |
| 322 | d["gpu"] = "none" |
Kevin Lubick | 4610a9b | 2017-03-22 15:54:54 -0400 | [diff] [blame] | 323 | if d["os"] == DEFAULT_OS_LINUX { |
| 324 | return linuxGceDimensions() |
| 325 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 326 | } |
Kevin Lubick | 4610a9b | 2017-03-22 15:54:54 -0400 | [diff] [blame] | 327 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 328 | rv := make([]string, 0, len(d)) |
| 329 | for k, v := range d { |
| 330 | rv = append(rv, fmt.Sprintf("%s:%s", k, v)) |
| 331 | } |
| 332 | sort.Strings(rv) |
| 333 | return rv |
| 334 | } |
| 335 | |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 336 | // bundleRecipes generates the task to bundle and isolate the recipes. |
| 337 | func bundleRecipes(b *specs.TasksCfgBuilder) string { |
| 338 | b.MustAddTask(BUNDLE_RECIPES_NAME, &specs.TaskSpec{ |
Eric Boren | f4a5fc7 | 2017-06-06 08:27:09 -0400 | [diff] [blame] | 339 | CipdPackages: []*specs.CipdPackage{cipdGit1, cipdGit2}, |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 340 | Dimensions: linuxGceDimensions(), |
| 341 | ExtraArgs: []string{ |
| 342 | "--workdir", "../../..", "bundle_recipes", |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 343 | fmt.Sprintf("buildername=%s", BUNDLE_RECIPES_NAME), |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 344 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 345 | }, |
| 346 | Isolate: "bundle_recipes.isolate", |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 347 | Priority: 0.7, |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 348 | }) |
| 349 | return BUNDLE_RECIPES_NAME |
| 350 | } |
| 351 | |
Eric Boren | 23a6ec6 | 2017-04-07 08:31:22 -0400 | [diff] [blame] | 352 | // useBundledRecipes returns true iff the given bot should use bundled recipes |
| 353 | // instead of syncing recipe DEPS itself. |
| 354 | func useBundledRecipes(parts map[string]string) bool { |
| 355 | // Use bundled recipes for all test/perf tasks. |
| 356 | return true |
| 357 | } |
| 358 | |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 359 | type isolateAssetCfg struct { |
| 360 | isolateFile string |
| 361 | cipdPkg string |
| 362 | } |
| 363 | |
| 364 | var ISOLATE_ASSET_MAPPING = map[string]isolateAssetCfg{ |
| 365 | ISOLATE_SKIMAGE_NAME: { |
| 366 | isolateFile: "isolate_skimage.isolate", |
| 367 | cipdPkg: "skimage", |
| 368 | }, |
| 369 | ISOLATE_SKP_NAME: { |
| 370 | isolateFile: "isolate_skp.isolate", |
| 371 | cipdPkg: "skp", |
| 372 | }, |
| 373 | ISOLATE_SVG_NAME: { |
| 374 | isolateFile: "isolate_svg.isolate", |
| 375 | cipdPkg: "svg", |
| 376 | }, |
| 377 | } |
| 378 | |
| 379 | // bundleRecipes generates the task to bundle and isolate the recipes. |
| 380 | func isolateCIPDAsset(b *specs.TasksCfgBuilder, name string) string { |
| 381 | b.MustAddTask(name, &specs.TaskSpec{ |
| 382 | CipdPackages: []*specs.CipdPackage{ |
| 383 | b.MustGetCipdPackageFromAsset(ISOLATE_ASSET_MAPPING[name].cipdPkg), |
| 384 | }, |
| 385 | Dimensions: linuxGceDimensions(), |
| 386 | Isolate: ISOLATE_ASSET_MAPPING[name].isolateFile, |
| 387 | Priority: 0.7, |
| 388 | }) |
| 389 | return name |
| 390 | } |
| 391 | |
Kevin Lubick | 9018952 | 2017-05-15 08:30:27 -0400 | [diff] [blame] | 392 | // getIsolatedCIPDDeps returns the slice of Isolate_* tasks a given task needs. |
| 393 | // This allows us to save time on I/O bound bots, like the RPIs. |
| 394 | func getIsolatedCIPDDeps(parts map[string]string) []string { |
| 395 | deps := []string{} |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 396 | // Only do this on the RPIs for now. Other, faster machines shouldn't see much |
| 397 | // benefit and we don't need the extra complexity, for now |
Kevin Lubick | 9018952 | 2017-05-15 08:30:27 -0400 | [diff] [blame] | 398 | rpiOS := []string{"Android", "ChromeOS", "iOS"} |
| 399 | |
| 400 | if o := parts["os"]; strings.Contains(o, "Chromecast") { |
| 401 | // Chromecasts don't have enough disk space to fit all of the content, |
| 402 | // so we do a subset of the skps. |
| 403 | deps = append(deps, ISOLATE_SKP_NAME) |
| 404 | } else if e := parts["extra_config"]; strings.Contains(e, "Skpbench") { |
| 405 | // Skpbench only needs skps |
| 406 | deps = append(deps, ISOLATE_SKP_NAME) |
| 407 | } else if util.In(o, rpiOS) { |
| 408 | deps = append(deps, ISOLATE_SKP_NAME) |
| 409 | deps = append(deps, ISOLATE_SVG_NAME) |
| 410 | deps = append(deps, ISOLATE_SKIMAGE_NAME) |
| 411 | } |
| 412 | |
| 413 | return deps |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 414 | } |
| 415 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 416 | // compile generates a compile task. Returns the name of the last task in the |
| 417 | // generated chain of tasks, which the Job should add as a dependency. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 418 | func compile(b *specs.TasksCfgBuilder, name string, parts map[string]string) string { |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 419 | // Collect the necessary CIPD packages. |
| 420 | pkgs := []*specs.CipdPackage{} |
| 421 | |
| 422 | // Android bots require a toolchain. |
| 423 | if strings.Contains(name, "Android") { |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 424 | if strings.Contains(name, "Mac") { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 425 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("android_ndk_darwin")) |
Mike Klein | 86c2c0f | 2016-11-02 13:13:16 -0400 | [diff] [blame] | 426 | } else if strings.Contains(name, "Win") { |
Mike Klein | e9215f0 | 2016-11-02 15:44:26 -0400 | [diff] [blame] | 427 | pkg := b.MustGetCipdPackageFromAsset("android_ndk_windows") |
| 428 | pkg.Path = "n" |
| 429 | pkgs = append(pkgs, pkg) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 430 | } else { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 431 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("android_ndk_linux")) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 432 | } |
Kevin Lubick | dcd2a90 | 2017-03-08 14:01:01 -0500 | [diff] [blame] | 433 | } else if strings.Contains(name, "Chromecast") { |
| 434 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("cast_toolchain")) |
Kevin Lubick | ffce079 | 2017-05-24 15:30:35 -0400 | [diff] [blame] | 435 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("chromebook_arm_gles")) |
Kevin Lubick | 261ea19 | 2017-04-05 07:32:45 -0400 | [diff] [blame] | 436 | } else if strings.Contains(name, "Chromebook") { |
| 437 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("clang_linux")) |
| 438 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("armhf_sysroot")) |
Kevin Lubick | 671cd72 | 2017-04-12 10:50:18 -0400 | [diff] [blame] | 439 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("chromebook_arm_gles")) |
Kevin Lubick | 9c7dcac | 2017-01-18 09:24:56 -0500 | [diff] [blame] | 440 | } else if strings.Contains(name, "Ubuntu") { |
| 441 | if strings.Contains(name, "Clang") { |
| 442 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("clang_linux")) |
| 443 | } |
| 444 | if strings.Contains(name, "Vulkan") { |
| 445 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("linux_vulkan_sdk")) |
| 446 | } |
Mike Klein | 27dcee1 | 2016-11-09 16:31:42 -0500 | [diff] [blame] | 447 | } else if strings.Contains(name, "Win") { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 448 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("win_toolchain")) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 449 | if strings.Contains(name, "Vulkan") { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 450 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("win_vulkan_sdk")) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 451 | } |
| 452 | } |
| 453 | |
Stephan Altmueller | 5f3b940 | 2017-03-20 13:38:45 -0400 | [diff] [blame] | 454 | // TODO(stephana): Remove this once all Mac machines are on the same |
| 455 | // OS version again. Move the call to swarmDimensions back to the |
| 456 | // creation of the TaskSpec struct below. |
| 457 | dimensions := swarmDimensions(parts) |
| 458 | if strings.Contains(name, "Mac") { |
| 459 | for idx, dim := range dimensions { |
| 460 | if strings.HasPrefix(dim, "os") { |
| 461 | dimensions[idx] = "os:Mac-10.12" |
| 462 | break |
| 463 | } |
| 464 | } |
| 465 | } |
| 466 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 467 | // Add the task. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 468 | b.MustAddTask(name, &specs.TaskSpec{ |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 469 | CipdPackages: pkgs, |
Stephan Altmueller | 5f3b940 | 2017-03-20 13:38:45 -0400 | [diff] [blame] | 470 | Dimensions: dimensions, |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 471 | ExtraArgs: []string{ |
Eric Boren | 768f52f | 2017-04-10 08:14:33 -0400 | [diff] [blame] | 472 | "--workdir", "../../..", "compile", |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 473 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 474 | fmt.Sprintf("buildername=%s", name), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 475 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 476 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 477 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
borenet | 98b2e7a | 2016-10-13 06:23:45 -0700 | [diff] [blame] | 478 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 479 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 480 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 481 | }, |
| 482 | Isolate: "compile_skia.isolate", |
| 483 | Priority: 0.8, |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 484 | }) |
Eric Boren | 8615fe5 | 2016-12-12 14:30:12 -0500 | [diff] [blame] | 485 | // All compile tasks are runnable as their own Job. Assert that the Job |
| 486 | // is listed in JOBS. |
| 487 | if !util.In(name, JOBS) { |
| 488 | glog.Fatalf("Job %q is missing from the JOBS list!", name) |
| 489 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 490 | return name |
| 491 | } |
| 492 | |
| 493 | // recreateSKPs generates a RecreateSKPs task. Returns the name of the last |
| 494 | // task in the generated chain of tasks, which the Job should add as a |
| 495 | // dependency. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 496 | func recreateSKPs(b *specs.TasksCfgBuilder, name string) string { |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 497 | b.MustAddTask(name, &specs.TaskSpec{ |
Eric Boren | f9c0904 | 2017-04-17 07:50:20 -0400 | [diff] [blame] | 498 | CipdPackages: []*specs.CipdPackage{b.MustGetCipdPackageFromAsset("go")}, |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 499 | Dimensions: linuxGceDimensions(), |
Eric Boren | f5a90e8 | 2016-11-15 15:18:20 -0500 | [diff] [blame] | 500 | ExecutionTimeout: 4 * time.Hour, |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 501 | ExtraArgs: []string{ |
Eric Boren | 768f52f | 2017-04-10 08:14:33 -0400 | [diff] [blame] | 502 | "--workdir", "../../..", "recreate_skps", |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 503 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 504 | fmt.Sprintf("buildername=%s", name), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 505 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 506 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 507 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 508 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 509 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 510 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 511 | }, |
Eric Boren | f5a90e8 | 2016-11-15 15:18:20 -0500 | [diff] [blame] | 512 | IoTimeout: 40 * time.Minute, |
| 513 | Isolate: "compile_skia.isolate", |
| 514 | Priority: 0.8, |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 515 | }) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 516 | return name |
| 517 | } |
| 518 | |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 519 | // updateMetaConfig generates a UpdateMetaConfig task. Returns the name of the |
| 520 | // last task in the generated chain of tasks, which the Job should add as a |
| 521 | // dependency. |
| 522 | func updateMetaConfig(b *specs.TasksCfgBuilder, name string) string { |
| 523 | b.MustAddTask(name, &specs.TaskSpec{ |
Stephan Altmueller | ddad85b | 2017-05-19 13:08:19 -0400 | [diff] [blame] | 524 | CipdPackages: []*specs.CipdPackage{}, |
| 525 | Dimensions: linuxGceDimensions(), |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 526 | ExtraArgs: []string{ |
| 527 | "--workdir", "../../..", "update_meta_config", |
| 528 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 529 | fmt.Sprintf("buildername=%s", name), |
| 530 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 531 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
| 532 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
| 533 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 534 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 535 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 536 | }, |
Stephan Altmueller | ddad85b | 2017-05-19 13:08:19 -0400 | [diff] [blame] | 537 | Isolate: "meta_config.isolate", |
| 538 | Priority: 0.8, |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 539 | }) |
| 540 | return name |
| 541 | } |
| 542 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 543 | // ctSKPs generates a CT SKPs task. Returns the name of the last task in the |
| 544 | // generated chain of tasks, which the Job should add as a dependency. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 545 | func ctSKPs(b *specs.TasksCfgBuilder, name string) string { |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 546 | b.MustAddTask(name, &specs.TaskSpec{ |
| 547 | CipdPackages: []*specs.CipdPackage{}, |
| 548 | Dimensions: []string{"pool:SkiaCT"}, |
| 549 | ExecutionTimeout: 24 * time.Hour, |
| 550 | ExtraArgs: []string{ |
Eric Boren | 768f52f | 2017-04-10 08:14:33 -0400 | [diff] [blame] | 551 | "--workdir", "../../..", "ct_skps", |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 552 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 553 | fmt.Sprintf("buildername=%s", name), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 554 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 555 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 556 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 557 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 558 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 559 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 560 | }, |
| 561 | IoTimeout: time.Hour, |
| 562 | Isolate: "ct_skps_skia.isolate", |
| 563 | Priority: 0.8, |
| 564 | }) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 565 | return name |
| 566 | } |
| 567 | |
| 568 | // housekeeper generates a Housekeeper task. Returns the name of the last task |
| 569 | // in the generated chain of tasks, which the Job should add as a dependency. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 570 | func housekeeper(b *specs.TasksCfgBuilder, name, compileTaskName string) string { |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 571 | b.MustAddTask(name, &specs.TaskSpec{ |
Eric Boren | 22f5ef7 | 2016-12-02 11:01:33 -0500 | [diff] [blame] | 572 | CipdPackages: []*specs.CipdPackage{b.MustGetCipdPackageFromAsset("go")}, |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 573 | Dependencies: []string{compileTaskName}, |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 574 | Dimensions: linuxGceDimensions(), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 575 | ExtraArgs: []string{ |
Eric Boren | 768f52f | 2017-04-10 08:14:33 -0400 | [diff] [blame] | 576 | "--workdir", "../../..", "housekeeper", |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 577 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
| 578 | fmt.Sprintf("buildername=%s", name), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 579 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 580 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 581 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 582 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
| 583 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 584 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
| 585 | }, |
| 586 | Isolate: "housekeeper_skia.isolate", |
| 587 | Priority: 0.8, |
| 588 | }) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 589 | return name |
| 590 | } |
| 591 | |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 592 | // infra generates an infra_tests task. Returns the name of the last task in the |
| 593 | // generated chain of tasks, which the Job should add as a dependency. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 594 | func infra(b *specs.TasksCfgBuilder, name string) string { |
| 595 | b.MustAddTask(name, &specs.TaskSpec{ |
Eric Boren | ade6920 | 2017-04-13 10:00:43 -0400 | [diff] [blame] | 596 | CipdPackages: []*specs.CipdPackage{b.MustGetCipdPackageFromAsset("go")}, |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 597 | Dimensions: linuxGceDimensions(), |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 598 | ExtraArgs: []string{ |
Eric Boren | 768f52f | 2017-04-10 08:14:33 -0400 | [diff] [blame] | 599 | "--workdir", "../../..", "infra", |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 600 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 601 | fmt.Sprintf("buildername=%s", name), |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 602 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 603 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 604 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 605 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 606 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 607 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 608 | }, |
| 609 | Isolate: "infra_skia.isolate", |
| 610 | Priority: 0.8, |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 611 | }) |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 612 | return name |
| 613 | } |
| 614 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 615 | // doUpload indicates whether the given Job should upload its results. |
| 616 | func doUpload(name string) bool { |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 617 | for _, s := range CONFIG.NoUpload { |
| 618 | m, err := regexp.MatchString(s, name) |
| 619 | if err != nil { |
| 620 | glog.Fatal(err) |
| 621 | } |
| 622 | if m { |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 623 | return false |
| 624 | } |
| 625 | } |
| 626 | return true |
| 627 | } |
| 628 | |
| 629 | // test generates a Test task. Returns the name of the last task in the |
| 630 | // generated chain of tasks, which the Job should add as a dependency. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 631 | func test(b *specs.TasksCfgBuilder, name string, parts map[string]string, compileTaskName string, pkgs []*specs.CipdPackage) string { |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 632 | s := &specs.TaskSpec{ |
Eric Boren | 1f2f64b | 2016-11-09 18:35:15 -0500 | [diff] [blame] | 633 | CipdPackages: pkgs, |
| 634 | Dependencies: []string{compileTaskName}, |
| 635 | Dimensions: swarmDimensions(parts), |
| 636 | ExecutionTimeout: 4 * time.Hour, |
| 637 | Expiration: 20 * time.Hour, |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 638 | ExtraArgs: []string{ |
Eric Boren | 768f52f | 2017-04-10 08:14:33 -0400 | [diff] [blame] | 639 | "--workdir", "../../..", "test", |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 640 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 641 | fmt.Sprintf("buildername=%s", name), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 642 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 643 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 644 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
borenet | 98b2e7a | 2016-10-13 06:23:45 -0700 | [diff] [blame] | 645 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 646 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 647 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 648 | }, |
Eric Boren | 5d9f3bf | 2017-02-22 08:36:03 -0500 | [diff] [blame] | 649 | IoTimeout: 40 * time.Minute, |
| 650 | Isolate: "test_skia.isolate", |
| 651 | MaxAttempts: 1, |
| 652 | Priority: 0.8, |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 653 | } |
Eric Boren | 23a6ec6 | 2017-04-07 08:31:22 -0400 | [diff] [blame] | 654 | if useBundledRecipes(parts) { |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 655 | s.Dependencies = append(s.Dependencies, BUNDLE_RECIPES_NAME) |
Eric Boren | 23a6ec6 | 2017-04-07 08:31:22 -0400 | [diff] [blame] | 656 | if strings.Contains(parts["os"], "Win") { |
| 657 | s.Isolate = "test_skia_bundled_win.isolate" |
| 658 | } else { |
| 659 | s.Isolate = "test_skia_bundled_unix.isolate" |
| 660 | } |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 661 | } |
Kevin Lubick | 9018952 | 2017-05-15 08:30:27 -0400 | [diff] [blame] | 662 | if deps := getIsolatedCIPDDeps(parts); len(deps) > 0 { |
| 663 | s.Dependencies = append(s.Dependencies, deps...) |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 664 | } |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 665 | if strings.Contains(parts["extra_config"], "Valgrind") { |
| 666 | s.ExecutionTimeout = 9 * time.Hour |
| 667 | s.Expiration = 48 * time.Hour |
| 668 | s.IoTimeout = time.Hour |
Eric Boren | d696df7 | 2017-05-31 15:09:10 -0400 | [diff] [blame] | 669 | s.CipdPackages = append(s.CipdPackages, b.MustGetCipdPackageFromAsset("valgrind")) |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 670 | } else if strings.Contains(parts["extra_config"], "MSAN") { |
| 671 | s.ExecutionTimeout = 9 * time.Hour |
Ben Wagner | a6b2ba2 | 2017-06-08 10:34:17 -0400 | [diff] [blame] | 672 | } else if parts["arch"] == "x86" && parts["configuration"] == "Debug" { |
| 673 | // skia:6737 |
| 674 | s.ExecutionTimeout = 6 * time.Hour |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 675 | } |
| 676 | b.MustAddTask(name, s) |
| 677 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 678 | // Upload results if necessary. |
| 679 | if doUpload(name) { |
| 680 | uploadName := fmt.Sprintf("%s%s%s", PREFIX_UPLOAD, jobNameSchema.Sep, name) |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 681 | b.MustAddTask(uploadName, &specs.TaskSpec{ |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 682 | Dependencies: []string{name}, |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 683 | Dimensions: linuxGceDimensions(), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 684 | ExtraArgs: []string{ |
| 685 | "--workdir", "../../..", "upload_dm_results", |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 686 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 687 | fmt.Sprintf("buildername=%s", name), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 688 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 689 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 690 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
borenet | 98b2e7a | 2016-10-13 06:23:45 -0700 | [diff] [blame] | 691 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 692 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 693 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
Eric Boren | 965861b | 2017-02-06 15:38:41 -0500 | [diff] [blame] | 694 | fmt.Sprintf("gs_bucket=%s", CONFIG.GsBucketGm), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 695 | }, |
| 696 | Isolate: "upload_dm_results.isolate", |
| 697 | Priority: 0.8, |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 698 | }) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 699 | return uploadName |
| 700 | } |
| 701 | return name |
| 702 | } |
| 703 | |
| 704 | // perf generates a Perf task. Returns the name of the last task in the |
| 705 | // generated chain of tasks, which the Job should add as a dependency. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 706 | 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] | 707 | recipe := "perf" |
Kevin Lubick | b03b5ac | 2016-11-14 13:42:27 -0500 | [diff] [blame] | 708 | isolate := "perf_skia.isolate" |
| 709 | if strings.Contains(parts["extra_config"], "Skpbench") { |
Eric Boren | 768f52f | 2017-04-10 08:14:33 -0400 | [diff] [blame] | 710 | recipe = "skpbench" |
Kevin Lubick | b03b5ac | 2016-11-14 13:42:27 -0500 | [diff] [blame] | 711 | isolate = "skpbench_skia.isolate" |
Eric Boren | 23a6ec6 | 2017-04-07 08:31:22 -0400 | [diff] [blame] | 712 | if useBundledRecipes(parts) { |
| 713 | if strings.Contains(parts["os"], "Win") { |
| 714 | isolate = "skpbench_skia_bundled_win.isolate" |
| 715 | } else { |
| 716 | isolate = "skpbench_skia_bundled_unix.isolate" |
| 717 | } |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 718 | } |
Eric Boren | 23a6ec6 | 2017-04-07 08:31:22 -0400 | [diff] [blame] | 719 | } else if useBundledRecipes(parts) { |
| 720 | if strings.Contains(parts["os"], "Win") { |
| 721 | isolate = "perf_skia_bundled_win.isolate" |
| 722 | } else { |
| 723 | isolate = "perf_skia_bundled_unix.isolate" |
| 724 | } |
Kevin Lubick | b03b5ac | 2016-11-14 13:42:27 -0500 | [diff] [blame] | 725 | } |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 726 | s := &specs.TaskSpec{ |
Eric Boren | 1f2f64b | 2016-11-09 18:35:15 -0500 | [diff] [blame] | 727 | CipdPackages: pkgs, |
| 728 | Dependencies: []string{compileTaskName}, |
| 729 | Dimensions: swarmDimensions(parts), |
| 730 | ExecutionTimeout: 4 * time.Hour, |
| 731 | Expiration: 20 * time.Hour, |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 732 | ExtraArgs: []string{ |
Kevin Lubick | b03b5ac | 2016-11-14 13:42:27 -0500 | [diff] [blame] | 733 | "--workdir", "../../..", recipe, |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 734 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 735 | fmt.Sprintf("buildername=%s", name), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 736 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 737 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 738 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
borenet | 98b2e7a | 2016-10-13 06:23:45 -0700 | [diff] [blame] | 739 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 740 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 741 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 742 | }, |
Eric Boren | 5d9f3bf | 2017-02-22 08:36:03 -0500 | [diff] [blame] | 743 | IoTimeout: 40 * time.Minute, |
| 744 | Isolate: isolate, |
| 745 | MaxAttempts: 1, |
| 746 | Priority: 0.8, |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 747 | } |
Eric Boren | 23a6ec6 | 2017-04-07 08:31:22 -0400 | [diff] [blame] | 748 | if useBundledRecipes(parts) { |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 749 | s.Dependencies = append(s.Dependencies, BUNDLE_RECIPES_NAME) |
| 750 | } |
Kevin Lubick | 9018952 | 2017-05-15 08:30:27 -0400 | [diff] [blame] | 751 | if deps := getIsolatedCIPDDeps(parts); len(deps) > 0 { |
| 752 | s.Dependencies = append(s.Dependencies, deps...) |
| 753 | } |
| 754 | |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 755 | if strings.Contains(parts["extra_config"], "Valgrind") { |
| 756 | s.ExecutionTimeout = 9 * time.Hour |
| 757 | s.Expiration = 48 * time.Hour |
| 758 | s.IoTimeout = time.Hour |
Eric Boren | c5a073d | 2017-06-01 07:13:33 -0400 | [diff] [blame] | 759 | s.CipdPackages = append(s.CipdPackages, b.MustGetCipdPackageFromAsset("valgrind")) |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 760 | } else if strings.Contains(parts["extra_config"], "MSAN") { |
| 761 | s.ExecutionTimeout = 9 * time.Hour |
Ben Wagner | a6b2ba2 | 2017-06-08 10:34:17 -0400 | [diff] [blame] | 762 | } else if parts["arch"] == "x86" && parts["configuration"] == "Debug" { |
| 763 | // skia:6737 |
| 764 | s.ExecutionTimeout = 6 * time.Hour |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 765 | } |
| 766 | b.MustAddTask(name, s) |
| 767 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 768 | // Upload results if necessary. |
| 769 | if strings.Contains(name, "Release") && doUpload(name) { |
| 770 | uploadName := fmt.Sprintf("%s%s%s", PREFIX_UPLOAD, jobNameSchema.Sep, name) |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 771 | b.MustAddTask(uploadName, &specs.TaskSpec{ |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 772 | Dependencies: []string{name}, |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 773 | Dimensions: linuxGceDimensions(), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 774 | ExtraArgs: []string{ |
| 775 | "--workdir", "../../..", "upload_nano_results", |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 776 | fmt.Sprintf("repository=%s", specs.PLACEHOLDER_REPO), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 777 | fmt.Sprintf("buildername=%s", name), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 778 | fmt.Sprintf("swarm_out_dir=%s", specs.PLACEHOLDER_ISOLATED_OUTDIR), |
| 779 | fmt.Sprintf("revision=%s", specs.PLACEHOLDER_REVISION), |
Eric Boren | 0941950 | 2017-04-21 09:37:37 -0400 | [diff] [blame] | 780 | fmt.Sprintf("patch_repo=%s", specs.PLACEHOLDER_PATCH_REPO), |
borenet | 98b2e7a | 2016-10-13 06:23:45 -0700 | [diff] [blame] | 781 | fmt.Sprintf("patch_storage=%s", specs.PLACEHOLDER_PATCH_STORAGE), |
skia.buildbots | 2478c73 | 2016-11-04 14:37:26 -0400 | [diff] [blame] | 782 | fmt.Sprintf("patch_issue=%s", specs.PLACEHOLDER_ISSUE), |
| 783 | fmt.Sprintf("patch_set=%s", specs.PLACEHOLDER_PATCHSET), |
Eric Boren | 965861b | 2017-02-06 15:38:41 -0500 | [diff] [blame] | 784 | fmt.Sprintf("gs_bucket=%s", CONFIG.GsBucketNano), |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 785 | }, |
| 786 | Isolate: "upload_nano_results.isolate", |
| 787 | Priority: 0.8, |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 788 | }) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 789 | return uploadName |
| 790 | } |
| 791 | return name |
| 792 | } |
| 793 | |
| 794 | // process generates tasks and jobs for the given job name. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 795 | func process(b *specs.TasksCfgBuilder, name string) { |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 796 | deps := []string{} |
| 797 | |
Eric Boren | 8b3f9e6 | 2017-04-04 09:06:16 -0400 | [diff] [blame] | 798 | // Bundle Recipes. |
| 799 | if name == BUNDLE_RECIPES_NAME { |
| 800 | deps = append(deps, bundleRecipes(b)) |
| 801 | } |
| 802 | |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 803 | // Isolate CIPD assets. |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 804 | if _, ok := ISOLATE_ASSET_MAPPING[name]; ok { |
| 805 | deps = append(deps, isolateCIPDAsset(b, name)) |
| 806 | } |
| 807 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 808 | parts, err := jobNameSchema.ParseJobName(name) |
| 809 | if err != nil { |
| 810 | glog.Fatal(err) |
| 811 | } |
| 812 | |
| 813 | // RecreateSKPs. |
| 814 | if strings.Contains(name, "RecreateSKPs") { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 815 | deps = append(deps, recreateSKPs(b, name)) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 816 | } |
| 817 | |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 818 | // UpdateMetaConfig bot. |
| 819 | if strings.Contains(name, "UpdateMetaConfig") { |
| 820 | deps = append(deps, updateMetaConfig(b, name)) |
| 821 | } |
| 822 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 823 | // CT bots. |
| 824 | if strings.Contains(name, "-CT_") { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 825 | deps = append(deps, ctSKPs(b, name)) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 826 | } |
| 827 | |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 828 | // Infra tests. |
| 829 | if name == "Housekeeper-PerCommit-InfraTests" { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 830 | deps = append(deps, infra(b, name)) |
borenet | 2dbbfa5 | 2016-10-14 06:32:09 -0700 | [diff] [blame] | 831 | } |
| 832 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 833 | // Compile bots. |
| 834 | if parts["role"] == "Build" { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 835 | deps = append(deps, compile(b, name, parts)) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 836 | } |
| 837 | |
Eric Boren | f5a90e8 | 2016-11-15 15:18:20 -0500 | [diff] [blame] | 838 | // Most remaining bots need a compile task. |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 839 | compileTaskName := deriveCompileTaskName(name, parts) |
borenet | 5238343 | 2016-10-17 10:17:53 -0700 | [diff] [blame] | 840 | compileTaskParts, err := jobNameSchema.ParseJobName(compileTaskName) |
| 841 | if err != nil { |
| 842 | glog.Fatal(err) |
| 843 | } |
Eric Boren | 628e78b | 2016-11-17 11:33:27 -0500 | [diff] [blame] | 844 | // These bots do not need a compile task. |
Eric Boren | f5a90e8 | 2016-11-15 15:18:20 -0500 | [diff] [blame] | 845 | if parts["role"] != "Build" && |
Eric Boren | b8ab7f7 | 2017-04-10 11:00:09 -0400 | [diff] [blame] | 846 | name != "Housekeeper-PerCommit-BundleRecipes" && |
Eric Boren | f5a90e8 | 2016-11-15 15:18:20 -0500 | [diff] [blame] | 847 | name != "Housekeeper-PerCommit-InfraTests" && |
Eric Boren | 71b762f | 2016-11-30 14:05:16 -0500 | [diff] [blame] | 848 | !strings.Contains(name, "RecreateSKPs") && |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 849 | !strings.Contains(name, "UpdateMetaConfig") && |
Ben Wagner | 50b8468 | 2017-06-12 13:03:29 -0400 | [diff] [blame] | 850 | !strings.Contains(name, "-CT_") && |
| 851 | !strings.Contains(name, "Housekeeper-PerCommit-Isolate") { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 852 | compile(b, compileTaskName, compileTaskParts) |
borenet | 5238343 | 2016-10-17 10:17:53 -0700 | [diff] [blame] | 853 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 854 | |
| 855 | // Housekeeper. |
Eric Boren | 22f5ef7 | 2016-12-02 11:01:33 -0500 | [diff] [blame] | 856 | if name == "Housekeeper-PerCommit" { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 857 | deps = append(deps, housekeeper(b, name, compileTaskName)) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 858 | } |
| 859 | |
| 860 | // Common assets needed by the remaining bots. |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 861 | |
| 862 | pkgs := []*specs.CipdPackage{} |
| 863 | |
Kevin Lubick | 9018952 | 2017-05-15 08:30:27 -0400 | [diff] [blame] | 864 | if deps := getIsolatedCIPDDeps(parts); len(deps) == 0 { |
Kevin Lubick | 0707294 | 2017-05-11 13:35:23 -0400 | [diff] [blame] | 865 | pkgs = []*specs.CipdPackage{ |
| 866 | b.MustGetCipdPackageFromAsset("skimage"), |
| 867 | b.MustGetCipdPackageFromAsset("skp"), |
| 868 | b.MustGetCipdPackageFromAsset("svg"), |
| 869 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 870 | } |
Kevin Lubick | 9018952 | 2017-05-15 08:30:27 -0400 | [diff] [blame] | 871 | |
Eric Boren | 4b254b9 | 2016-11-08 12:55:32 -0500 | [diff] [blame] | 872 | if strings.Contains(name, "Ubuntu") && strings.Contains(name, "SAN") { |
| 873 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("clang_linux")) |
| 874 | } |
Kevin Lubick | 35115eb | 2017-02-17 10:25:34 -0500 | [diff] [blame] | 875 | if strings.Contains(name, "Ubuntu16") { |
| 876 | if strings.Contains(name, "Vulkan") { |
| 877 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("linux_vulkan_sdk")) |
| 878 | } |
Kevin Lubick | 0a51b48 | 2017-02-06 12:45:29 -0500 | [diff] [blame] | 879 | if strings.Contains(name, "Release") { |
| 880 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("linux_vulkan_intel_driver_release")) |
| 881 | } else { |
| 882 | pkgs = append(pkgs, b.MustGetCipdPackageFromAsset("linux_vulkan_intel_driver_debug")) |
| 883 | } |
| 884 | } |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 885 | |
| 886 | // Test bots. |
Eric Boren | 71b762f | 2016-11-30 14:05:16 -0500 | [diff] [blame] | 887 | if parts["role"] == "Test" && !strings.Contains(name, "-CT_") { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 888 | deps = append(deps, test(b, name, parts, compileTaskName, pkgs)) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 889 | } |
| 890 | |
| 891 | // Perf bots. |
Eric Boren | 71b762f | 2016-11-30 14:05:16 -0500 | [diff] [blame] | 892 | if parts["role"] == "Perf" && !strings.Contains(name, "-CT_") { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 893 | deps = append(deps, perf(b, name, parts, compileTaskName, pkgs)) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 894 | } |
| 895 | |
| 896 | // Add the Job spec. |
Eric Boren | f5a90e8 | 2016-11-15 15:18:20 -0500 | [diff] [blame] | 897 | j := &specs.JobSpec{ |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 898 | Priority: 0.8, |
| 899 | TaskSpecs: deps, |
Eric Boren | f5a90e8 | 2016-11-15 15:18:20 -0500 | [diff] [blame] | 900 | } |
| 901 | if name == "Housekeeper-Nightly-RecreateSKPs_Canary" { |
| 902 | j.Trigger = "nightly" |
| 903 | } |
Ravi Mistry | 01b48e7 | 2017-05-17 14:28:06 -0400 | [diff] [blame] | 904 | if name == "Housekeeper-Nightly-UpdateMetaConfig" { |
| 905 | j.Trigger = "nightly" |
| 906 | } |
Eric Boren | f5a90e8 | 2016-11-15 15:18:20 -0500 | [diff] [blame] | 907 | if name == "Housekeeper-Weekly-RecreateSKPs" { |
| 908 | j.Trigger = "weekly" |
| 909 | } |
Eric Boren | 71b762f | 2016-11-30 14:05:16 -0500 | [diff] [blame] | 910 | if name == "Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Debug-CT_DM_1m_SKPs" { |
| 911 | j.Trigger = "weekly" |
| 912 | } |
Eric Boren | 8615fe5 | 2016-12-12 14:30:12 -0500 | [diff] [blame] | 913 | b.MustAddJob(name, j) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 914 | } |
| 915 | |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 916 | func loadJson(flag *string, defaultFlag string, val interface{}) { |
| 917 | if *flag == "" { |
| 918 | *flag = defaultFlag |
| 919 | } |
| 920 | b, err := ioutil.ReadFile(*flag) |
| 921 | if err != nil { |
| 922 | glog.Fatal(err) |
| 923 | } |
| 924 | if err := json.Unmarshal(b, val); err != nil { |
| 925 | glog.Fatal(err) |
| 926 | } |
| 927 | } |
| 928 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 929 | // Regenerate the tasks.json file. |
| 930 | func main() { |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 931 | b := specs.MustNewTasksCfgBuilder() |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 932 | b.SetAssetsDir(*assetsDir) |
| 933 | infraBots := path.Join(b.CheckoutRoot(), "infra", "bots") |
| 934 | |
| 935 | // Load the jobs from a JSON file. |
| 936 | loadJson(jobsFile, path.Join(infraBots, "jobs.json"), &JOBS) |
| 937 | |
Eric Boren | 2722549 | 2017-02-01 15:56:55 -0500 | [diff] [blame] | 938 | // Load general config information from a JSON file. |
| 939 | loadJson(cfgFile, path.Join(infraBots, "cfg.json"), &CONFIG) |
| 940 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 941 | // Create the JobNameSchema. |
Eric Boren | 1f8be68 | 2017-02-07 09:16:30 -0500 | [diff] [blame] | 942 | if *builderNameSchemaFile == "" { |
| 943 | *builderNameSchemaFile = path.Join(b.CheckoutRoot(), "infra", "bots", "recipe_modules", "builder_name_schema", "builder_name_schema.json") |
| 944 | } |
| 945 | schema, err := NewJobNameSchema(*builderNameSchemaFile) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 946 | if err != nil { |
| 947 | glog.Fatal(err) |
| 948 | } |
| 949 | jobNameSchema = schema |
| 950 | |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 951 | // Create Tasks and Jobs. |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 952 | for _, name := range JOBS { |
| 953 | process(b, name) |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 954 | } |
| 955 | |
borenet | ed20a70 | 2016-10-20 11:04:31 -0700 | [diff] [blame] | 956 | b.MustFinish() |
borenet | db182c7 | 2016-09-30 12:53:12 -0700 | [diff] [blame] | 957 | } |
| 958 | |
| 959 | // TODO(borenet): The below really belongs in its own file, probably next to the |
| 960 | // builder_name_schema.json file. |
| 961 | |
| 962 | // JobNameSchema is a struct used for (de)constructing Job names in a |
| 963 | // predictable format. |
| 964 | type JobNameSchema struct { |
| 965 | Schema map[string][]string `json:"builder_name_schema"` |
| 966 | Sep string `json:"builder_name_sep"` |
| 967 | } |
| 968 | |
| 969 | // NewJobNameSchema returns a JobNameSchema instance based on the given JSON |
| 970 | // file. |
| 971 | func NewJobNameSchema(jsonFile string) (*JobNameSchema, error) { |
| 972 | var rv JobNameSchema |
| 973 | f, err := os.Open(jsonFile) |
| 974 | if err != nil { |
| 975 | return nil, err |
| 976 | } |
| 977 | defer util.Close(f) |
| 978 | if err := json.NewDecoder(f).Decode(&rv); err != nil { |
| 979 | return nil, err |
| 980 | } |
| 981 | return &rv, nil |
| 982 | } |
| 983 | |
| 984 | // ParseJobName splits the given Job name into its component parts, according |
| 985 | // to the schema. |
| 986 | func (s *JobNameSchema) ParseJobName(n string) (map[string]string, error) { |
| 987 | split := strings.Split(n, s.Sep) |
| 988 | if len(split) < 2 { |
| 989 | return nil, fmt.Errorf("Invalid job name: %q", n) |
| 990 | } |
| 991 | role := split[0] |
| 992 | split = split[1:] |
| 993 | keys, ok := s.Schema[role] |
| 994 | if !ok { |
| 995 | return nil, fmt.Errorf("Invalid job name; %q is not a valid role.", role) |
| 996 | } |
| 997 | extraConfig := "" |
| 998 | if len(split) == len(keys)+1 { |
| 999 | extraConfig = split[len(split)-1] |
| 1000 | split = split[:len(split)-1] |
| 1001 | } |
| 1002 | if len(split) != len(keys) { |
| 1003 | return nil, fmt.Errorf("Invalid job name; %q has incorrect number of parts.", n) |
| 1004 | } |
| 1005 | rv := make(map[string]string, len(keys)+2) |
| 1006 | rv["role"] = role |
| 1007 | if extraConfig != "" { |
| 1008 | rv["extra_config"] = extraConfig |
| 1009 | } |
| 1010 | for i, k := range keys { |
| 1011 | rv[k] = split[i] |
| 1012 | } |
| 1013 | return rv, nil |
| 1014 | } |
| 1015 | |
| 1016 | // MakeJobName assembles the given parts of a Job name, according to the schema. |
| 1017 | func (s *JobNameSchema) MakeJobName(parts map[string]string) (string, error) { |
| 1018 | role, ok := parts["role"] |
| 1019 | if !ok { |
| 1020 | return "", fmt.Errorf("Invalid job parts; jobs must have a role.") |
| 1021 | } |
| 1022 | keys, ok := s.Schema[role] |
| 1023 | if !ok { |
| 1024 | return "", fmt.Errorf("Invalid job parts; unknown role %q", role) |
| 1025 | } |
| 1026 | rvParts := make([]string, 0, len(parts)) |
| 1027 | rvParts = append(rvParts, role) |
| 1028 | for _, k := range keys { |
| 1029 | v, ok := parts[k] |
| 1030 | if !ok { |
| 1031 | return "", fmt.Errorf("Invalid job parts; missing %q", k) |
| 1032 | } |
| 1033 | rvParts = append(rvParts, v) |
| 1034 | } |
| 1035 | if _, ok := parts["extra_config"]; ok { |
| 1036 | rvParts = append(rvParts, parts["extra_config"]) |
| 1037 | } |
| 1038 | return strings.Join(rvParts, s.Sep), nil |
| 1039 | } |