diff --git a/deploy/lib/createFunctions.js b/deploy/lib/createFunctions.js index 1ccb3d0c..40b913b5 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,43 @@ 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} + +Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/reference-content/functions-lifecycle/#available-runtimes + + `); + return currentRuntime; + + 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} + +Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/reference-content/functions-lifecycle/#available-runtimes + + `); + + return currentRuntime; + + 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); + + return currentRuntime; } - return currentRuntime; } let errorMessage = `Runtime "${currentRuntime}" does not exist`; diff --git a/shared/runtimes.js b/shared/runtimes.js index a8ac4817..f614acd0 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_life'; module.exports = { RUNTIME_STATUS_AVAILABLE, + RUNTIME_STATUS_EOS, + RUNTIME_STATUS_EOL, };