在 Google 云构建中使用 Google 云存储
Using Google Cloud Storage in The Google Cloud Build
根据documentation google cloud build can build from google cloud storage or a repository. But I'm having a hard time finding documentation on how to use files I upload to google cloud storage in the build steps. My intention is for a website where my jekyll source code is in the repository and my images are in google cloud storage; I'd like to add the images to the jekyll output and then upload to firebase with these steps。
感谢您提供的指导!
firebase cli 部署命令使用 google 云存储。他们打包你的本地文件并将它们上传到云存储,构建过程从那里获取文件。
我认为他们没有考虑过 'merging' 您的回购文件和来自云存储的文件的过程。
但是您使用云构建的步骤配置,并且有 1 步使用 gcloud cli 从云存储下载资产。
对于 Cloud Build 中复制文件的步骤,您需要 provide your Cloud Build service account with IAM permission 读取存储桶中的文件(可能类似于:roles/storage.objectViewer)。
一旦 Cloud Build 使用的服务帐户可以读取文件,您将在部署到 Firebase 的步骤之前创建一个步骤来提取文件。
一个粗略的例子:
steps:
- name: 'gcr.io/cloud-builders/gsutil'
args: ['cp', 'gs://$MY_BUCKET/*.jpg', '.']
- name: gcr.io/$PROJECT_ID/firebase
args: ['deploy', '--project=$PROJECT_ID', '--only=hosting']
根据documentation google cloud build can build from google cloud storage or a repository. But I'm having a hard time finding documentation on how to use files I upload to google cloud storage in the build steps. My intention is for a website where my jekyll source code is in the repository and my images are in google cloud storage; I'd like to add the images to the jekyll output and then upload to firebase with these steps。
感谢您提供的指导!
firebase cli 部署命令使用 google 云存储。他们打包你的本地文件并将它们上传到云存储,构建过程从那里获取文件。
我认为他们没有考虑过 'merging' 您的回购文件和来自云存储的文件的过程。
但是您使用云构建的步骤配置,并且有 1 步使用 gcloud cli 从云存储下载资产。
对于 Cloud Build 中复制文件的步骤,您需要 provide your Cloud Build service account with IAM permission 读取存储桶中的文件(可能类似于:roles/storage.objectViewer)。
一旦 Cloud Build 使用的服务帐户可以读取文件,您将在部署到 Firebase 的步骤之前创建一个步骤来提取文件。
一个粗略的例子:
steps:
- name: 'gcr.io/cloud-builders/gsutil'
args: ['cp', 'gs://$MY_BUCKET/*.jpg', '.']
- name: gcr.io/$PROJECT_ID/firebase
args: ['deploy', '--project=$PROJECT_ID', '--only=hosting']