我设法使用以下命令来部署GCP功能的脚本:
gcloud beta functions deploy pipeline-helper --set-env-vars PROPFILE_BUCKET=${my_bucket},PROPFILE_PATH=${some_property} --source https://source.developers.google.com/projects/{PROJECT}/repos/{REPO}/fixed-aliases/1.0.1/paths/ --entry-point onFlagFileCreation --runtime nodejs6 --trigger-resource ${my_bucket} --trigger-event google.storage.object.finalize --region europe-west1 --memory 1G --timeout 300s
这工作了几天,最后一个是12月4日。然后,在12月27日启动时...该命令失败,并显示以下输出(添加了调试选项):
Deploying function (may take a while - up to 2 minutes)...
..failed.
DEBUG: (gcloud.beta.functions.deploy) OperationError: code=13, message=Failed to retrieve function source code
Traceback (most recent call last):
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/cli.py", line 841, in Execute
resources = calliope_command.Run(cli=self, args=args)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/calliope/backend.py", line 770, in Run
resources = command_instance.Run(args)
File "/usr/lib/google-cloud-sdk/lib/surface/functions/deploy.py", line 203, in Run
return _Run(args, track=self.ReleaseTrack(), enable_env_vars=True)
File "/usr/lib/google-cloud-sdk/lib/surface/functions/deploy.py", line 157, in _Run
return api_util.PatchFunction(function, updated_fields)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/util.py", line 308, in CatchHTTPErrorRaiseHTTPExceptionFn
return func(*args, **kwargs)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/util.py", line 364, in PatchFunction
operations.Wait(op, messages, client, _DEPLOY_WAIT_NOTICE)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/operations.py", line 126, in Wait
_WaitForOperation(client, request, notice)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/operations.py", line 101, in _WaitForOperation
sleep_ms=SLEEP_MS)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/core/util/retry.py", line 219, in RetryOnResult
result = func(*args, **kwargs)
File "/usr/lib/google-cloud-sdk/lib/googlecloudsdk/api_lib/functions/operations.py", line 65, in _GetOperationStatus
raise exceptions.FunctionsError(OperationErrorToString(op.error))
FunctionsError: OperationError: code=13, message=Failed to retrieve function source code
ERROR: (gcloud.beta.functions.deploy) OperationError: code=13, message=Failed to retrieve function source code
Build step 'Execute shell' marked build as failure
Finished: FAILURE
我的问题涉及到该命令的--source选项在指向Google Source存储库网址(与gcs存储桶或本地目录一起使用)时的使用
我尝试使用https://source.developers.google.com/projects/PROJECT/repos/REPO中提到的最小有效源存储库网址the official doc here ...,但没有成功(相同错误)
此后,我克隆了官方示例«Google云功能-Hello world示例至GC存储库,并尝试使用等效命令进行部署...没有更多成功(相同错误)。但是,我可以通过上载到我项目中的gcs存储桶的zip或本地存储库(而不是Google Source存储库)来部署它。
用于部署功能的帐户(xxx-compute@developer.gserviceaccount.com)具有以下权利:
任何帮助将不胜感激
答案 0 :(得分:0)
正如我对@Raj的最后评论中提到的那样,问题是由于GCP中的一个错误导致的,现在已修复。支持善良而反应迅速的“人”。 现在一切都按预期工作了!