From e47b528e9c633c55e8c5ad755601390372703c53 Mon Sep 17 00:00:00 2001
From: mozhou52
Date: Tue, 12 Nov 2024 18:14:22 +0800
Subject: [PATCH] fix:comment fix
---
.../custom.debian11/python/code/.gitignore | 2 -
.../python/code/gunicorn_conf.py | 6 -
.../python/code/requirements.txt | 2 -
.../e2e/custom.debian11/python/code/server.py | 52 --------
__tests__/e2e/custom.debian11/python/s.yaml | 31 -----
__tests__/e2e/custom.debian11/run | 14 --
__tests__/e2e/nodejs/code/package-lock.json | 125 ------------------
__tests__/e2e/python/code/index.py | 1 -
example/readme copy.md | 85 ------------
example/s copy.yaml | 35 -----
src/subCommands/build/impl/baseBuilder.ts | 3 +-
src/subCommands/local/impl/baseLocal.ts | 8 +-
12 files changed, 5 insertions(+), 359 deletions(-)
delete mode 100644 __tests__/e2e/custom.debian11/python/code/.gitignore
delete mode 100644 __tests__/e2e/custom.debian11/python/code/gunicorn_conf.py
delete mode 100644 __tests__/e2e/custom.debian11/python/code/requirements.txt
delete mode 100644 __tests__/e2e/custom.debian11/python/code/server.py
delete mode 100644 __tests__/e2e/custom.debian11/python/s.yaml
delete mode 100644 __tests__/e2e/nodejs/code/package-lock.json
delete mode 100644 example/readme copy.md
delete mode 100644 example/s copy.yaml
diff --git a/__tests__/e2e/custom.debian11/python/code/.gitignore b/__tests__/e2e/custom.debian11/python/code/.gitignore
deleted file mode 100644
index 0125409..0000000
--- a/__tests__/e2e/custom.debian11/python/code/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-python
-__pycache__
diff --git a/__tests__/e2e/custom.debian11/python/code/gunicorn_conf.py b/__tests__/e2e/custom.debian11/python/code/gunicorn_conf.py
deleted file mode 100644
index 8b6f7a9..0000000
--- a/__tests__/e2e/custom.debian11/python/code/gunicorn_conf.py
+++ /dev/null
@@ -1,6 +0,0 @@
-bind = "0.0.0.0:9000"
-workers = 1
-threads = 2
-keepalive = 900
-accesslog = "-"
-errorlog = "-"
diff --git a/__tests__/e2e/custom.debian11/python/code/requirements.txt b/__tests__/e2e/custom.debian11/python/code/requirements.txt
deleted file mode 100644
index 3fa017f..0000000
--- a/__tests__/e2e/custom.debian11/python/code/requirements.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-gunicorn
-flask
\ No newline at end of file
diff --git a/__tests__/e2e/custom.debian11/python/code/server.py b/__tests__/e2e/custom.debian11/python/code/server.py
deleted file mode 100644
index ebbd53a..0000000
--- a/__tests__/e2e/custom.debian11/python/code/server.py
+++ /dev/null
@@ -1,52 +0,0 @@
-from flask.logging import default_handler
-import time
-from flask import Flask
-from flask import request
-import json
-import sys
-import traceback
-import logging
-
-
-log = logging.getLogger("werkzeug")
-log.setLevel(logging.ERROR)
-
-
-app = Flask(__name__)
-
-
-REQUEST_ID_HEADER = "x-fc-request-id"
-
-
-@app.route("/invoke", methods=["POST"])
-def event_invoke():
- rid = request.headers.get(REQUEST_ID_HEADER)
- print("FC Invoke Start RequestId: " + rid)
-
- data = request.stream.read()
- print(data)
-
- try:
- # do your things, for example:
- evt = json.loads(data)
- print(evt)
- except Exception as e:
- exc_info = sys.exc_info()
- trace = traceback.format_tb(exc_info[2])
- errRet = {"message": str(e), "stack": trace}
- print(errRet)
- print("FC Invoke End RequestId: " + rid)
- return errRet, 404, [("x-fc-status", "404")]
-
- print("FC Invoke End RequestId: " + rid)
-
- return data
-
-
-@app.route("/", methods=["GET"])
-def home():
- return "hello world\n"
-
-
-if __name__ == "__main__":
- app.run(host="0.0.0.0", port=9000)
diff --git a/__tests__/e2e/custom.debian11/python/s.yaml b/__tests__/e2e/custom.debian11/python/s.yaml
deleted file mode 100644
index a12c537..0000000
--- a/__tests__/e2e/custom.debian11/python/s.yaml
+++ /dev/null
@@ -1,31 +0,0 @@
-edition: 3.0.0
-name: test-custom-debian11-python
-access: "quanxi"
-
-vars:
- region: ${env('REGION', 'cn-huhehaote')}
-
-resources:
- helloworld:
- component: ${env('fc_component_version', path('../../../../'))}
- props:
- region: ${vars.region}
- functionName: fc3-event-debian11-${env('fc_component_function_name', 'python310')}
- handler: index.handler
- timeout: 60
- memorySize: 1536
- cpu: 1
- diskSize: 512
- runtime: custom.debian11
- code: ./code
- instanceConcurrency: 10
- environmentVariables:
- PYTHONPATH: /code/python
- PATH: /code/python/bin:/usr/local/bin/apache-maven/bin:/usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/ruby/bin
- customRuntimeConfig:
- command:
- - gunicorn
- args:
- - '-c'
- - 'gunicorn_conf.py'
- - 'server:app'
diff --git a/__tests__/e2e/custom.debian11/run b/__tests__/e2e/custom.debian11/run
index 552648e..b8d04c5 100755
--- a/__tests__/e2e/custom.debian11/run
+++ b/__tests__/e2e/custom.debian11/run
@@ -12,17 +12,3 @@ s info -t ./go/s.yaml
s remove -y -t ./go/s.yaml
rm -rf ./go/code/target
-echo "test custom.debian11 python runtime ..."
-rm -rf ./python/code/python
-rm -rf ./python/code/__pycache__
-export fc_component_function_name=python311-$(uname)-$(uname -m)
-s build -t ./python/s.yaml
-s local invoke -e '{"hello":"fc custom.debian11 python"}' -t ./python/s.yaml
-s deploy -y -t ./python/s.yaml
-s invoke -e '{"hello":"fc custom.debian11 python"}' -t ./python/s.yaml
-s info -t ./python/s.yaml
-s remove -y -t ./python/s.yaml
-
-rm -rf ./go/code/target
-rm -rf ./python/code/python
-rm -rf ./python/code/__pycache__
diff --git a/__tests__/e2e/nodejs/code/package-lock.json b/__tests__/e2e/nodejs/code/package-lock.json
deleted file mode 100644
index 0e6366b..0000000
--- a/__tests__/e2e/nodejs/code/package-lock.json
+++ /dev/null
@@ -1,125 +0,0 @@
-{
- "name": "code",
- "version": "1.0.0",
- "lockfileVersion": 2,
- "requires": true,
- "packages": {
- "": {
- "name": "code",
- "version": "1.0.0",
- "license": "ISC",
- "dependencies": {
- "chalk": "^4.1.0"
- }
- },
- "node_modules/ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
- "dependencies": {
- "color-convert": "^2.0.1"
- },
- "engines": {
- "node": ">=8"
- },
- "funding": {
- "url": "https://github.com/chalk/ansi-styles?sponsor=1"
- }
- },
- "node_modules/chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
- "dependencies": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- },
- "engines": {
- "node": ">=10"
- },
- "funding": {
- "url": "https://github.com/chalk/chalk?sponsor=1"
- }
- },
- "node_modules/color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
- "dependencies": {
- "color-name": "~1.1.4"
- },
- "engines": {
- "node": ">=7.0.0"
- }
- },
- "node_modules/color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
- },
- "node_modules/has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
- "engines": {
- "node": ">=8"
- }
- },
- "node_modules/supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
- "dependencies": {
- "has-flag": "^4.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- }
- },
- "dependencies": {
- "ansi-styles": {
- "version": "4.3.0",
- "resolved": "https://registry.npmmirror.com/ansi-styles/-/ansi-styles-4.3.0.tgz",
- "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
- "requires": {
- "color-convert": "^2.0.1"
- }
- },
- "chalk": {
- "version": "4.1.2",
- "resolved": "https://registry.npmmirror.com/chalk/-/chalk-4.1.2.tgz",
- "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
- "requires": {
- "ansi-styles": "^4.1.0",
- "supports-color": "^7.1.0"
- }
- },
- "color-convert": {
- "version": "2.0.1",
- "resolved": "https://registry.npmmirror.com/color-convert/-/color-convert-2.0.1.tgz",
- "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
- "requires": {
- "color-name": "~1.1.4"
- }
- },
- "color-name": {
- "version": "1.1.4",
- "resolved": "https://registry.npmmirror.com/color-name/-/color-name-1.1.4.tgz",
- "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
- },
- "has-flag": {
- "version": "4.0.0",
- "resolved": "https://registry.npmmirror.com/has-flag/-/has-flag-4.0.0.tgz",
- "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
- },
- "supports-color": {
- "version": "7.2.0",
- "resolved": "https://registry.npmmirror.com/supports-color/-/supports-color-7.2.0.tgz",
- "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
- "requires": {
- "has-flag": "^4.0.0"
- }
- }
- }
-}
diff --git a/__tests__/e2e/python/code/index.py b/__tests__/e2e/python/code/index.py
index 03d9a97..84f7423 100644
--- a/__tests__/e2e/python/code/index.py
+++ b/__tests__/e2e/python/code/index.py
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
import subprocess
-import fc2
from bs4 import BeautifulSoup
import logging
import flask
diff --git a/example/readme copy.md b/example/readme copy.md
deleted file mode 100644
index 08dfd82..0000000
--- a/example/readme copy.md
+++ /dev/null
@@ -1,85 +0,0 @@
-> 注:当前项目为 Serverless Devs 应用,由于应用中会存在需要初始化才可运行的变量(例如应用部署地区、函数名等等),所以**不推荐**直接 Clone 本仓库到本地进行部署或直接复制 s.yaml 使用,**强烈推荐**通过 `s init ${模版名称}` 的方法或应用中心进行初始化,详情可参考[部署 & 体验](#部署--体验) 。
-
-# start-fc3-python 帮助文档
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-快速部署一个 Python 的 Hello World 函数到阿里云函数计算。
-
-
-
-
-
-- [:smiley_cat: 代码](https://github.com/devsapp/start-fc/tree/main/fc-python/hello-world/src)
-
-
-
-
-
-
-## 前期准备
-
-使用该项目,您需要有开通以下服务并拥有对应权限:
-
-
-
-| 服务/业务 | 权限 |
-| --------- | ------------------ |
-| 函数计算 | AliyunFCFullAccess |
-
-
-
-
-
-
-
-
-
-
-
-## 部署 & 体验
-
-
-
-- :fire: 通过 [Serverless 应用中心](https://fcnext.console.aliyun.com/applications/create?template=start-fc3-python) ,
- [](https://fcnext.console.aliyun.com/applications/create?template=start-fc3-python) 该应用。
-
-
-
-
-- 通过 [Serverless Devs Cli](https://www.serverless-devs.com/serverless-devs/install) 进行部署:
- - [安装 Serverless Devs Cli 开发者工具](https://www.serverless-devs.com/serverless-devs/install) ,并进行[授权信息配置](https://docs.serverless-devs.com/fc/config) ;
- - 初始化项目:`s init start-fc3-python -d start-fc3-python`
- - 进入项目,并进行项目部署:`cd start-fc3-python && s deploy -y`
-
-
-
-
-
-## 开发者社区
-
-您如果有关于错误的反馈或者未来的期待,您可以在 [Serverless Devs repo Issues](https://github.com/serverless-devs/serverless-devs/issues) 中进行反馈和交流。如果您想要加入我们的讨论组或者了解 FC 组件的最新动态,您可以通过以下渠道进行:
-
-
-
-|
|
|
|
-| --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
-|
微信公众号:`serverless` | 微信小助手:`xiaojiangwh` | 钉钉交流群:`33947367` |
-
-
-
-
-
-
diff --git a/example/s copy.yaml b/example/s copy.yaml
deleted file mode 100644
index 09ac671..0000000
--- a/example/s copy.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-# ------------------------------------
-# 官方手册: https://manual.serverless-devs.com/user-guide/aliyun/#fc3
-# 常见小贴士: https://manual.serverless-devs.com/user-guide/tips/
-# 有问题快来钉钉群问一下吧:33947367
-# ------------------------------------
-edition: 3.0.0
-name: hello-world-app
-access: "quanxi"
-
-vars: # 全局变量
- region: "cn-huhehaote"
-
-resources:
- hello_world:
- component: fc3
- props:
- region: ${vars.region}
- functionName: "start-python-dpx8"
- description: 'hello world by serverless devs'
- runtime: "python3.9"
- code: ./code
- handler: index.handler
- memorySize: 128
- timeout: 30
- # triggers:
- # - triggerName: httpTrigger # 触发器名称
- # triggerType: http # 触发器类型
- # description: 'xxxx'
- # qualifier: LATEST # 触发服务的版本
- # triggerConfig:
- # authType: anonymous # 鉴权类型,可选值:anonymous、function
- # disableURLInternet: false # 是否禁用公网访问 URL
- # methods: # HTTP 触发器支持的访问方法,可选值:GET、POST、PUT、DELETE、HEAD
- # - GET
- # - POST
diff --git a/src/subCommands/build/impl/baseBuilder.ts b/src/subCommands/build/impl/baseBuilder.ts
index e027b4c..0f6a66f 100644
--- a/src/subCommands/build/impl/baseBuilder.ts
+++ b/src/subCommands/build/impl/baseBuilder.ts
@@ -94,8 +94,7 @@ export abstract class Builder {
runtime = 'python3.6';
}
if (runtime === 'python3.12' || runtime === 'custom.debian11') {
- image = `${fcDockerVersionRegistry}/${fcDockerNameSpace}/runtime:${runtime}-build-dev`;
- // image = `${fcDockerVersionRegistry}/${fcDockerNameSpace}/runtime:${runtime}-build-${fcDockerVersion}`;
+ image = `${fcDockerVersionRegistry}/${fcDockerNameSpace}/runtime:${runtime}-build-${fcDockerVersion}`;
} else {
image = `${fcDockerVersionRegistry}/${fcDockerNameSpace}/runtime-${runtime}:build-${fcDockerVersion}`;
}
diff --git a/src/subCommands/local/impl/baseLocal.ts b/src/subCommands/local/impl/baseLocal.ts
index 6688068..e1e1863 100644
--- a/src/subCommands/local/impl/baseLocal.ts
+++ b/src/subCommands/local/impl/baseLocal.ts
@@ -230,8 +230,7 @@ export class BaseLocal {
runtime = 'python3.6';
}
if (runtime === 'python3.12' || runtime === 'custom.debian11') {
- // image = `${fcDockerVersionRegistry}/${fcDockerNameSpace}/runtime:${runtime}-${fcDockerVersion}`;
- image = `${fcDockerVersionRegistry}/${fcDockerNameSpace}/runtime:${runtime}-dev`;
+ image = `${fcDockerVersionRegistry}/${fcDockerNameSpace}/runtime:${runtime}-${fcDockerVersion}`;
} else {
image = `${fcDockerVersionRegistry}/${fcDockerNameSpace}/runtime-${runtime}:${fcDockerVersion}`;
}
@@ -354,7 +353,8 @@ export class BaseLocal {
}
case 'python3':
case 'python3.9':
- case 'python3.10': {
+ case 'python3.10':
+ case 'python3.12': {
return JSON.stringify(
{
version: '0.2.0',
@@ -458,7 +458,6 @@ export class BaseLocal {
return false;
}
// TODO check if runtime support breakpoint debugging
-
if (!this.canSupportDebug(this.getRuntime()) && _.isFinite(this.getDebugPort())) {
logger.error(`breakpoint debugging is not support in ${this.getRuntime()} runtime`);
return false;
@@ -508,6 +507,7 @@ export class BaseLocal {
'python3',
'python3.9',
'python3.10',
+ 'python3.12',
'java8',
'java11',
'php7.2',