diff --git a/infra/bots/gen_tasks.go b/infra/bots/gen_tasks.go index 5ec6e79ada..95d8589e29 100644 --- a/infra/bots/gen_tasks.go +++ b/infra/bots/gen_tasks.go @@ -126,6 +126,12 @@ var ( Path: "cache/git_cache", }, } + CACHES_GO = []*specs.Cache{ + &specs.Cache{ + Name: "go_cache", + Path: "cache/go_cache", + }, + } CACHES_WORKDIR = []*specs.Cache{ &specs.Cache{ Name: "work", @@ -778,6 +784,15 @@ func usesGit(t *specs.TaskSpec, name string) { t.CipdPackages = append(t.CipdPackages, CIPD_PKGS_GIT...) } +// usesGo adds attributes to tasks which use go. Recipes should use +// "with api.context(env=api.infra.go_env)". +// (Not needed for tasks that just want to run Go code from the infra repo -- instead use go_deps.) +func usesGo(b *specs.TasksCfgBuilder, t *specs.TaskSpec) { + t.Caches = append(t.Caches, CACHES_GO...) + t.CipdPackages = append(t.CipdPackages, b.MustGetCipdPackageFromAsset("go")) + t.Dependencies = append(t.Dependencies, isolateCIPDAsset(b, ISOLATE_GO_DEPS_NAME)) +} + // usesDocker adds attributes to tasks which use docker. func usesDocker(t *specs.TaskSpec, name string) { // currently, just the WASM (using EMCC) builder uses Docker. @@ -926,8 +941,7 @@ func recreateSKPs(b *specs.TasksCfgBuilder, name string) string { } task := kitchenTask(name, "recreate_skps", "swarm_recipe.isolate", SERVICE_ACCOUNT_RECREATE_SKPS, dims, nil, OUTPUT_NONE) task.CipdPackages = append(task.CipdPackages, CIPD_PKGS_GIT...) - task.CipdPackages = append(task.CipdPackages, b.MustGetCipdPackageFromAsset("go")) - task.Dependencies = append(task.Dependencies, isolateCIPDAsset(b, ISOLATE_GO_DEPS_NAME)) + usesGo(b, task) timeout(task, 4*time.Hour) b.MustAddTask(name, task) return name @@ -940,8 +954,7 @@ func updateGoDEPS(b *specs.TasksCfgBuilder, name string) string { dims := linuxGceDimensions(MACHINE_TYPE_LARGE) task := kitchenTask(name, "update_go_deps", "swarm_recipe.isolate", SERVICE_ACCOUNT_UPDATE_GO_DEPS, dims, nil, OUTPUT_NONE) task.CipdPackages = append(task.CipdPackages, CIPD_PKGS_GIT...) - task.CipdPackages = append(task.CipdPackages, b.MustGetCipdPackageFromAsset("go")) - task.Dependencies = append(task.Dependencies, isolateCIPDAsset(b, ISOLATE_GO_DEPS_NAME)) + usesGo(b, task) b.MustAddTask(name, task) return name } @@ -991,8 +1004,7 @@ func androidFrameworkCompile(b *specs.TasksCfgBuilder, name string) string { func infra(b *specs.TasksCfgBuilder, name string) string { task := kitchenTask(name, "infra", "swarm_recipe.isolate", SERVICE_ACCOUNT_COMPILE, linuxGceDimensions(MACHINE_TYPE_SMALL), nil, OUTPUT_NONE) usesGit(task, name) - task.CipdPackages = append(task.CipdPackages, b.MustGetCipdPackageFromAsset("go")) - task.Dependencies = append(task.Dependencies, isolateCIPDAsset(b, ISOLATE_GO_DEPS_NAME)) + usesGo(b, task) b.MustAddTask(name, task) return name } diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Test-Debian9-Clang-GCE-CPU-AVX2-universal-devrel-All-Android_SKQP.json b/infra/bots/recipe_modules/build/examples/full.expected/Test-Debian9-Clang-GCE-CPU-AVX2-universal-devrel-All-Android_SKQP.json index 6445a0928b..af18cbd23d 100644 --- a/infra/bots/recipe_modules/build/examples/full.expected/Test-Debian9-Clang-GCE-CPU-AVX2-universal-devrel-All-Android_SKQP.json +++ b/infra/bots/recipe_modules/build/examples/full.expected/Test-Debian9-Clang-GCE-CPU-AVX2-universal-devrel-All-Android_SKQP.json @@ -38,6 +38,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" diff --git a/infra/bots/recipe_modules/infra/api.py b/infra/bots/recipe_modules/infra/api.py index 21c8f73123..f886cdf7ec 100644 --- a/infra/bots/recipe_modules/infra/api.py +++ b/infra/bots/recipe_modules/infra/api.py @@ -27,6 +27,7 @@ class InfraApi(recipe_api.RecipeApi): @property def go_env(self): return { + 'GOCACHE': self.m.vars.cache_dir.join('go_cache'), 'GOPATH': self.gopath, 'GOROOT': self.goroot, 'PATH': '%s:%s:%%(PATH)s' % (self.go_bin, self.gopath.join('bin')), diff --git a/infra/bots/recipe_modules/infra/examples/full.expected/infra_tests.json b/infra/bots/recipe_modules/infra/examples/full.expected/infra_tests.json index 959f3a07c8..9f5a978892 100644 --- a/infra/bots/recipe_modules/infra/examples/full.expected/infra_tests.json +++ b/infra/bots/recipe_modules/infra/examples/full.expected/infra_tests.json @@ -6,6 +6,7 @@ ], "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -19,6 +20,7 @@ ], "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" diff --git a/infra/bots/recipes/bookmaker.expected/nightly_bookmaker.json b/infra/bots/recipes/bookmaker.expected/nightly_bookmaker.json index a9006c8a5b..7295facb33 100644 --- a/infra/bots/recipes/bookmaker.expected/nightly_bookmaker.json +++ b/infra/bots/recipes/bookmaker.expected/nightly_bookmaker.json @@ -104,6 +104,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -118,6 +119,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -139,6 +141,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -158,6 +161,7 @@ ], "cwd": "[START_DIR]/cache/work/skia", "env": { + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin:" @@ -173,6 +177,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -191,6 +196,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" diff --git a/infra/bots/recipes/bookmaker.expected/nightly_failed_extract_fiddles.json b/infra/bots/recipes/bookmaker.expected/nightly_failed_extract_fiddles.json index 5f4dcc8578..e68670e872 100644 --- a/infra/bots/recipes/bookmaker.expected/nightly_failed_extract_fiddles.json +++ b/infra/bots/recipes/bookmaker.expected/nightly_failed_extract_fiddles.json @@ -104,6 +104,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" diff --git a/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddlecli.json b/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddlecli.json index 2b8261079f..607b793801 100644 --- a/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddlecli.json +++ b/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddlecli.json @@ -104,6 +104,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -118,6 +119,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -139,6 +141,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" diff --git a/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddles.json b/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddles.json index 472a97d9da..8eb10c5582 100644 --- a/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddles.json +++ b/infra/bots/recipes/bookmaker.expected/nightly_failed_fiddles.json @@ -104,6 +104,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -118,6 +119,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -139,6 +141,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -158,6 +161,7 @@ ], "cwd": "[START_DIR]/cache/work/skia", "env": { + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin:" @@ -173,6 +177,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" diff --git a/infra/bots/recipes/bookmaker.expected/nightly_failed_upload.json b/infra/bots/recipes/bookmaker.expected/nightly_failed_upload.json index 14f231e826..90a5ed4a2a 100644 --- a/infra/bots/recipes/bookmaker.expected/nightly_failed_upload.json +++ b/infra/bots/recipes/bookmaker.expected/nightly_failed_upload.json @@ -104,6 +104,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -118,6 +119,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -139,6 +141,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" @@ -157,6 +160,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" diff --git a/infra/bots/recipes/bookmaker.expected/percommit_bookmaker.json b/infra/bots/recipes/bookmaker.expected/percommit_bookmaker.json index 20a515eed9..0230b60a8d 100644 --- a/infra/bots/recipes/bookmaker.expected/percommit_bookmaker.json +++ b/infra/bots/recipes/bookmaker.expected/percommit_bookmaker.json @@ -103,6 +103,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" diff --git a/infra/bots/recipes/bookmaker.expected/percommit_failed_validation.json b/infra/bots/recipes/bookmaker.expected/percommit_failed_validation.json index 5d0ca32619..a1f1aaf215 100644 --- a/infra/bots/recipes/bookmaker.expected/percommit_failed_validation.json +++ b/infra/bots/recipes/bookmaker.expected/percommit_failed_validation.json @@ -103,6 +103,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" diff --git a/infra/bots/recipes/infra.expected/infra_tests.json b/infra/bots/recipes/infra.expected/infra_tests.json index 9125bc56a0..8770e30d00 100644 --- a/infra/bots/recipes/infra.expected/infra_tests.json +++ b/infra/bots/recipes/infra.expected/infra_tests.json @@ -102,6 +102,7 @@ ], "cwd": "[START_DIR]/cache/work/skia", "env": { + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin:" diff --git a/infra/bots/recipes/recreate_skps.expected/Housekeeper-Weekly-RecreateSKPs.json b/infra/bots/recipes/recreate_skps.expected/Housekeeper-Weekly-RecreateSKPs.json index ae5a0fc164..d8ad6811aa 100644 --- a/infra/bots/recipes/recreate_skps.expected/Housekeeper-Weekly-RecreateSKPs.json +++ b/infra/bots/recipes/recreate_skps.expected/Housekeeper-Weekly-RecreateSKPs.json @@ -213,6 +213,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" diff --git a/infra/bots/recipes/recreate_skps.expected/failed_upload.json b/infra/bots/recipes/recreate_skps.expected/failed_upload.json index 7856b1dfa4..11d4b5bef1 100644 --- a/infra/bots/recipes/recreate_skps.expected/failed_upload.json +++ b/infra/bots/recipes/recreate_skps.expected/failed_upload.json @@ -213,6 +213,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" diff --git a/infra/bots/recipes/update_go_deps.expected/Housekeeper-Nightly-UpdateGoDEPS.json b/infra/bots/recipes/update_go_deps.expected/Housekeeper-Nightly-UpdateGoDEPS.json index c10cc536df..82f5f35c99 100644 --- a/infra/bots/recipes/update_go_deps.expected/Housekeeper-Nightly-UpdateGoDEPS.json +++ b/infra/bots/recipes/update_go_deps.expected/Housekeeper-Nightly-UpdateGoDEPS.json @@ -102,6 +102,7 @@ "cwd": "[START_DIR]/cache/work/skia", "env": { "CHROME_HEADLESS": "1", + "GOCACHE": "[START_DIR]/cache/go_cache", "GOPATH": "[START_DIR]/go_deps", "GOROOT": "[START_DIR]/go/go", "PATH": "[START_DIR]/go/go/bin:[START_DIR]/go_deps/bin::RECIPE_PACKAGE_REPO[depot_tools]" diff --git a/infra/bots/tasks.json b/infra/bots/tasks.json index 47aa1a8f38..be980fc3e8 100755 --- a/infra/bots/tasks.json +++ b/infra/bots/tasks.json @@ -19072,6 +19072,10 @@ { "name": "vpython", "path": "cache/vpython" + }, + { + "name": "go_cache", + "path": "cache/go_cache" } ], "cipd_packages": [ @@ -19184,6 +19188,10 @@ { "name": "vpython", "path": "cache/vpython" + }, + { + "name": "go_cache", + "path": "cache/go_cache" } ], "cipd_packages": [ @@ -19810,6 +19818,10 @@ { "name": "work", "path": "cache/work" + }, + { + "name": "go_cache", + "path": "cache/go_cache" } ], "cipd_packages": [ @@ -20086,6 +20098,10 @@ { "name": "vpython", "path": "cache/vpython" + }, + { + "name": "go_cache", + "path": "cache/go_cache" } ], "cipd_packages": [