Skip to content

Commit ffee2c2

Browse files
authored
Merge pull request #146 from open-runtimes/upgrade-opr-v5
Upgrade to OPR v5
2 parents 0e72a11 + 3c9ab71 commit ffee2c2

File tree

5 files changed

+79
-79
lines changed

5 files changed

+79
-79
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ OPR_EXECUTOR_LOGGING_PROVIDER=
1111
OPR_EXECUTOR_LOGGING_CONFIG=
1212
OPR_EXECUTOR_DOCKER_HUB_USERNAME=
1313
OPR_EXECUTOR_DOCKER_HUB_PASSWORD=
14-
OPR_EXECUTOR_RUNTIME_VERSIONS=v4,v4rc
14+
OPR_EXECUTOR_RUNTIME_VERSIONS=v2,v5
1515
OPR_EXECUTOR_RETRY_ATTEMPTS=5
1616
OPR_EXECUTOR_RETRY_DELAY_MS=500

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ OPR_EXECUTOR_LOGGING_PROVIDER=
9090
OPR_EXECUTOR_LOGGING_CONFIG=
9191
OPR_EXECUTOR_DOCKER_HUB_USERNAME=
9292
OPR_EXECUTOR_DOCKER_HUB_PASSWORD=
93-
OPR_EXECUTOR_RUNTIME_VERSIONS=v4
93+
OPR_EXECUTOR_RUNTIME_VERSIONS=v5
9494
OPR_EXECUTOR_RETRY_ATTEMPTS=5
9595
OPR_EXECUTOR_RETRY_DELAY_MS=500
9696
```
@@ -161,7 +161,7 @@ docker compose down
161161
| `remove` | `boolean` | Remove a runtime after execution | | false |
162162
| `cpus` | `float` | Maximum CPU cores runtime can utilize | | 1 |
163163
| `memory` | `integer` | Container RAM memory in MBs | | 512 |
164-
| `version` | `string` | Runtime Open Runtime version (allowed values: 'v2', 'v4') | | 'v4' |
164+
| `version` | `string` | Runtime Open Runtime version (allowed values: 'v2', 'v5') | | 'v5' |
165165

166166
#### /v1/runtimes/{runtimeId}
167167
| Param | Type | Description | Required | Default |
@@ -183,7 +183,7 @@ docker compose down
183183
| `variables` | `json` | Environment variables passed into runtime | | [ ] |
184184
| `cpus` | `floats` | Maximum CPU cores runtime can utilize | | 1 |
185185
| `memory` | `integer` | Container RAM memory in MBs | | 512 |
186-
| `version` | `string` | Runtime Open Runtime version (allowed values: 'v2', 'v4') | | 'v4' |
186+
| `version` | `string` | Runtime Open Runtime version (allowed values: 'v2', 'v5') | | 'v5' |
187187
| `runtimeEntrypoint` | `string` | Commands to run when creating a container. Maximum of 100 commands are allowed, each 1024 characters long. | | ' ' |
188188

189189
## Environment variables
@@ -201,7 +201,7 @@ docker compose down
201201
| OPR_EXECUTOR_LOGGING_CONFIG | External logging provider DSN used by the executor, ex: `sentry://PROJECT_ID:SENTRY_API_KEY@SENTRY_HOST/` |
202202
| OPR_EXECUTOR_DOCKER_HUB_USERNAME | Username for Docker Hub authentication (if applicable) |
203203
| OPR_EXECUTOR_DOCKER_HUB_PASSWORD | Password for Docker Hub authentication (if applicable) |
204-
| OPR_EXECUTOR_RUNTIME_VERSIONS | Version tag for runtime environments, ex: `v4` |
204+
| OPR_EXECUTOR_RUNTIME_VERSIONS | Version tag for runtime environments, ex: `v5` |
205205
| OPR_EXECUTOR_RETRY_ATTEMPTS | Number of retry attempts for failed executions, ex: `5` |
206206
| OPR_EXECUTOR_RETRY_DELAY_MS | Delay (in milliseconds) between retry attempts, ex: `500` |
207207
| OPR_EXECUTOR_IMAGE_PULL | Pull open runtimes images before executor starts. Takes `disabled` and `enabled` |

app/http.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ function cleanUp(Orchestration $orchestration, Table $activeRuntimes, array $net
574574
->param('remove', false, new Boolean(), 'Remove a runtime after execution.', true)
575575
->param('cpus', 1, new FloatValidator(true), 'Container CPU.', true)
576576
->param('memory', 512, new Integer(), 'Container RAM memory.', true)
577-
->param('version', 'v4', new WhiteList(['v2', 'v4']), 'Runtime Open Runtime version.', true)
577+
->param('version', 'v5', new WhiteList(['v2', 'v5']), 'Runtime Open Runtime version.', true)
578578
->param('restartPolicy', DockerAPI::RESTART_NO, new WhiteList([DockerAPI::RESTART_NO, DockerAPI::RESTART_ALWAYS, DockerAPI::RESTART_ON_FAILURE, DockerAPI::RESTART_UNLESS_STOPPED], true), 'Define restart policy for the runtime once an exit code is returned. Default value is "no". Possible values are "no", "always", "on-failure", "unless-stopped".', true)
579579
->inject('networks')
580580
->inject('orchestration')
@@ -655,7 +655,7 @@ function cleanUp(Orchestration $orchestration, Table $activeRuntimes, array $net
655655
'INTERNAL_RUNTIME_ENTRYPOINT' => $entrypoint,
656656
'INERNAL_EXECUTOR_HOSTNAME' => System::getHostname()
657657
],
658-
'v4' => [
658+
'v5' => [
659659
'OPEN_RUNTIMES_SECRET' => $secret,
660660
'OPEN_RUNTIMES_ENTRYPOINT' => $entrypoint,
661661
'OPEN_RUNTIMES_HOSTNAME' => System::getHostname(),
@@ -701,7 +701,7 @@ function cleanUp(Orchestration $orchestration, Table $activeRuntimes, array $net
701701
\dirname($tmpBuild) . ':' . $codeMountPath . ':rw',
702702
];
703703

704-
if ($version === 'v4') {
704+
if ($version === 'v5') {
705705
$volumes[] = \dirname($tmpLogs . '/logs') . ':/mnt/logs:rw';
706706
$volumes[] = \dirname($tmpLogging . '/logging') . ':/tmp/logging:rw';
707707
}
@@ -956,7 +956,7 @@ function cleanUp(Orchestration $orchestration, Table $activeRuntimes, array $net
956956
->param('variables', [], new AnyOf([new Text(65535), new Assoc()], AnyOf::TYPE_MIXED), 'Environment variables passed into runtime.', true)
957957
->param('cpus', 1, new FloatValidator(true), 'Container CPU.', true)
958958
->param('memory', 512, new Integer(true), 'Container RAM memory.', true)
959-
->param('version', 'v4', new WhiteList(['v2', 'v4']), 'Runtime Open Runtime version.', true)
959+
->param('version', 'v5', new WhiteList(['v2', 'v5']), 'Runtime Open Runtime version.', true)
960960
->param('runtimeEntrypoint', '', new Text(1024, 0), 'Commands to run when creating a container. Maximum of 100 commands are allowed, each 1024 characters long.', true)
961961
->param('logging', true, new Boolean(true), 'Whether executions will be logged.', true)
962962
->param('restartPolicy', DockerAPI::RESTART_NO, new WhiteList([DockerAPI::RESTART_NO, DockerAPI::RESTART_ALWAYS, DockerAPI::RESTART_ON_FAILURE, DockerAPI::RESTART_UNLESS_STOPPED], true), 'Define restart policy once exit code is returned by command. Default value is "no". Possible values are "no", "always", "on-failure", "unless-stopped".', true)
@@ -1231,7 +1231,7 @@ function (string $runtimeId, ?string $payload, string $path, string $method, mix
12311231
];
12321232
};
12331233

1234-
$executeV4 = function () use ($path, $method, $headers, $payload, $secret, $hostname, $timeout, $runtimeName, $logging): array {
1234+
$executeV5 = function () use ($path, $method, $headers, $payload, $secret, $hostname, $timeout, $runtimeName, $logging): array {
12351235
$statusCode = 0;
12361236
$errNo = -1;
12371237
$executorResponse = '';
@@ -1411,7 +1411,7 @@ function (string $runtimeId, ?string $payload, string $path, string $method, mix
14111411
}
14121412

14131413
// Execute function
1414-
$executionRequest = $version === 'v4' ? $executeV4 : $executeV2;
1414+
$executionRequest = $version === 'v5' ? $executeV5 : $executeV2;
14151415

14161416
$retryDelayMs = \intval(Http::getEnv('OPR_EXECUTOR_RETRY_DELAY_MS', '500'));
14171417
$retryAttempts = \intval(Http::getEnv('OPR_EXECUTOR_RETRY_ATTEMPTS', '5'));
@@ -1635,7 +1635,7 @@ function (string $runtimeId, ?string $payload, string $path, string $method, mix
16351635
// Useful to prevent auto-pulling from remote when testing local images
16361636
Console::info("Skipping image pulling");
16371637
} else {
1638-
$runtimeVersions = \explode(',', Http::getEnv('OPR_EXECUTOR_RUNTIME_VERSIONS', 'v4') ?? 'v4');
1638+
$runtimeVersions = \explode(',', Http::getEnv('OPR_EXECUTOR_RUNTIME_VERSIONS', 'v5') ?? 'v5');
16391639
foreach ($runtimeVersions as $runtimeVersion) {
16401640
Console::success("Pulling $runtimeVersion images...");
16411641
$runtimes = new Runtimes($runtimeVersion); // TODO: @Meldiron Make part of open runtimes

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)