Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 37 additions & 12 deletions deploy/lib/createFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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`;
Expand Down
4 changes: 4 additions & 0 deletions shared/runtimes.js
Original file line number Diff line number Diff line change
@@ -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,
};