Cloud-builders: any example on how to use cloudbuild with bazel remote cache on gcs?

Created on 11 May 2018  路  2Comments  路  Source: GoogleCloudPlatform/cloud-builders

I would like to keep the bazel cache around to not download it all the times (shave off few minutes of download).

From 0.10. Bazel seems to be able to use remote caching with GCS support

Do I need to have the service account.json specifically set for the image or I can just use the cloudbuilder container ?

should I just use a volume and gsutil rsync before/after ?

Most helpful comment

I just got this working! I had to make sure the builder service account had access, but then also for me the magic missing flag to bazel was --google_default_credentials i.e.

- name: gcr.io/cloud-builders/bazel
  args: ['build', '--google_default_credentials', '--spawn_strategy=remote', '--genrule_strategy=remote', '--strategy=Javac=remote', '--strategy=Closure=remote', '--remote_http_cache=https://storage.googleapis.com/mybucket', '//cmd/...']

mybucket is the placeholder for my bucket

Until I added the google_default_credentials flag I was getting C++ compilation of rule '@com_google_protobuf//:protoc_lib' failed (Exit 34). Note: Remote connection/protocol failed with: execution failed

All 2 comments

/cc @googlestanke

My understanding is that if the builder service account ([email protected]) has write access to the bucket in question, it should Just Work, but I haven't tried it myself yet.

I just got this working! I had to make sure the builder service account had access, but then also for me the magic missing flag to bazel was --google_default_credentials i.e.

- name: gcr.io/cloud-builders/bazel
  args: ['build', '--google_default_credentials', '--spawn_strategy=remote', '--genrule_strategy=remote', '--strategy=Javac=remote', '--strategy=Closure=remote', '--remote_http_cache=https://storage.googleapis.com/mybucket', '//cmd/...']

mybucket is the placeholder for my bucket

Until I added the google_default_credentials flag I was getting C++ compilation of rule '@com_google_protobuf//:protoc_lib' failed (Exit 34). Note: Remote connection/protocol failed with: execution failed

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maxpaynestory picture maxpaynestory  路  7Comments

mbana picture mbana  路  6Comments

ewhauser picture ewhauser  路  4Comments

artjomzab picture artjomzab  路  5Comments

namtzigla picture namtzigla  路  3Comments