[infra] Set GOCACHE in tasks that use go.

Bug: skia:8423
Change-Id: If079c958cb9d0d82fe13da44aaebd5913b40b9d1
Reviewed-on: https://skia-review.googlesource.com/c/179065
Auto-Submit: Ben Wagner <benjaminwagner@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
This commit is contained in:
Ben Wagner 2018-12-18 23:42:11 -05:00 committed by Skia Commit-Bot
parent 257a03dde2
commit bb7d3813d3
16 changed files with 63 additions and 6 deletions

View File

@ -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
}

View File

@ -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:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"

View File

@ -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')),

View File

@ -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:<PATH>: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:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"

View File

@ -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:<PATH>: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:<PATH>: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:<PATH>: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:<PATH>"
@ -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:<PATH>: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:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"

View File

@ -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:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"

View File

@ -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:<PATH>: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:<PATH>: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:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"

View File

@ -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:<PATH>: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:<PATH>: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:<PATH>: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:<PATH>"
@ -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:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"

View File

@ -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:<PATH>: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:<PATH>: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:<PATH>: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:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"

View File

@ -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:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"

View File

@ -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:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"

View File

@ -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:<PATH>"

View File

@ -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:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"

View File

@ -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:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"

View File

@ -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:<PATH>:RECIPE_PACKAGE_REPO[depot_tools]"

View File

@ -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": [