fix: Update helper image pulling logic to only pull if the version is newer

This commit is contained in:
Andras Bacsai
2024-09-05 11:44:33 +02:00
parent 645337b09c
commit 3aa31f3da6
3 changed files with 4 additions and 100 deletions

View File

@@ -12,7 +12,6 @@ use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\Middleware\WithoutOverlapping;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
class PullHelperImageJob implements ShouldBeEncrypted, ShouldQueue
{
@@ -41,16 +40,11 @@ class PullHelperImageJob implements ShouldBeEncrypted, ShouldQueue
$settings = InstanceSettings::get();
$latest_version = data_get($versions, 'coolify.helper.version');
$current_version = $settings->helper_version;
Log::info('Latest version', $latest_version);
Log::info('Current version', $current_version);
if (version_compare($latest_version, $current_version, '>')) {
// New version available
Log::info('New version available', $latest_version);
$helperImage = config('coolify.helper_image');
// REMOVE -next
instant_remote_process(["docker pull -q {$helperImage}:{$latest_version}-next"], $this->server);
instant_remote_process(["docker pull -q {$helperImage}:{$latest_version}"], $this->server);
$settings->update(['helper_version' => $latest_version]);
Log::info('Pulled helper image', $helperImage, $latest_version);
}
}