简体   繁体   English

Python 云 function 重建后未更新

[英]Python cloud function is not updated after rebuild

Steps to reproduce:重现步骤:

  1. Enable these APIs: Cloud Repositories, Cloud Build, and Cloud Functions启用这些 API:云存储库、云构建和云功能
  2. Create Repository and push content from here there.创建存储库并从这里推送内容。 This is a simple Python Flask app returning simple Html with cloudbuild.yaml file.这是一个简单的 Python Flask 应用程序,返回带有 cloudbuild.yaml 文件的简单 Html。
  3. Create Cloud function using created repository with name la-repo-function-1 (which is referred in cloudbuild.yaml file) and using Python 3.7 with HTTP trigger and function to execute equal greetings_http使用名称为la-repo-function-1 的已创建存储库(在 cloudbuild.yaml 文件中引用)创建 Cloud function,并使用 Python 3.7 和 HTTP 触发器和 function 执行 equal greetings_http
  4. Create Cloud Build trigger on that repo and point it to use cloudbuild.yaml as a configuration.在该存储库上创建 Cloud Build 触发器并将其指向使用 cloudbuild.yaml 作为配置。
  5. Change returned html greetings in main.py and push it to the repository.更改在 main.py 中返回 html greetings 并将其推送到存储库。

Expected Results: A new function is built and redeployed.预期结果:构建并重新部署一个新的 function。

Actual Results: Cloud Build is triggered and a new ACTIVE version is observed, however the old content is still returned.实际结果:触发 Cloud Build 并观察到新的 ACTIVE 版本,但仍返回旧内容。 Downloaded source code from console is old.从控制台下载的源代码是旧的。 However, manual redeployment without changes works (just by getting to edit tab and clicking deploy).但是,无需更改即可手动重新部署(只需进入编辑选项卡并单击部署)。

Note: This question is similar to this .注意:这个问题和这个类似。 However, here we are using Python 3.7 and and not a Node.js code, and accourding to GC release notes Python 3.7 is fully released and is not in beta.然而,这里我们使用的是 Python 3.7 而不是 Node.js 代码,并且根据GC 发行说明Python 3.7 已完全发布且未处于测试阶段。

So is it a bug or I'm missing something?那么这是一个错误还是我遗漏了什么?

This issue is being tracked in Google's Issue Tracker here , where it is being dealt with.此问题正在 Google 的 Issue Tracker here中进行跟踪,并在那里进行处理。 When the resolution is complete, a good answer should be there.解决方案完成后,应该会有一个好的答案。

The solution is found, just relace existing cloudbuild.yaml on following code:找到解决方案,只需将现有的 cloudbuild.yaml 替换为以下代码:

steps:
- name: 'gcr.io/cloud-builders/gcloud'
  args: ['functions', 'deploy', 'la-repo-function-1', '--source','.','--trigger-http', '--runtime', 'python37', '--entry-point', 'greetings_http']

In other words source param is mandatory(however it's presence is not automatically validated)换句话说 source 参数是强制性的(但它的存在不会自动验证)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM