diff --git a/app/Http/Controllers/Webhook/Gitlab.php b/app/Http/Controllers/Webhook/Gitlab.php index a36929781..cd1e58bcd 100644 --- a/app/Http/Controllers/Webhook/Gitlab.php +++ b/app/Http/Controllers/Webhook/Gitlab.php @@ -202,7 +202,7 @@ public function manual(Request $request) ]); ray('Preview deployments disabled for ' . $application->name); } - } else if ($action === 'closed' || $action === 'close') { + } else if ($action === 'closed' || $action === 'close' || $action === 'merge') { $found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first(); if ($found) { $found->delete(); diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 6517aae0a..35d6aad0a 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -763,7 +763,7 @@ private function save_environment_variables() if ($env->version === '4.0.0-beta.239') { $real_value = $env->real_value; } else { - if ($env->is_literal) { + if ($env->is_literal || $env->is_multiline) { $real_value = '\'' . $real_value . '\''; } else { $real_value = escapeEnvVariables($env->real_value); @@ -804,10 +804,11 @@ private function save_environment_variables() if ($env->version === '4.0.0-beta.239') { $real_value = $env->real_value; } else { - if ($env->is_literal) { + if ($env->is_literal || $env->is_multiline) { $real_value = '\'' . $real_value . '\''; } else { $real_value = escapeEnvVariables($env->real_value); + ray($real_value); } } $envs->push($env->key . '=' . $real_value); @@ -1948,11 +1949,17 @@ private function generate_build_env_variables() if ($this->pull_request_id === 0) { foreach ($this->application->build_environment_variables as $env) { $value = escapeshellarg($env->real_value); + if (str($value)->contains("\n") && data_get($env, 'is_multiline') === true) { + $value = str_replace("\n", "\\\n", $value); + } $this->build_args->push("--build-arg {$env->key}={$value}"); } } else { foreach ($this->application->build_environment_variables_preview as $env) { $value = escapeshellarg($env->real_value); + if (str($value)->contains("\n") && data_get($env, 'is_multiline') === true) { + $value = str_replace("\n", "\\\n", $value); + } $this->build_args->push("--build-arg {$env->key}={$value}"); } } @@ -1968,10 +1975,20 @@ private function add_build_env_variables_to_dockerfile() $dockerfile = collect(Str::of($this->saved_outputs->get('dockerfile'))->trim()->explode("\n")); if ($this->pull_request_id === 0) { foreach ($this->application->build_environment_variables as $env) { - $dockerfile->splice(1, 0, "ARG {$env->key}={$env->real_value}"); + if (str($env->real_value)->contains("\n") && data_get($env, 'is_multiline') === true) { + $value = str_replace("\n", "\\\n", $env->real_value); + } else { + $value = $env->real_value; + } + $dockerfile->splice(1, 0, "ARG {$env->key}={$value}"); } } else { foreach ($this->application->build_environment_variables_preview as $env) { + if (str($env->real_value)->contains("\n") && data_get($env, 'is_multiline') === true) { + $value = str_replace("\n", "\\\n", $env->real_value); + } else { + $value = $env->real_value; + } $dockerfile->splice(1, 0, "ARG {$env->key}={$env->real_value}"); } } diff --git a/app/Jobs/CheckLogDrainContainerJob.php b/app/Jobs/CheckLogDrainContainerJob.php index 376a691cc..6e26e0023 100644 --- a/app/Jobs/CheckLogDrainContainerJob.php +++ b/app/Jobs/CheckLogDrainContainerJob.php @@ -40,7 +40,7 @@ public function healthcheck() return false; } } - public function handle(): void + public function handle() { // ray("checking log drain statuses for {$this->server->id}"); try { diff --git a/app/Livewire/Project/Database/Clickhouse/General.php b/app/Livewire/Project/Database/Clickhouse/General.php index 7fe9c1ce0..33a339e84 100644 --- a/app/Livewire/Project/Database/Clickhouse/General.php +++ b/app/Livewire/Project/Database/Clickhouse/General.php @@ -4,12 +4,14 @@ use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneClickhouse; use Exception; use Livewire\Component; class General extends Component { + public Server $server; public StandaloneClickhouse $database; public ?string $db_url = null; public ?string $db_url_public = null; @@ -43,10 +45,11 @@ public function mount() if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Dragonfly/General.php b/app/Livewire/Project/Database/Dragonfly/General.php index 0a4adf269..d9f1290bc 100644 --- a/app/Livewire/Project/Database/Dragonfly/General.php +++ b/app/Livewire/Project/Database/Dragonfly/General.php @@ -4,6 +4,7 @@ use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneDragonfly; use Exception; use Livewire\Component; @@ -12,6 +13,7 @@ class General extends Component { protected $listeners = ['refresh']; + public Server $server; public StandaloneDragonfly $database; public ?string $db_url = null; public ?string $db_url_public = null; @@ -41,10 +43,11 @@ public function mount() if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Keydb/General.php b/app/Livewire/Project/Database/Keydb/General.php index 536f743f2..222b8a2fc 100644 --- a/app/Livewire/Project/Database/Keydb/General.php +++ b/app/Livewire/Project/Database/Keydb/General.php @@ -4,6 +4,7 @@ use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneKeydb; use Exception; use Livewire\Component; @@ -12,6 +13,7 @@ class General extends Component { protected $listeners = ['refresh']; + public Server $server; public StandaloneKeydb $database; public ?string $db_url = null; public ?string $db_url_public = null; @@ -43,10 +45,12 @@ public function mount() if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); + } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Mariadb/General.php b/app/Livewire/Project/Database/Mariadb/General.php index c0c67898f..f0a7deb82 100644 --- a/app/Livewire/Project/Database/Mariadb/General.php +++ b/app/Livewire/Project/Database/Mariadb/General.php @@ -4,6 +4,7 @@ use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneMariadb; use Exception; use Livewire\Component; @@ -12,6 +13,7 @@ class General extends Component { protected $listeners = ['refresh']; + public Server $server; public StandaloneMariadb $database; public ?string $db_url = null; public ?string $db_url_public = null; @@ -50,10 +52,12 @@ public function mount() if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); + } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Mongodb/General.php b/app/Livewire/Project/Database/Mongodb/General.php index 3c1271065..3cce20baf 100644 --- a/app/Livewire/Project/Database/Mongodb/General.php +++ b/app/Livewire/Project/Database/Mongodb/General.php @@ -4,6 +4,7 @@ use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneMongodb; use Exception; use Livewire\Component; @@ -12,6 +13,7 @@ class General extends Component { protected $listeners = ['refresh']; + public Server $server; public StandaloneMongodb $database; public ?string $db_url = null; public ?string $db_url_public = null; @@ -48,11 +50,13 @@ public function mount() if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); + } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Mysql/General.php b/app/Livewire/Project/Database/Mysql/General.php index a1fb9201a..d7d5ae89f 100644 --- a/app/Livewire/Project/Database/Mysql/General.php +++ b/app/Livewire/Project/Database/Mysql/General.php @@ -4,6 +4,7 @@ use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneMysql; use Exception; use Livewire\Component; @@ -13,6 +14,7 @@ class General extends Component protected $listeners = ['refresh']; public StandaloneMysql $database; + public Server $server; public ?string $db_url = null; public ?string $db_url_public = null; @@ -50,11 +52,12 @@ public function mount() if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Postgresql/General.php b/app/Livewire/Project/Database/Postgresql/General.php index 79d91e7aa..4d5d918de 100644 --- a/app/Livewire/Project/Database/Postgresql/General.php +++ b/app/Livewire/Project/Database/Postgresql/General.php @@ -4,6 +4,7 @@ use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandalonePostgresql; use Exception; use Livewire\Component; @@ -13,6 +14,7 @@ class General extends Component { public StandalonePostgresql $database; + public Server $server; public string $new_filename; public string $new_content; public ?string $db_url = null; @@ -57,11 +59,12 @@ public function mount() if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Livewire/Project/Database/Redis/General.php b/app/Livewire/Project/Database/Redis/General.php index a894626b0..aafd8495c 100644 --- a/app/Livewire/Project/Database/Redis/General.php +++ b/app/Livewire/Project/Database/Redis/General.php @@ -4,6 +4,7 @@ use App\Actions\Database\StartDatabaseProxy; use App\Actions\Database\StopDatabaseProxy; +use App\Models\Server; use App\Models\StandaloneRedis; use Exception; use Livewire\Component; @@ -12,6 +13,7 @@ class General extends Component { protected $listeners = ['refresh']; + public Server $server; public StandaloneRedis $database; public ?string $db_url = null; public ?string $db_url_public = null; @@ -43,10 +45,12 @@ public function mount() if ($this->database->is_public) { $this->db_url_public = $this->database->get_db_url(); } + $this->server = data_get($this->database,'destination.server'); + } public function instantSaveAdvanced() { try { - if (!$this->database->destination->server->isLogDrainEnabled()) { + if (!$this->server->isLogDrainEnabled()) { $this->database->is_log_drain_enabled = false; $this->dispatch('error', 'Log drain is not enabled on the server. Please enable it first.'); return; diff --git a/app/Notifications/Channels/TelegramChannel.php b/app/Notifications/Channels/TelegramChannel.php index 6101ef208..96ae80bc0 100644 --- a/app/Notifications/Channels/TelegramChannel.php +++ b/app/Notifications/Channels/TelegramChannel.php @@ -22,6 +22,8 @@ public function send($notifiable, $notification): void $topicId = data_get($notifiable, 'telegram_notifications_test_message_thread_id'); break; case 'App\Notifications\Application\StatusChanged': + case 'App\Notifications\Container\ContainerRestarted': + case 'App\Notifications\Container\ContainerStopped': $topicId = data_get($notifiable, 'telegram_notifications_status_changes_message_thread_id'); break; case 'App\Notifications\Application\DeploymentSuccess': diff --git a/config/sentry.php b/config/sentry.php index 660b5e54f..92f375b0e 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ // 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.295', + 'release' => '4.0.0-beta.297', // 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 7778ab41b..06c1e6c66 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ started_at)