fix(deployment): improve server selection for deployment cancellation
- Add fallback for build server and deployment server selection - Use `ownedByCurrentTeam()` scope when finding servers - Handle cases where server IDs might be null
This commit is contained in:
@@ -53,13 +53,13 @@ class DeploymentNavbar extends Component
|
|||||||
public function cancel()
|
public function cancel()
|
||||||
{
|
{
|
||||||
$kill_command = "docker rm -f {$this->application_deployment_queue->deployment_uuid}";
|
$kill_command = "docker rm -f {$this->application_deployment_queue->deployment_uuid}";
|
||||||
$build_server_id = $this->application_deployment_queue->build_server_id;
|
$build_server_id = $this->application_deployment_queue->build_server_id ?? $this->application->destination->server_id;
|
||||||
$server_id = $this->application_deployment_queue->server_id ?? $this->application->destination->server_id;
|
$server_id = $this->application_deployment_queue->server_id ?? $this->application->destination->server_id;
|
||||||
try {
|
try {
|
||||||
if ($this->application->settings->is_build_server_enabled) {
|
if ($this->application->settings->is_build_server_enabled) {
|
||||||
$server = Server::find($build_server_id);
|
$server = Server::ownedByCurrentTeam()->find($build_server_id);
|
||||||
} else {
|
} else {
|
||||||
$server = Server::find($server_id);
|
$server = Server::ownedByCurrentTeam()->find($server_id);
|
||||||
}
|
}
|
||||||
if ($this->application_deployment_queue->logs) {
|
if ($this->application_deployment_queue->logs) {
|
||||||
$previous_logs = json_decode($this->application_deployment_queue->logs, associative: true, flags: JSON_THROW_ON_ERROR);
|
$previous_logs = json_decode($this->application_deployment_queue->logs, associative: true, flags: JSON_THROW_ON_ERROR);
|
||||||
|
Reference in New Issue
Block a user