mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-12 15:53:46 -04:00
v4.7 (#12478)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: peaklabs-dev <122374094+peaklabs-dev@users.noreply.github.com> Co-authored-by: Aditya Tripathi <aditya@climactic.co>
This commit is contained in:
co-authored by
Claude Opus 5.5
peaklabs-dev
Aditya Tripathi
parent
b7dc2e435b
commit
033f0c84da
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use App\Casts\EncryptedArrayCast;
|
||||
use App\Enums\ApplicationDeploymentStatus;
|
||||
use App\Jobs\SyncGithubDeploymentJob;
|
||||
use App\Services\Access\AccessResolver;
|
||||
use App\Services\Security\SensitiveDataRedactor;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
@@ -105,6 +106,22 @@ class ApplicationDeploymentQueue extends Model
|
||||
]);
|
||||
});
|
||||
|
||||
static::updated(function (ApplicationDeploymentQueue $deployment): void {
|
||||
if (! $deployment->wasChanged('status')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// A failed GitHub sync must not stop the status transition or the deployment queue.
|
||||
try {
|
||||
SyncGithubDeploymentJob::dispatchFor($deployment);
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('Failed to queue the GitHub deployment sync.', [
|
||||
'deployment_uuid' => $deployment->deployment_uuid,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
static::updated(function (ApplicationDeploymentQueue $deployment): void {
|
||||
if (! auth()->check()
|
||||
|| ! $deployment->wasChanged('status')
|
||||
@@ -155,6 +172,8 @@ class ApplicationDeploymentQueue extends Model
|
||||
'horizon_job_id',
|
||||
'horizon_job_worker',
|
||||
'finished_at',
|
||||
'scan_gate_result',
|
||||
'scan_gate_bypassed_by',
|
||||
'deploy_started_at',
|
||||
];
|
||||
|
||||
@@ -175,6 +194,7 @@ class ApplicationDeploymentQueue extends Model
|
||||
protected $casts = [
|
||||
'pull_request_id' => 'integer',
|
||||
'finished_at' => 'datetime',
|
||||
'scan_gate_result' => 'array',
|
||||
'deploy_started_at' => 'datetime',
|
||||
'configuration_snapshot' => EncryptedArrayCast::class,
|
||||
'configuration_diff' => EncryptedArrayCast::class,
|
||||
@@ -250,6 +270,22 @@ class ApplicationDeploymentQueue extends Model
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* The image scan gate stopped this deployment. The status stays failed, the UI shows "Blocked".
|
||||
*/
|
||||
public function isImageScanBlocked(): bool
|
||||
{
|
||||
return (bool) data_get($this->scan_gate_result, 'blocked', false);
|
||||
}
|
||||
|
||||
/**
|
||||
* The image scan could not run and the deployment went on without it.
|
||||
*/
|
||||
public function isImageScanSkipped(): bool
|
||||
{
|
||||
return ! $this->isImageScanBlocked() && filled(data_get($this->scan_gate_result, 'error'));
|
||||
}
|
||||
|
||||
public function commitMessage()
|
||||
{
|
||||
if (empty($this->commit_message) || is_null($this->commit_message)) {
|
||||
|
||||
Reference in New Issue
Block a user