|
3 | 3 | const BbPromise = require('bluebird'); |
4 | 4 | const secrets = require('../../shared/secrets'); |
5 | 5 | 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'); |
7 | 7 |
|
8 | 8 | module.exports = { |
9 | 9 | createFunctions() { |
@@ -154,18 +154,43 @@ module.exports = { |
154 | 154 |
|
155 | 155 | if (Object.keys(existingRuntimesByName).includes(currentRuntime)) { |
156 | 156 | 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; |
167 | 193 | } |
168 | | - return currentRuntime; |
169 | 194 | } |
170 | 195 |
|
171 | 196 | let errorMessage = `Runtime "${currentRuntime}" does not exist`; |
|
0 commit comments