Reputation: 29
Question:
Does Google automatically update storage buckets with changes pushed to a project's Cloud Source Repository?
Example:
I create a Google Cloud Platform project called Cooking and store the file recipe.txt in a bucket.
I modify recipe.txt and push the changes from my local master branch to the Cloud Source Repository for Cooking.
When I look at the Source Code panel for my project, I see recipe.txt is up-to-date with my latest changes.
When I look at the storage bucket for my project, I see recipe.txt is not up-to-date (i.e. not in sync with the project's Cloud Source Repository).
Upvotes: 2
Views: 1217
Reputation: 1305
While the question differs from the heading, I will answer how to keep the Cloud Storage bucket in sync with the Cloud Source Repository.
This is possible by using Cloud Build. Create a build trigger for when there was a push to your master branch (or whatever other event, see the Cloud Build docs).
Assuming the path to the folder containing recipe.txt
inside the Cloud Source Repository is ./path/to/folder
and you want to sync the contents of that folder with the bucket your-bucket
, use the following yaml
build config:
steps:
- name: gcr.io/cloud-builders/gsutil
args:
- rsync
- '-r'
- '-d'
- ./path/to/folder
- 'gs://your-bucket/'
(See what rsync
and it's options are: https://cloud.google.com/storage/docs/gsutil/commands/rsync)
Upvotes: 1
Reputation: 38379
No. Google Cloud Source Repositories can be configured to stay in sync with other git repository services, such as GitHub or Bitbucket, but there is no relationship between Google Cloud Source Repository repositories and GCS buckets.
Upvotes: 3