google-cloud-platform - 通过 gcloud 命令行工具触发特定 git 提交的构建

标签 google-cloud-platform google-kubernetes-engine google-container-registry

我遇到的所有示例都采用以下格式:

gcloud container builds submit --config cloudbuild.yaml .

手册页说明如下:
 [SOURCE]
    The source directory on local disk or tarball in Google Cloud Storage
    or disk to use for this build. If source is a local directory this
    command skips files specified in the .gcloudignore file (see $ gcloud
    topic gcloudignore for more information).

现在,我本地磁盘上的源目录非常大,并且花费了大量时间将源代码从我的本地机器传输到 Google 构建服务器/云。是否有以下可能?如何?
  • 给出一个 git/github URL 而不是本地源目录
  • 我的 git-repo 也顺便反射(reflect)在 Google Source Repository 中,因为我为我的 repo 设置了构建触发器。我可以提供 Google 镜像的存储库的 URL 吗?
  • 最佳答案

    不幸的是,今天在 gcloud 中对此没有很好的支持。 .不过,您可以通过其他几种方式完成此操作:

  • 使用 curl或您选择的客户端库发送 API 请求以请求指定 RepoSource 的构建.例如:

    {
    “来源”: {
    “ repo 源”:{
    "repoName": "我的仓库",
    "commitSha": "死牛肉"
    }
    },
    “脚步”: [...]
    }
  • 在您的本地环境中,获取提交并使用 gcloud 构建它:

    git checkout && gcloud 容器构建提交。 --config=cloudbuild.yaml
  • Create a trigger自动执行您的构建,然后发出 API request to run the trigger manually , 在你想要的特定提交上,再次使用 curl或客户端库。
  • 关于google-cloud-platform - 通过 gcloud 命令行工具触发特定 git 提交的构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48962597/

    相关文章:

    kubernetes - Kubernetes 的容器 CPU 请求值

    google-app-engine - 执行 : "gcc": executable file not found in $PATH

    docker - 使用 gcsfuse 安装的存储桶中的数据在 Google Cloud 实例上运行 Docker

    kubernetes - Google Container Engine 的托管 Kubernetes 环境是否会导致锁定?

    kubernetes - 如何从公共(public) CI 服务器在 GKE 中部署应用程序

    docker - 从Google Container Registry删除图像并上传另一个具有相同标签的图像后,删除的图像仍会被拉出

    google-kubernetes-engine - 在 GCP Cloud Container Builder 中推送镜像后添加步骤

    android - 为我的项目启用 Google Cloud Build API 时出错?

    google-cloud-platform - 尽管 GOOGLE_APPLICATION_CREDENTIALS 已成功设置为服务帐户 json,但 Sops 无法 gcp kms 解密 Circleci 上的文件

    mysql - Google Cloud SQL 卡在重启时