From f626c15eccba4ad1550375a809b48b8f0e529d08 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 6 Feb 2024 07:12:09 +0100 Subject: [PATCH 1/3] Update version numbers + fix deploy issue --- app/Http/Controllers/Api/Deploy.php | 2 +- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/Deploy.php b/app/Http/Controllers/Api/Deploy.php index 04fc9b816..f235256bb 100644 --- a/app/Http/Controllers/Api/Deploy.php +++ b/app/Http/Controllers/Api/Deploy.php @@ -97,7 +97,7 @@ class Deploy extends Controller public function deploy_resource($resource, bool $force = false): Collection { $message = collect([]); - $type = $resource->getMorphClass(); + $type = $resource?->getMorphClass(); if ($type === 'App\Models\Application') { queue_application_deployment( application: $resource, diff --git a/config/sentry.php b/config/sentry.php index 8013d44e6..2d8f7c7f3 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.208', + 'release' => '4.0.0-beta.209', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index 51db94a70..ff1387709 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Tue, 6 Feb 2024 07:19:11 +0100 Subject: [PATCH 2/3] Fix resource not found error and improve mass deployment process --- app/Http/Controllers/Api/Deploy.php | 3 +++ app/Livewire/Tags/Show.php | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Api/Deploy.php b/app/Http/Controllers/Api/Deploy.php index f235256bb..4138ce6c0 100644 --- a/app/Http/Controllers/Api/Deploy.php +++ b/app/Http/Controllers/Api/Deploy.php @@ -97,6 +97,9 @@ class Deploy extends Controller public function deploy_resource($resource, bool $force = false): Collection { $message = collect([]); + if (gettype($resource) !== 'object') { + return $message->push("Resource ($resource) not found."); + } $type = $resource?->getMorphClass(); if ($type === 'App\Models\Application') { queue_application_deployment( diff --git a/app/Livewire/Tags/Show.php b/app/Livewire/Tags/Show.php index 3bb669615..05b25955a 100644 --- a/app/Livewire/Tags/Show.php +++ b/app/Livewire/Tags/Show.php @@ -50,13 +50,14 @@ class Show extends Component public function redeploy_all() { try { - $this->applications->each(function ($resource) { + $message = collect([]); + $this->applications->each(function ($resource) use ($message) { $deploy = new Deploy(); - $deploy->deploy_resource($resource); + $message->push($deploy->deploy_resource($resource)); }); - $this->services->each(function ($resource) { + $this->services->each(function ($resource) use ($message) { $deploy = new Deploy(); - $deploy->deploy_resource($resource); + $message->push($deploy->deploy_resource($resource)); }); $this->dispatch('success', 'Mass deployment started.'); } catch (\Exception $e) { From 6869c582ffa7c4ff4840b832f3299cf9f611aebf Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Tue, 6 Feb 2024 07:21:06 +0100 Subject: [PATCH 3/3] Update retrieval of applications and services in Deploy controller --- app/Http/Controllers/Api/Deploy.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Api/Deploy.php b/app/Http/Controllers/Api/Deploy.php index 4138ce6c0..f071f3b5b 100644 --- a/app/Http/Controllers/Api/Deploy.php +++ b/app/Http/Controllers/Api/Deploy.php @@ -73,8 +73,8 @@ class Deploy extends Controller $message->push("Tag {$tag} not found."); continue; } - $applications = $found_tag->applications(); - $services = $found_tag->services(); + $applications = $found_tag->applications()->get(); + $services = $found_tag->services()->get(); if ($applications->count() === 0 && $services->count() === 0) { $message->push("No resources found for tag {$tag}."); continue;