[bazel] Move cache location to bigger disk for CI tasks
Change-Id: If6095a0ba5b40fb6b15f46721b5621b7bcfc0b33 Bug: skia:12738 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/484997 Reviewed-by: Ravi Mistry <rmistry@google.com>
This commit is contained in:
parent
68a364c9bc
commit
a3e1e8acf9
@ -115,6 +115,10 @@ func main() {
|
||||
td.Fatal(ctx, err)
|
||||
}
|
||||
|
||||
if err := changeBazelCacheDir(ctx, "/mnt/pd0/bazel_cache"); err != nil {
|
||||
td.Fatal(ctx, err)
|
||||
}
|
||||
|
||||
// TODO(kjlubick) Build and push all apps of interest as they are ported.
|
||||
if err := buildPushJSFiddle(ctx, wasmProductsDir, checkoutDir, *skiaRevision, topic); err != nil {
|
||||
td.Fatal(ctx, err)
|
||||
@ -154,6 +158,20 @@ func buildPushJSFiddle(ctx context.Context, wasmProductsDir, checkoutDir, skiaRe
|
||||
return publishToTopic(ctx, "gcr.io/skia-public/jsfiddle", 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
|
||||
// an options struct.
|
||||
func changeBazelCacheDir(ctx context.Context, path string) error {
|
||||
// https://docs.bazel.build/versions/main/guide.html#where-are-the-bazelrc-files
|
||||
// We go for the user's .bazelrc file instead of the system one because the swarming user does
|
||||
// not have access to write to /etc/bazel.bazelrc
|
||||
const userBazelRCLocation = "/home/chrome-bot/.bazelrc"
|
||||
const bazelRCFileContents = `startup --output_user_root=%s
|
||||
`
|
||||
return os_steps.WriteFile(ctx, userBazelRCLocation, []byte(fmt.Sprintf(bazelRCFileContents, path)), 0666)
|
||||
}
|
||||
|
||||
func publishToTopic(ctx context.Context, image, tag string, topic *pubsub.Topic) error {
|
||||
return td.Do(ctx, td.Props(fmt.Sprintf("Publish pubsub msg to %s", docker_pubsub.TOPIC)).Infra(), func(ctx context.Context) error {
|
||||
// Publish to the pubsub topic which is subscribed to by
|
||||
|
Loading…
Reference in New Issue
Block a user