Created
December 16, 2020 17:26
-
-
Save ripiuk/5aaeeeba5539b27c3536abbac74b9d4b to your computer and use it in GitHub Desktop.
An example of bitbucket pipeline configuration to sync changed files with Google Cloud Storage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: <your_image> | |
pipelines: | |
default: | |
- step: | |
name: <description> | |
deployment: <your_deployment_name> | |
image: google/cloud-sdk:320.0.0-alpine | |
script: | |
# on linux you can use `$ base64 -w 0 < ~/.google_app_credentials.json` to generate $GCP_KEY_FILE | |
# then you should add it to <your_deployment_name> variables on bitbucket to be able to use it here | |
- echo "${GCP_KEY_FILE}" | base64 -d >> /tmp/key-file.json | |
- gcloud auth activate-service-account --key-file=/tmp/key-file.json --quiet | |
- gcloud config set project <your_project> --quiet | |
# sync everything from the `./<your_directory>` dir | |
# gsutil rsync documentation: https://cloud.google.com/storage/docs/gsutil/commands/rsync | |
- gsutil -m rsync -r -d -c -u ./<your_directory> gs://<bucket_name>/<directory_path> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment