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