wip
This commit is contained in:
parent
bb3a1d2f16
commit
8910d5a65d
@ -318,16 +318,16 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
|
|||||||
dispatch(new InstanceProxyCheckJob());
|
dispatch(new InstanceProxyCheckJob());
|
||||||
}
|
}
|
||||||
queue_next_deployment($this->application);
|
queue_next_deployment($this->application);
|
||||||
if ($status === ProcessStatus::ERROR->value) {
|
|
||||||
Notification::send(
|
|
||||||
$this->application->environment->project->team,
|
|
||||||
new DeployedWithErrorNotification($this->application, $this->deployment_uuid, $this->pull_request_id)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($status === ProcessStatus::FINISHED->value) {
|
if ($status === ProcessStatus::FINISHED->value) {
|
||||||
Notification::send(
|
Notification::send(
|
||||||
$this->application->environment->project->team,
|
$this->application->environment->project->team,
|
||||||
new DeployedSuccessfullyNotification($this->application, $this->deployment_uuid, $this->pull_request_id)
|
new DeployedSuccessfullyNotification($this->application, $this->deployment_uuid)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if ($status === ProcessStatus::ERROR->value) {
|
||||||
|
Notification::send(
|
||||||
|
$this->application->environment->project->team,
|
||||||
|
new DeployedWithErrorNotification($this->application, $this->deployment_uuid, $this->preview)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Notifications\Notifications\Application;
|
namespace App\Notifications\Notifications\Application;
|
||||||
|
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
|
use App\Models\ApplicationPreview;
|
||||||
use App\Models\Team;
|
use App\Models\Team;
|
||||||
use App\Notifications\Channels\EmailChannel;
|
use App\Notifications\Channels\EmailChannel;
|
||||||
use App\Notifications\Channels\DiscordChannel;
|
use App\Notifications\Channels\DiscordChannel;
|
||||||
@ -17,7 +18,7 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue
|
|||||||
use Queueable;
|
use Queueable;
|
||||||
public Application $application;
|
public Application $application;
|
||||||
public string $deployment_uuid;
|
public string $deployment_uuid;
|
||||||
public int $pull_request_id;
|
public ApplicationPreview|null $preview = null;
|
||||||
|
|
||||||
public string $application_name;
|
public string $application_name;
|
||||||
public string|null $deployment_url = null;
|
public string|null $deployment_url = null;
|
||||||
@ -25,11 +26,11 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue
|
|||||||
public string $environment_name;
|
public string $environment_name;
|
||||||
public string $fqdn;
|
public string $fqdn;
|
||||||
|
|
||||||
public function __construct(Application $application, string $deployment_uuid, int $pull_request_id = 0)
|
public function __construct(Application $application, string $deployment_uuid, ApplicationPreview|null $preview = null)
|
||||||
{
|
{
|
||||||
$this->application = $application;
|
$this->application = $application;
|
||||||
$this->deployment_uuid = $deployment_uuid;
|
$this->deployment_uuid = $deployment_uuid;
|
||||||
$this->pull_request_id = $pull_request_id;
|
$this->preview = $preview;
|
||||||
|
|
||||||
$this->application_name = data_get($application, 'name');
|
$this->application_name = data_get($application, 'name');
|
||||||
$this->project_uuid = data_get($application, 'environment.project.uuid');
|
$this->project_uuid = data_get($application, 'environment.project.uuid');
|
||||||
@ -59,20 +60,20 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue
|
|||||||
'name' => $this->application_name,
|
'name' => $this->application_name,
|
||||||
'fqdn' => $this->fqdn,
|
'fqdn' => $this->fqdn,
|
||||||
'url' => $this->deployment_url,
|
'url' => $this->deployment_url,
|
||||||
'pull_request_id' => $this->pull_request_id,
|
'pull_request_id' => $this->preview->pull_request_id,
|
||||||
]);
|
]);
|
||||||
return $mail;
|
return $mail;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function toDiscord(): string
|
public function toDiscord(): string
|
||||||
{
|
{
|
||||||
if ($this->pull_request_id !== 0) {
|
if ($this->preview) {
|
||||||
$message = '✅ Pull request #' . $this->pull_request_id . ' of **' . $this->application_name . '**.';
|
$message = '✅ Pull request #' . $this->preview->pull_request_id . ' of **' . $this->application_name . '**. \n\n';
|
||||||
|
$message .= '[Application Link](' . $this->preview->fqdn . ') | [Deployment logs](' . $this->deployment_url . ')';
|
||||||
} else {
|
} else {
|
||||||
$message = '✅ A new version has been deployed of **' . $this->application_name . '**.';
|
$message = '✅ A new version has been deployed of **' . $this->application_name . '**. \n\n ';
|
||||||
|
$message .= '[Application Link](' . $this->fqdn . ') | [Deployment logs](' . $this->deployment_url . ')';
|
||||||
}
|
}
|
||||||
$message .= "\n\n";
|
|
||||||
$message .= '[Application Link](' . $this->fqdn . ') | [Deployment logs](' . $this->deployment_url . ')';
|
|
||||||
return $message;
|
return $message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Notifications\Notifications\Application;
|
namespace App\Notifications\Notifications\Application;
|
||||||
|
|
||||||
use App\Models\Application;
|
use App\Models\Application;
|
||||||
|
use App\Models\ApplicationPreview;
|
||||||
use App\Models\Team;
|
use App\Models\Team;
|
||||||
use App\Notifications\Channels\EmailChannel;
|
use App\Notifications\Channels\EmailChannel;
|
||||||
use App\Notifications\Channels\DiscordChannel;
|
use App\Notifications\Channels\DiscordChannel;
|
||||||
@ -17,7 +18,7 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueue
|
|||||||
use Queueable;
|
use Queueable;
|
||||||
public Application $application;
|
public Application $application;
|
||||||
public string $deployment_uuid;
|
public string $deployment_uuid;
|
||||||
public int $pull_request_id;
|
public ApplicationPreview|null $preview;
|
||||||
|
|
||||||
public string $application_name;
|
public string $application_name;
|
||||||
public string|null $deployment_url = null;
|
public string|null $deployment_url = null;
|
||||||
@ -25,11 +26,11 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueue
|
|||||||
public string $environment_name;
|
public string $environment_name;
|
||||||
public string $fqdn;
|
public string $fqdn;
|
||||||
|
|
||||||
public function __construct(Application $application, string $deployment_uuid, int $pull_request_id = 0)
|
public function __construct(Application $application, string $deployment_uuid, ApplicationPreview|null $preview)
|
||||||
{
|
{
|
||||||
$this->application = $application;
|
$this->application = $application;
|
||||||
$this->deployment_uuid = $deployment_uuid;
|
$this->deployment_uuid = $deployment_uuid;
|
||||||
$this->pull_request_id = $pull_request_id;
|
$this->preview = $preview;
|
||||||
|
|
||||||
$this->application_name = data_get($application, 'name');
|
$this->application_name = data_get($application, 'name');
|
||||||
$this->project_uuid = data_get($application, 'environment.project.uuid');
|
$this->project_uuid = data_get($application, 'environment.project.uuid');
|
||||||
@ -59,7 +60,7 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueue
|
|||||||
'name' => $this->application_name,
|
'name' => $this->application_name,
|
||||||
'fqdn' => $this->fqdn,
|
'fqdn' => $this->fqdn,
|
||||||
'url' => $this->deployment_url,
|
'url' => $this->deployment_url,
|
||||||
'pull_request_id' => $this->pull_request_id,
|
'pull_request_id' => $this->preview->pull_request_id,
|
||||||
]);
|
]);
|
||||||
return $mail;
|
return $mail;
|
||||||
}
|
}
|
||||||
@ -67,8 +68,8 @@ class DeployedWithErrorNotification extends Notification implements ShouldQueue
|
|||||||
public function toDiscord(): string
|
public function toDiscord(): string
|
||||||
{
|
{
|
||||||
$message = '❌ Deployment failed of **' . $this->application_name;
|
$message = '❌ Deployment failed of **' . $this->application_name;
|
||||||
if ($this->pull_request_id !== 0) {
|
if ($this->preview) {
|
||||||
$message .= ": PR# {$this->pull_request_id}";
|
$message .= ": PR# {$this->preview->pull_request_id}";
|
||||||
}
|
}
|
||||||
$message .= '**.';
|
$message .= '**.';
|
||||||
$message .= "\n\n";
|
$message .= "\n\n";
|
||||||
|
@ -44,9 +44,15 @@ function getRouteParameters()
|
|||||||
|
|
||||||
function get_latest_version_of_coolify()
|
function get_latest_version_of_coolify()
|
||||||
{
|
{
|
||||||
$response = Http::get('https://cdn.coollabs.io/coolify/versions.json');
|
try {
|
||||||
$versions = $response->json();
|
$response = Http::get('https://cdn.coollabs.io/coolify/versions.json');
|
||||||
return data_get($versions, 'coolify.v4.version');
|
$versions = $response->json();
|
||||||
|
return data_get($versions, 'coolify.v4.version');
|
||||||
|
} catch (\Throwable $th) {
|
||||||
|
//throw $th;
|
||||||
|
ray($th->getMessage());
|
||||||
|
return '0.0.0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function generate_random_name()
|
function generate_random_name()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user