如何为基于 zip 的 CloudFunction 部署启用 cloudbuild.yaml?
How to enable cloudbuild.yaml for zip-based CloudFunction deployments?
给定一些通用的 Python 代码,结构类似于 ...
cloudbuild.yaml
requirements.txt
functions/
folder_a/
test/
main_test.py
main.py
如果我...
- 从上述文件夹创建 .zip 并
- 使用 Terraform 的
google_cloudfunctions_function
resource or gcloud functions deploy
到 upload/deploy 函数
...似乎在构建过程中从未考虑过包含在 .zip 中的 cloudbuild (cloudbuild.yaml
) 的构建配置(即在解析 requirements.txt
之前)。
我已经设置 cloudbuild.yaml
以授予对私有 github 存储库的访问权限(其中包含 requirements.txt
中列出的依赖项)。不幸的是,构建失败并显示(terraform 输出):
Error: Error waiting for Updating CloudFunctions Function: Error code 3, message: Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "pip_download_wheels
had stderr output:\nCommand \"git clone -q ssh://git@github.com/SomeWhere/SomeThing.git /tmp/pip-req-build-a29nsum1\" failed with error code 128 in None\n\nerror: pip_download_wheels
returned code: 1", "errorType": "InternalError", "errorId": "92DCE9EA"}}
根据 cloud build docs,可以使用 gcloud builds submit --config=cloudbuild.yaml .
指定 cloudbuild.yaml
——有没有办法将该参数提供给 gcloud functions deploy
(甚至 Terraform),也?我想继续使用当前的 "transparent" 代码构建,即我不想单独设置代码构建,而只是上传我的 zip 并构建和部署代码 "automatically",同时尊重codebuild.yaml
.
您似乎正在尝试通过 SSH 向私有 Git 存储库进行身份验证。 This is unfortunately not currently supported by Cloud Functions.
另一种方法是在创建 .zip
文件之前将您的私有依赖项提供给目录。
给定一些通用的 Python 代码,结构类似于 ...
cloudbuild.yaml
requirements.txt
functions/
folder_a/
test/
main_test.py
main.py
如果我...
- 从上述文件夹创建 .zip 并
- 使用 Terraform 的
google_cloudfunctions_function
resource orgcloud functions deploy
到 upload/deploy 函数
...似乎在构建过程中从未考虑过包含在 .zip 中的 cloudbuild (cloudbuild.yaml
) 的构建配置(即在解析 requirements.txt
之前)。
我已经设置 cloudbuild.yaml
以授予对私有 github 存储库的访问权限(其中包含 requirements.txt
中列出的依赖项)。不幸的是,构建失败并显示(terraform 输出):
Error: Error waiting for Updating CloudFunctions Function: Error code 3, message: Build failed: {"error": {"canonicalCode": "INVALID_ARGUMENT", "errorMessage": "
pip_download_wheels
had stderr output:\nCommand \"git clone -q ssh://git@github.com/SomeWhere/SomeThing.git /tmp/pip-req-build-a29nsum1\" failed with error code 128 in None\n\nerror:pip_download_wheels
returned code: 1", "errorType": "InternalError", "errorId": "92DCE9EA"}}
根据 cloud build docs,可以使用 gcloud builds submit --config=cloudbuild.yaml .
指定 cloudbuild.yaml
——有没有办法将该参数提供给 gcloud functions deploy
(甚至 Terraform),也?我想继续使用当前的 "transparent" 代码构建,即我不想单独设置代码构建,而只是上传我的 zip 并构建和部署代码 "automatically",同时尊重codebuild.yaml
.
您似乎正在尝试通过 SSH 向私有 Git 存储库进行身份验证。 This is unfortunately not currently supported by Cloud Functions.
另一种方法是在创建 .zip
文件之前将您的私有依赖项提供给目录。