fix(server): add build server check to disable Sentinel and update related logic

This commit is contained in:
Andras Bacsai
2025-09-16 10:31:57 +02:00
parent 2ef139bc42
commit 9bd80e4c07

View File

@@ -298,11 +298,34 @@ class Show extends Component
} }
} }
public function updatedIsBuildServer($value)
{
try {
$this->authorize('update', $this->server);
if ($value === true && $this->isSentinelEnabled) {
$this->isSentinelEnabled = false;
$this->isMetricsEnabled = false;
$this->isSentinelDebugEnabled = false;
StopSentinel::dispatch($this->server);
$this->dispatch('info', 'Sentinel has been disabled as build servers cannot run Sentinel.');
}
$this->submit();
} catch (\Throwable $e) {
return handleError($e, $this);
}
}
public function updatedIsSentinelEnabled($value) public function updatedIsSentinelEnabled($value)
{ {
try { try {
$this->authorize('manageSentinel', $this->server); $this->authorize('manageSentinel', $this->server);
if ($value === true) { if ($value === true) {
if ($this->isBuildServer) {
$this->isSentinelEnabled = false;
$this->dispatch('error', 'Sentinel cannot be enabled on build servers.');
return;
}
$customImage = isDev() ? $this->sentinelCustomDockerImage : null; $customImage = isDev() ? $this->sentinelCustomDockerImage : null;
StartSentinel::run($this->server, true, null, $customImage); StartSentinel::run($this->server, true, null, $customImage);
} else { } else {