From a949a71c146ab60b682aeb47476e4e0ac4207584 Mon Sep 17 00:00:00 2001 From: thomas-tacquet Date: Fri, 19 Aug 2022 11:45:32 +0200 Subject: [PATCH 1/4] add more details to eol/eos runtimes --- deploy/lib/createFunctions.js | 37 +++++++++++++++++++++++------------ shared/runtimes.js | 4 ++++ 2 files changed, 29 insertions(+), 12 deletions(-) diff --git a/deploy/lib/createFunctions.js b/deploy/lib/createFunctions.js index 1ccb3d0c..eec6cbe0 100644 --- a/deploy/lib/createFunctions.js +++ b/deploy/lib/createFunctions.js @@ -3,7 +3,7 @@ const BbPromise = require('bluebird'); const secrets = require('../../shared/secrets'); const singleSource = require('../../shared/singleSource'); -const { RUNTIME_STATUS_AVAILABLE } = require('../../shared/runtimes'); +const { RUNTIME_STATUS_AVAILABLE, RUNTIME_STATUS_EOL, RUNTIME_STATUS_EOS } = require('../../shared/runtimes'); module.exports = { createFunctions() { @@ -154,18 +154,31 @@ module.exports = { if (Object.keys(existingRuntimesByName).includes(currentRuntime)) { const runtime = existingRuntimesByName[currentRuntime]; - if (runtime.status !== RUNTIME_STATUS_AVAILABLE) { - let warnMessage = `WARNING: Runtime ${currentRuntime} is in status ${runtime.status}`; - if ( - runtime.statusMessage !== null && - runtime.statusMessage !== undefined && - runtime.statusMessage !== "" - ) { - warnMessage += `: ${runtime.statusMessage}`; - } - logger.log(warnMessage); + + switch (runtime.status) { + case RUNTIME_STATUS_AVAILABLE: + return currentRuntime; + + case RUNTIME_STATUS_EOL: + logger.log(`Runtime ${runtime.name} is in End Of Life. Functions that use this runtime will still be working, but it is no more possible to update them. Note : ${runtime.statusMessage}`); + break; + + case RUNTIME_STATUS_EOS: + logger.log(`Runtime ${runtime.name} is in End Of Support. It is no longer possible to create a new function with this runtime; however, functions that already use it can still be updated. Note : ${runtime.statusMessage}`); + break; + + default: + let warnMessage = `WARNING: Runtime ${currentRuntime} is in status ${runtime.status}`; + if ( + runtime.statusMessage !== null && + runtime.statusMessage !== undefined && + runtime.statusMessage !== "" + ) { + warnMessage += `: ${runtime.statusMessage}`; + } + logger.log(warnMessage); + break; } - return currentRuntime; } let errorMessage = `Runtime "${currentRuntime}" does not exist`; diff --git a/shared/runtimes.js b/shared/runtimes.js index a8ac4817..1c7328a5 100644 --- a/shared/runtimes.js +++ b/shared/runtimes.js @@ -1,7 +1,11 @@ 'use strict' const RUNTIME_STATUS_AVAILABLE = 'available'; +const RUNTIME_STATUS_EOS = 'end_of_support'; +const RUNTIME_STATUS_EOL = 'end_of_live'; module.exports = { RUNTIME_STATUS_AVAILABLE, + RUNTIME_STATUS_EOS, + RUNTIME_STATUS_EOL, }; From e7e5d5ea92ebbd09cf82fa39a9292df083d4286f Mon Sep 17 00:00:00 2001 From: thomas-tacquet Date: Fri, 19 Aug 2022 12:05:34 +0200 Subject: [PATCH 2/4] format --- deploy/lib/createFunctions.js | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/deploy/lib/createFunctions.js b/deploy/lib/createFunctions.js index eec6cbe0..8e8df549 100644 --- a/deploy/lib/createFunctions.js +++ b/deploy/lib/createFunctions.js @@ -160,11 +160,24 @@ module.exports = { return currentRuntime; case RUNTIME_STATUS_EOL: - logger.log(`Runtime ${runtime.name} is in End Of Life. Functions that use this runtime will still be working, but it is no more possible to update them. Note : ${runtime.statusMessage}`); + logger.log(`Runtime ${runtime.name} is in End Of Life. Functions that use this runtime will still be working, but it is no more possible to update them. +Note : ${runtime.statusMessage} + +Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/reference-content/functions-lifecycle/#available-runtimes + + `); + return currentRuntime; break; case RUNTIME_STATUS_EOS: - logger.log(`Runtime ${runtime.name} is in End Of Support. It is no longer possible to create a new function with this runtime; however, functions that already use it can still be updated. Note : ${runtime.statusMessage}`); + logger.log(`Runtime ${runtime.name} is in End Of Support. It is no longer possible to create a new function with this runtime; however, functions that already use it can still be updated. +Note : ${runtime.statusMessage} + +Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/reference-content/functions-lifecycle/#available-runtimes + + `); + + return currentRuntime; break; default: From 94ccae052b681602c796ea8192632689740589c1 Mon Sep 17 00:00:00 2001 From: thomas-tacquet Date: Fri, 19 Aug 2022 12:06:05 +0200 Subject: [PATCH 3/4] typo --- shared/runtimes.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/runtimes.js b/shared/runtimes.js index 1c7328a5..f614acd0 100644 --- a/shared/runtimes.js +++ b/shared/runtimes.js @@ -2,7 +2,7 @@ const RUNTIME_STATUS_AVAILABLE = 'available'; const RUNTIME_STATUS_EOS = 'end_of_support'; -const RUNTIME_STATUS_EOL = 'end_of_live'; +const RUNTIME_STATUS_EOL = 'end_of_life'; module.exports = { RUNTIME_STATUS_AVAILABLE, From 0372a5566ae3e1b3419a2876c63bcb6d131bc211 Mon Sep 17 00:00:00 2001 From: thomas-tacquet Date: Fri, 19 Aug 2022 14:26:11 +0200 Subject: [PATCH 4/4] review --- deploy/lib/createFunctions.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/deploy/lib/createFunctions.js b/deploy/lib/createFunctions.js index 8e8df549..40b913b5 100644 --- a/deploy/lib/createFunctions.js +++ b/deploy/lib/createFunctions.js @@ -167,7 +167,6 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer `); return currentRuntime; - break; case RUNTIME_STATUS_EOS: logger.log(`Runtime ${runtime.name} is in End Of Support. It is no longer possible to create a new function with this runtime; however, functions that already use it can still be updated. @@ -178,7 +177,6 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer `); return currentRuntime; - break; default: let warnMessage = `WARNING: Runtime ${currentRuntime} is in status ${runtime.status}`; @@ -190,7 +188,8 @@ Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/refer warnMessage += `: ${runtime.statusMessage}`; } logger.log(warnMessage); - break; + + return currentRuntime; } }