我正在尝试使用函数框架来使用pack
构建我的函数
$ls -lah .
total 40
drwxr-xr-x 9 viroos staff 288B Oct 18 02:54 .
drwxr-xr-x 9 viroos staff 288B Oct 11 03:20 ..
-rw-r--r-- 1 viroos staff 44B Oct 17 19:37 .gitignore
-rw-r--r-- 1 viroos staff 6B Oct 18 02:24 .python-version
drwxr-xr-x 3 viroos staff 96B Oct 17 22:44 __pycache__
-rw-r--r-- 1 viroos staff 32B Oct 18 02:54 main.py
-rw-r--r-- 1 viroos staff 259B Oct 18 02:54 project.toml
-rw-r--r-- 1 viroos staff 75B Oct 18 02:20 requirements.txt
drwxr-xr-x 6 viroos staff 192B Oct 17 19:35 venv
$ cat project.toml
[[build.env]]
name = "GOOGLE_RUNTIME_VERSION"
value = "python38"
[[build.env]]
name = "GOOGLE_FUNCTION_TARGET"
value = "foo"
[[build.env]]
name = "GOOGLE_FUNCTION_SIGNATURE_TYPE"
value = "event"
[[build.env]]
name = "GOOGLE_FUNCTION_SOURCE"
$ cat .python-version
3.8.6
当我尝试构建函数时,出现以下错误:
$ pack build foo --builder gcr.io/buildpacks/builder:v1v1: Pulling from buildpacks/builder
Digest: sha256:75f77739e5f8b6e06ff24ca56382de6ef44fce4d5def89dbde04fff5f8c95567
Status: Image is up to date for gcr.io/buildpacks/builder:v1
v1: Pulling from buildpacks/gcp/run
Digest: sha256:5c9214c1500035542b066d9fe8e4b5643c9b52388f52f543e91f55b8ebb27bc9
Status: Image is up to date for gcr.io/buildpacks/gcp/run:v1
===> DETECTING
4 of 5 buildpacks participating
google.python.runtime 0.9.1
google.python.functions-framework 0.9.1
google.python.pip 0.9.1
google.utils.label 0.0.1
===> ANALYZING
Previous image with name "foo" not found
===> RESTORING
===> BUILDING
=== Python - Runtime (google.python.runtime@0.9.1) ===
Using runtime version from GOOGLE_RUNTIME_VERSION: python38
Failure: (ID: d1f5dcf5) Runtime version python38 does not exist at https://storage.googleapis.com/gcp-buildpacks/python/python-python38.tar.gz (status 403). You can specify the version with GOOGLE_RUNTIME_VERSION.
--------------------------------------------------------------------------------
Sorry your project couldn't be built.
Our documentation explains ways to configure Buildpacks to better recognise your project:
-> https://github.com/GoogleCloudPlatform/buildpacks/blob/main/README.md
If you think you've found an issue, please report it:
-> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
--------------------------------------------------------------------------------
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 145
当我删除
[[build.env]]
name = "GOOGLE_RUNTIME_VERSION"
value = "python38"
从project.toml
我得到以下错误:
$ pack build foo --builder gcr.io/buildpacks/builder:v1
v1: Pulling from buildpacks/builder
Digest: sha256:75f77739e5f8b6e06ff24ca56382de6ef44fce4d5def89dbde04fff5f8c95567
Status: Image is up to date for gcr.io/buildpacks/builder:v1
v1: Pulling from buildpacks/gcp/run
Digest: sha256:5c9214c1500035542b066d9fe8e4b5643c9b52388f52f543e91f55b8ebb27bc9
Status: Image is up to date for gcr.io/buildpacks/gcp/run:v1
===> DETECTING
4 of 5 buildpacks participating
google.python.runtime 0.9.1
google.python.functions-framework 0.9.1
google.python.pip 0.9.1
google.utils.label 0.0.1
===> ANALYZING
Previous image with name "foo" not found
===> RESTORING
===> BUILDING
=== Python - Runtime (google.python.runtime@0.9.1) ===
Using runtime version from .python-version: 3.8.6
Failure: (ID: 8d3064d0) Runtime version 3.8.6 does not exist at https://storage.googleapis.com/gcp-buildpacks/python/python-3.8.6.tar.gz (status 403). You can specify the version with GOOGLE_RUNTIME_VERSION.
--------------------------------------------------------------------------------
Sorry your project couldn't be built.
Our documentation explains ways to configure Buildpacks to better recognise your project:
-> https://github.com/GoogleCloudPlatform/buildpacks/blob/main/README.md
If you think you've found an issue, please report it:
-> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
--------------------------------------------------------------------------------
ERROR: failed to build: exit status 1
ERROR: failed to build: executing lifecycle: failed with status code: 145
问题:
GOOGLE_RUNTIME_VERSION
李>
我能够重现您所经历的错误,以下是我观察到的:
正如Dustin所建议的,为了使用Python 3.8.6,在
.python-version
文件中指定它就足够了:但是,在
project.toml
中,也可以通过以下方式指定它:关于available versions,尽管
3.8.6
似乎是受支持的最高版本,但buildpacks支持python3.7+我还用版本
3.8.4
、3.8.0
、3.7.7
、3.7.2
和3.7.0
对它进行了测试,以确认这一点,并且对我来说是成功的,而3.9.0
和低于3.7.0
的版本导致了相同的错误:“运行时版本不存在”删除
project.toml
中的GOOGLE_RUNTIME_VERSION
时遇到的另一个错误(“很抱歉无法生成项目”),似乎与GOOGLE_FUNCTION_SOURCE
设置有关,因为您没有为它指定值:一旦我添加了值,错误就消失了。例如
给定运行时的可用性稍微落后于它对应的Python版本。您应该会发现3.8.6现在可用
建议将
.python-version
设置为类似3.8.6
的值这与您在
.python-version
中输入的内容相同,但优先于它不幸的是,目前还没有,但是您可以在https://github.com/GoogleCloudPlatform/buildpacks提交一个问题以请求此操作
相关问题 更多 >
编程相关推荐