【问题标题】:How to enable cloudbuild.yaml for zip-based CloudFunction deployments?如何为基于 zip 的 CloudFunction 部署启用 cloudbuild.yaml?
【发布时间】:2020-01-15 15:06:45
【问题描述】:

给定一些通用的 Python 代码,其结构类似于 ...

cloudbuild.yaml
requirements.txt
functions/
    folder_a/
        test/
            main_test.py
        main.py

如果我...

...似乎 .zip 中包含的 cloudbuild (cloudbuild.yaml) 的构建配置在构建期间从未考虑过(即在解析 requirements.txt 之前/之前)。

我已设置 cloudbuild.yaml 以授予对私有 github 存储库的访问权限(其中包含 requirements.txt 中列出的依赖项)。不幸的是,构建失败并显示(terraform 输出):

错误:等待更新 CloudFunctions 函数时出错:错误代码 3,消息:构建失败:{“error”:{“canonicalCode”:“INVALID_ARGUMENT”,“errorMessage”:“pip_download_wheels 有 stderr 输出:\nCommand \ “git clone -q ssh://git@github.com/SomeWhere/SomeThing.git /tmp/pip-req-build-a29nsum1\”失败,错误代码为 128,无\n\n错误:pip_download_wheels 返回代码: 1", "errorType": "InternalError", "errorId": "92DCE9EA"}}

根据cloud build docs,可以使用gcloud builds submit --config=cloudbuild.yaml . 指定cloudbuild.yaml——有没有办法将该参数提供给gcloud functions deploy(甚至是Terraform)?我想保留当前的“透明”代码构建,即我不想单独设置代码构建,而只是上传我的 zip 并“自动”构建和部署代码,同时尊重codebuild.yaml

【问题讨论】:

  • 你能分享你terraformcloudbuild.yaml的文件吗?

标签: python git google-cloud-platform google-cloud-functions google-cloud-build


【解决方案1】:

您似乎正在尝试通过 SSH 对私有 Git 存储库进行身份验证。 This is unfortunately not currently supported by Cloud Functions.

另一种方法是在创建 .zip 文件之前将您的私有依赖项供应到目录中。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-01-19
    • 1970-01-01
    相关资源
    最近更新 更多