From 375a8365fc042410e26244dd5688400efc5ce469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andy=20M=C3=A9ry?= Date: Fri, 5 Jul 2024 16:30:57 +0200 Subject: [PATCH 1/5] feat(deploy): add sanbox --- README.md | 6 ++++++ deploy/lib/createContainers.js | 3 ++- deploy/lib/createFunctions.js | 3 ++- examples/nodejs/serverless.yml | 1 + 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ebd55a20..6c979c57 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,9 @@ functions: # How to handle HTTP. Options: enabled (allow HTTP), disabled (block HTTP), or redirected (redirect HTTP -> HTTPS) httpOption: enabled + # Execution environment to use when running the function. Options: v1 (legacy), v2 (recommended, with improved cold starts) + sandbox: v2 + # Controls privacy of the function. Options: public (no authentication), private (token-based authentication) privacy: public @@ -215,6 +218,9 @@ custom: # How to handle HTTP. Options: enabled (allow HTTP), disabled (block HTTP), or redirected (redirect HTTP -> HTTPS) httpOption: enabled + # Execution environment to use when running the container. Options: v1 (legacy), v2 (recommended, with improved cold starts) + sandbox: v2 + # Controls privacy of the container. Options: public (no authentication), private (token-based authentication) privacy: public diff --git a/deploy/lib/createContainers.js b/deploy/lib/createContainers.js index 8976a3cd..a13b2d28 100644 --- a/deploy/lib/createContainers.js +++ b/deploy/lib/createContainers.js @@ -103,13 +103,14 @@ module.exports = { privacy: container.privacy, port: container.port, http_option: container.httpOption, + sandbox: container.sandbox, }; // checking if there is custom_domains set on container creation. if (container.custom_domains && container.custom_domains.length > 0) { this.serverless.cli.log( "WARNING: custom_domains are available on container update only. " + - "Redeploy your container to apply custom domains. Doc : https://www.scaleway.com/en/docs/compute/containers/how-to/add-a-custom-domain-to-a-container/" + "Redeploy your container to apply custom domains. Doc : https://www.scaleway.com/en/docs/compute/containers/how-to/add-a-custom-domain-to-a-container/" ); } diff --git a/deploy/lib/createFunctions.js b/deploy/lib/createFunctions.js index 24cd1e3d..34d07e85 100644 --- a/deploy/lib/createFunctions.js +++ b/deploy/lib/createFunctions.js @@ -181,6 +181,7 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer privacy: func.privacy, domain_name: func.domain_name, http_option: func.httpOption, + sandbox: func.sandbox, }; const availableRuntimes = await this.listRuntimes(); @@ -194,7 +195,7 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer if (func.custom_domains && func.custom_domains.length > 0) { this.serverless.cli.log( "WARNING: custom_domains are available on function update only. " + - "Redeploy your function to apply custom domains. Doc : https://www.scaleway.com/en/docs/compute/functions/how-to/add-a-custom-domain-name-to-a-function/" + "Redeploy your function to apply custom domains. Doc : https://www.scaleway.com/en/docs/compute/functions/how-to/add-a-custom-domain-name-to-a-function/" ); } diff --git a/examples/nodejs/serverless.yml b/examples/nodejs/serverless.yml index 9491be85..b24ae59b 100644 --- a/examples/nodejs/serverless.yml +++ b/examples/nodejs/serverless.yml @@ -20,6 +20,7 @@ functions: first: handler: handler.handle httpOption: redirected + sandbox: v2 # description: "" # Local environment variables - used only in given function env: From 4f4d184aeb7476cc6f0cefb956cb7c730e9276fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andy=20M=C3=A9ry?= Date: Fri, 5 Jul 2024 18:16:52 +0200 Subject: [PATCH 2/5] fix: bump nodeJs version in nodeJs example --- examples/nodejs/serverless.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/nodejs/serverless.yml b/examples/nodejs/serverless.yml index b24ae59b..0e26eb86 100644 --- a/examples/nodejs/serverless.yml +++ b/examples/nodejs/serverless.yml @@ -3,8 +3,8 @@ configValidationMode: off singleSource: false provider: name: scaleway - runtime: node16 # Available node runtimes are listed in documentation - # Global Environment variables - used in every functions + runtime: node22 # Available node runtimes are listed in documentation + # Global Environment variables - used in every function env: test: test @@ -21,6 +21,7 @@ functions: handler: handler.handle httpOption: redirected sandbox: v2 + memoryLimit: 1024 # description: "" # Local environment variables - used only in given function env: From a11bc50aa9fde0fdc5de98f4aecbaf5ed1d6fe5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andy=20M=C3=A9ry?= Date: Mon, 8 Jul 2024 10:20:07 +0200 Subject: [PATCH 3/5] chore: run npm format --- deploy/lib/createContainers.js | 2 +- deploy/lib/createFunctions.js | 2 +- package-lock.json | 16 ++++++++++++++++ package.json | 5 ++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/deploy/lib/createContainers.js b/deploy/lib/createContainers.js index a13b2d28..02702b9c 100644 --- a/deploy/lib/createContainers.js +++ b/deploy/lib/createContainers.js @@ -110,7 +110,7 @@ module.exports = { if (container.custom_domains && container.custom_domains.length > 0) { this.serverless.cli.log( "WARNING: custom_domains are available on container update only. " + - "Redeploy your container to apply custom domains. Doc : https://www.scaleway.com/en/docs/compute/containers/how-to/add-a-custom-domain-to-a-container/" + "Redeploy your container to apply custom domains. Doc : https://www.scaleway.com/en/docs/compute/containers/how-to/add-a-custom-domain-to-a-container/" ); } diff --git a/deploy/lib/createFunctions.js b/deploy/lib/createFunctions.js index 34d07e85..4bff167c 100644 --- a/deploy/lib/createFunctions.js +++ b/deploy/lib/createFunctions.js @@ -195,7 +195,7 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer if (func.custom_domains && func.custom_domains.length > 0) { this.serverless.cli.log( "WARNING: custom_domains are available on function update only. " + - "Redeploy your function to apply custom domains. Doc : https://www.scaleway.com/en/docs/compute/functions/how-to/add-a-custom-domain-name-to-a-function/" + "Redeploy your function to apply custom domains. Doc : https://www.scaleway.com/en/docs/compute/functions/how-to/add-a-custom-domain-name-to-a-function/" ); } diff --git a/package-lock.json b/package-lock.json index 412226c3..3e60158f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,6 +24,7 @@ "eslint-plugin-import": "^2.27.5", "fs-extra": "^11.1.1", "jest": "^29.6.1", + "prettier": "^2.8.8", "rewire": "^6.0.0" } }, @@ -6313,6 +6314,21 @@ "node": ">= 0.8.0" } }, + "node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/pretty-format": { "version": "29.6.1", "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.1.tgz", diff --git a/package.json b/package.json index 757711b7..e3b622ed 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,9 @@ "test:shared": "jest tests/shared", "test:triggers": "jest tests/triggers", "coverage": "jest --coverage", - "lint": "eslint . --cache" + "lint": "eslint . --cache", + "check-format": "prettier --check .", + "format": "prettier --write ." }, "homepage": "https://github.com/scaleway/serverless-scaleway-functions", "keywords": [ @@ -65,6 +67,7 @@ "eslint-plugin-import": "^2.27.5", "fs-extra": "^11.1.1", "jest": "^29.6.1", + "prettier": "^2.8.8", "rewire": "^6.0.0" } } From 8b438a4035a4463db0e9942a2674b9e5f03d181c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andy=20M=C3=A9ry?= Date: Mon, 8 Jul 2024 16:37:27 +0200 Subject: [PATCH 4/5] chore: bump version to 0.4.11 --- CHANGELOG.md | 10 ++++++++++ examples/container-schedule/package.json | 2 +- examples/container/package.json | 2 +- examples/go/package.json | 2 +- examples/multiple/package.json | 2 +- examples/nodejs-es-modules/package.json | 2 +- examples/nodejs-schedule/package.json | 2 +- examples/nodejs/package.json | 2 +- examples/php/package.json | 2 +- examples/python3/package.json | 2 +- examples/rust/package.json | 2 +- examples/secrets/package.json | 2 +- examples/typescript/package.json | 2 +- 13 files changed, 22 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 519096ab..273551b6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.4.11 + +### Fixed + +- Clarified documentation on currently supported Serverless Framework versions #213 + +### Added + +- Added option to configure `sandbox` for functions and containers #224 + ## 0.4.10 ### Changed diff --git a/examples/container-schedule/package.json b/examples/container-schedule/package.json index 9930da18..ddaa5f89 100644 --- a/examples/container-schedule/package.json +++ b/examples/container-schedule/package.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": {}, "devDependencies": { - "serverless-scaleway-functions": ">=0.4.10" + "serverless-scaleway-functions": ">=0.4.11" }, "description": "" } diff --git a/examples/container/package.json b/examples/container/package.json index 0dab4bff..e661f376 100644 --- a/examples/container/package.json +++ b/examples/container/package.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": {}, "devDependencies": { - "serverless-scaleway-functions": ">=0.4.10" + "serverless-scaleway-functions": ">=0.4.11" }, "description": "" } diff --git a/examples/go/package.json b/examples/go/package.json index 5364d699..f90e9b1f 100644 --- a/examples/go/package.json +++ b/examples/go/package.json @@ -9,7 +9,7 @@ "license": "ISC", "dependencies": {}, "devDependencies": { - "serverless-scaleway-functions": ">=0.4.10" + "serverless-scaleway-functions": ">=0.4.11" }, "description": "" } diff --git a/examples/multiple/package.json b/examples/multiple/package.json index 3ac662c4..a540eabd 100644 --- a/examples/multiple/package.json +++ b/examples/multiple/package.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": {}, "devDependencies": { - "serverless-scaleway-functions": ">=0.4.10" + "serverless-scaleway-functions": ">=0.4.11" }, "description": "" } diff --git a/examples/nodejs-es-modules/package.json b/examples/nodejs-es-modules/package.json index d053a7d0..8888b0e6 100644 --- a/examples/nodejs-es-modules/package.json +++ b/examples/nodejs-es-modules/package.json @@ -11,7 +11,7 @@ "license": "ISC", "devDependencies": { "@scaleway/serverless-functions": "^1.0.2", - "serverless-scaleway-functions": ">=0.4.10" + "serverless-scaleway-functions": ">=0.4.11" }, "description": "" } diff --git a/examples/nodejs-schedule/package.json b/examples/nodejs-schedule/package.json index c64dcba2..86f2a88b 100644 --- a/examples/nodejs-schedule/package.json +++ b/examples/nodejs-schedule/package.json @@ -10,7 +10,7 @@ "license": "ISC", "devDependencies": { "@scaleway/serverless-functions": "^1.0.2", - "serverless-scaleway-functions": ">=0.4.10" + "serverless-scaleway-functions": ">=0.4.11" }, "description": "" } diff --git a/examples/nodejs/package.json b/examples/nodejs/package.json index a6d986ec..751c74e9 100644 --- a/examples/nodejs/package.json +++ b/examples/nodejs/package.json @@ -10,7 +10,7 @@ "license": "ISC", "devDependencies": { "@scaleway/serverless-functions": "^1.0.2", - "serverless-scaleway-functions": ">=0.4.10" + "serverless-scaleway-functions": ">=0.4.11" }, "description": "" } diff --git a/examples/php/package.json b/examples/php/package.json index 2f0373a1..e569c32a 100644 --- a/examples/php/package.json +++ b/examples/php/package.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": {}, "devDependencies": { - "serverless-scaleway-functions": ">=0.4.10" + "serverless-scaleway-functions": ">=0.4.11" }, "description": "" } diff --git a/examples/python3/package.json b/examples/python3/package.json index a24bf180..aae72f5d 100644 --- a/examples/python3/package.json +++ b/examples/python3/package.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": {}, "devDependencies": { - "serverless-scaleway-functions": ">=0.4.10" + "serverless-scaleway-functions": ">=0.4.11" }, "description": "" } diff --git a/examples/rust/package.json b/examples/rust/package.json index cbfea5ed..14984458 100644 --- a/examples/rust/package.json +++ b/examples/rust/package.json @@ -9,7 +9,7 @@ "license": "ISC", "dependencies": {}, "devDependencies": { - "serverless-scaleway-functions": ">=0.4.10" + "serverless-scaleway-functions": ">=0.4.11" }, "description": "" } diff --git a/examples/secrets/package.json b/examples/secrets/package.json index 587b242e..7a827da2 100644 --- a/examples/secrets/package.json +++ b/examples/secrets/package.json @@ -10,7 +10,7 @@ "license": "ISC", "dependencies": {}, "devDependencies": { - "serverless-scaleway-functions": ">=0.4.10" + "serverless-scaleway-functions": ">=0.4.11" }, "description": "" } diff --git a/examples/typescript/package.json b/examples/typescript/package.json index a7cc0668..9396fdf8 100644 --- a/examples/typescript/package.json +++ b/examples/typescript/package.json @@ -12,7 +12,7 @@ "devDependencies": { "@types/node": "^18.15.11", "@scaleway/serverless-functions": ">=1.0.2", - "serverless-scaleway-functions": ">=0.4.10", + "serverless-scaleway-functions": ">=0.4.11", "typescript": "^5.0.2" } } From 564aeb64828cff71bfa3d96aed3f60f9bc7f0124 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andy=20M=C3=A9ry?= Date: Mon, 8 Jul 2024 16:38:34 +0200 Subject: [PATCH 5/5] 0.4.11 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3e60158f..249d40fe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "serverless-scaleway-functions", - "version": "0.4.10", + "version": "0.4.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "serverless-scaleway-functions", - "version": "0.4.10", + "version": "0.4.11", "license": "MIT", "dependencies": { "@serverless/utils": "^6.13.1", diff --git a/package.json b/package.json index e3b622ed..78350de2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "serverless-scaleway-functions", - "version": "0.4.10", + "version": "0.4.11", "description": "Provider plugin for the Serverless Framework v1.x which adds support for Scaleway Functions.", "main": "index.js", "author": "scaleway.com",