From f70746701c18bf970c47e6af27cd31b67392329e Mon Sep 17 00:00:00 2001 From: Kevin Lubick Date: Mon, 20 Dec 2021 08:08:14 -0500 Subject: [PATCH] [infra] Deploy particles using Bazel version Requires https://skia-review.googlesource.com/c/buildbot/+/485556 to land. Change-Id: Id8090271415ce461eee9c8be4b0776ee823ddc7a Bug: skia:10614 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/485936 Reviewed-by: Ravi Mistry --- .../push_apps_from_wasm_image.go | 24 ++------------- .../push_bazel_apps_from_wasm_image.go | 30 +++++++++++++++++++ 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/infra/bots/task_drivers/push_apps_from_wasm_image/push_apps_from_wasm_image.go b/infra/bots/task_drivers/push_apps_from_wasm_image/push_apps_from_wasm_image.go index 3ee7f36e2c..ded0df0a7d 100644 --- a/infra/bots/task_drivers/push_apps_from_wasm_image/push_apps_from_wasm_image.go +++ b/infra/bots/task_drivers/push_apps_from_wasm_image/push_apps_from_wasm_image.go @@ -44,10 +44,9 @@ var ( ) const ( - debuggerImageName = "debugger-app" - particlesImageName = "particles" - shaderImageName = "shaders" - skottieImageName = "skottie" + debuggerImageName = "debugger-app" + shaderImageName = "shaders" + skottieImageName = "skottie" ) var ( @@ -71,20 +70,6 @@ func buildPushSkottieImage(ctx context.Context, tag, repo, wasmProductsDir, conf return docker.BuildPushImageFromInfraImage(ctx, "Skottie", image, tag, repo, configDir, tempDir, "prod", topic, cmd, volumes, infraCommonEnv, nil) } -func buildPushParticlesImage(ctx context.Context, tag, repo, wasmProductsDir, configDir string, topic *pubsub.Topic) error { - tempDir, err := os_steps.TempDir(ctx, "", "") - if err != nil { - return err - } - image := fmt.Sprintf("gcr.io/skia-public/%s", particlesImageName) - cmd := []string{"/bin/sh", "-c", "cd /home/skia/golib/src/go.skia.org/infra/particles && make release_ci"} - volumes := []string{ - fmt.Sprintf("%s:/OUT", wasmProductsDir), - fmt.Sprintf("%s:/WORKSPACE", tempDir), - } - return docker.BuildPushImageFromInfraImage(ctx, "Particles", image, tag, repo, configDir, tempDir, "prod", topic, cmd, volumes, infraCommonEnv, nil) -} - func buildPushDebuggerImage(ctx context.Context, tag, repo, wasmProductsDir, configDir string, topic *pubsub.Topic) error { tempDir, err := os_steps.TempDir(ctx, "", "") if err != nil { @@ -185,9 +170,6 @@ func main() { if err := buildPushSkottieImage(ctx, tag, rs.Repo, wasmProductsDir, configDir, topic); err != nil { td.Fatal(ctx, err) } - if err := buildPushParticlesImage(ctx, tag, rs.Repo, wasmProductsDir, configDir, topic); err != nil { - td.Fatal(ctx, err) - } if err := buildPushDebuggerImage(ctx, tag, rs.Repo, wasmProductsDir, configDir, topic); err != nil { td.Fatal(ctx, err) } diff --git a/infra/bots/task_drivers/push_bazel_apps_from_wasm_image/push_bazel_apps_from_wasm_image.go b/infra/bots/task_drivers/push_bazel_apps_from_wasm_image/push_bazel_apps_from_wasm_image.go index 1261b5a6d2..745c32e18c 100644 --- a/infra/bots/task_drivers/push_bazel_apps_from_wasm_image/push_bazel_apps_from_wasm_image.go +++ b/infra/bots/task_drivers/push_bazel_apps_from_wasm_image/push_bazel_apps_from_wasm_image.go @@ -124,6 +124,10 @@ func main() { td.Fatal(ctx, err) } + if err := buildPushParticles(ctx, wasmProductsDir, checkoutDir, *skiaRevision, topic); err != nil { + td.Fatal(ctx, err) + } + // Remove all temporary files from the host machine. Swarming gets upset if there are root-owned // files it cannot clean up. cleanupCmd := []string{"/bin/sh", "-c", "rm -rf /OUT/*"} @@ -158,6 +162,32 @@ func buildPushJSFiddle(ctx context.Context, wasmProductsDir, checkoutDir, skiaRe return publishToTopic(ctx, "gcr.io/skia-public/jsfiddle", skiaRevision, topic) } +func buildPushParticles(ctx context.Context, wasmProductsDir, checkoutDir, skiaRevision string, topic *pubsub.Topic) error { + err := td.Do(ctx, td.Props("Build particles image").Infra(), func(ctx context.Context) error { + runCmd := &sk_exec.Command{ + Name: "make", + Args: []string{"bazel_release_ci"}, + InheritEnv: true, + Env: []string{ + "COPY_FROM_DIR=" + wasmProductsDir, + "STABLE_DOCKER_TAG=" + skiaRevision, + }, + Dir: filepath.Join(checkoutDir, "particles"), + LogStdout: true, + LogStderr: true, + } + _, err := sk_exec.RunCommand(ctx, runCmd) + if err != nil { + return err + } + return nil + }) + if err != nil { + return err + } + return publishToTopic(ctx, "gcr.io/skia-public/particles", skiaRevision, topic) +} + // changeBazelCacheDir writes an entry to the user's bazelrc file that will make all invocations of // bazel use the given directory as their cache file. // TODO(kjlubick) Migrate this to be something more generic like "Ensure BazelRC file" and take in