Google Cloud Build - How to backup builds?

Viewed 202

I have Google Cloud Build and Kubernetes Engine set up in my project and I want to back my builds to another project. I am doing it in order to have a backup for a case of a disaster so I will be able to restore the builds.

I noticed that all of the builds are saved into a bucket called: artifacts.{project-id}.appspot.com

Option I came up with

Making a transfer of this bucket into another project.

This will physically backup these builds.

Questions

  1. If the original project gets deleted will this be enough for me to restore the builds? How will i do that?
  2. What other ways can I backup these builds?
1 Answers

Cloud build creates a Docker image and it uploads it to Google Cointainer Registry.

Answer to 1:

yes, if the bucket is transfered from project A to project B if project A is deleted the images in project B will not be affected.

Answer to 2:

You can copy it from a container registry location to another or dowload it to your local computer. To copy the docker image in container registry to another location you can use the following command from your cloud Shell:

gcloud container images add-tag \
[SOURCE_HOSTNAME]/[SOURCE_PROJECT-ID]/[SOURCE_IMAGE]:[SOURCE_TAG] \
[DESTINATION_HOSTNAME]/[DESTINATION_PROJECT-ID]/[DESTINATION_IMAGE]:[DESTINATION_TAG]

The hostnames will be one of: grc.io, eu.gcr.io us.gcr.io asia.gcr.io

Project-IDs are the source and destination project ids

and the image and tags are the ones you choose for the image

Related