[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 <rmistry@google.com>
This commit is contained in:
Kevin Lubick 2021-12-20 08:08:14 -05:00
parent ec481097c2
commit f70746701c
2 changed files with 33 additions and 21 deletions

View File

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

View File

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