Refactor PullSentinelImageJob.php to only start Sentinel if local version is outdated

This commit is contained in:
Andras Bacsai 2024-05-08 19:32:13 +02:00
parent 1a152a5597
commit 781bf52a8e

View File

@ -39,12 +39,11 @@ public function handle(): void
return;
}
$local_version = instant_remote_process(['docker exec coolify-sentinel sh -c "curl http://127.0.0.1:8888/api/version"'], $this->server, '0.0.0');
if ($version === $local_version) {
ray('Sentinel image is up to date');
if (version_compare($local_version, $version, '<')) {
StartSentinel::run($this->server, $version, true);
return;
}
ray('Pulling Sentinel image');
StartSentinel::run($this->server, $version, true);
ray('Sentinel image is up to date');
} catch (\Throwable $e) {
send_internal_notification('PullSentinelImageJob failed with: ' . $e->getMessage());
ray($e->getMessage());