Skip to content

Commit 2c95f78

Browse files
add more details to eol/eos runtimes (#101)
1 parent 6e115b3 commit 2c95f78

File tree

2 files changed

+41
-12
lines changed

2 files changed

+41
-12
lines changed

deploy/lib/createFunctions.js

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const BbPromise = require('bluebird');
44
const secrets = require('../../shared/secrets');
55
const singleSource = require('../../shared/singleSource');
6-
const { RUNTIME_STATUS_AVAILABLE } = require('../../shared/runtimes');
6+
const { RUNTIME_STATUS_AVAILABLE, RUNTIME_STATUS_EOL, RUNTIME_STATUS_EOS } = require('../../shared/runtimes');
77

88
module.exports = {
99
createFunctions() {
@@ -154,18 +154,43 @@ module.exports = {
154154

155155
if (Object.keys(existingRuntimesByName).includes(currentRuntime)) {
156156
const runtime = existingRuntimesByName[currentRuntime];
157-
if (runtime.status !== RUNTIME_STATUS_AVAILABLE) {
158-
let warnMessage = `WARNING: Runtime ${currentRuntime} is in status ${runtime.status}`;
159-
if (
160-
runtime.statusMessage !== null &&
161-
runtime.statusMessage !== undefined &&
162-
runtime.statusMessage !== ""
163-
) {
164-
warnMessage += `: ${runtime.statusMessage}`;
165-
}
166-
logger.log(warnMessage);
157+
158+
switch (runtime.status) {
159+
case RUNTIME_STATUS_AVAILABLE:
160+
return currentRuntime;
161+
162+
case RUNTIME_STATUS_EOL:
163+
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.
164+
Note : ${runtime.statusMessage}
165+
166+
Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/reference-content/functions-lifecycle/#available-runtimes
167+
168+
`);
169+
return currentRuntime;
170+
171+
case RUNTIME_STATUS_EOS:
172+
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.
173+
Note : ${runtime.statusMessage}
174+
175+
Runtime lifecycle doc : https://www.scaleway.com/en/docs/compute/functions/reference-content/functions-lifecycle/#available-runtimes
176+
177+
`);
178+
179+
return currentRuntime;
180+
181+
default:
182+
let warnMessage = `WARNING: Runtime ${currentRuntime} is in status ${runtime.status}`;
183+
if (
184+
runtime.statusMessage !== null &&
185+
runtime.statusMessage !== undefined &&
186+
runtime.statusMessage !== ""
187+
) {
188+
warnMessage += `: ${runtime.statusMessage}`;
189+
}
190+
logger.log(warnMessage);
191+
192+
return currentRuntime;
167193
}
168-
return currentRuntime;
169194
}
170195

171196
let errorMessage = `Runtime "${currentRuntime}" does not exist`;

shared/runtimes.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
'use strict'
22

33
const RUNTIME_STATUS_AVAILABLE = 'available';
4+
const RUNTIME_STATUS_EOS = 'end_of_support';
5+
const RUNTIME_STATUS_EOL = 'end_of_life';
46

57
module.exports = {
68
RUNTIME_STATUS_AVAILABLE,
9+
RUNTIME_STATUS_EOS,
10+
RUNTIME_STATUS_EOL,
711
};

0 commit comments

Comments
 (0)