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:
Andras Bacsai
2026-11-06 14:25:02 +01:00
committed by GitHub
co-authored by Claude Opus 5.5 peaklabs-dev Aditya Tripathi
parent b7dc2e435b
commit 033f0c84da
581 changed files with 58626 additions and 2456 deletions
+36
View File
@@ -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)) {