Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/Models/ApplicationDeploymentQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
'only_this_server' => ['type' => 'boolean'],
'rollback' => ['type' => 'boolean'],
'commit_message' => ['type' => 'string'],
'commit_author' => ['type' => 'string'],
],
)]
class ApplicationDeploymentQueue extends Model
Expand Down
30 changes: 30 additions & 0 deletions app/Notifications/Application/DeploymentFailed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Notifications\Application;

use App\Models\Application;
use App\Models\ApplicationDeploymentQueue;
use App\Models\ApplicationPreview;
use App\Notifications\CustomEmailNotification;
use App\Notifications\Dto\DiscordMessage;
Expand Down Expand Up @@ -63,11 +64,14 @@ public function toMail(): MailMessage
$fqdn = $this->preview->fqdn;
$mail->subject('Coolify: Deployment failed of pull request #'.$this->preview->pull_request_id.' of '.$this->application_name.'.');
}
$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $this->deployment_uuid)->first();

$mail->view('emails.application-deployment-failed', [
'name' => $this->application_name,
'fqdn' => $fqdn,
'deployment_url' => $this->deployment_url,
'pull_request_id' => data_get($this->preview, 'pull_request_id', 0),
'commit_author' => $deployment?->commit_author,
]);

return $mail;
Expand Down Expand Up @@ -111,6 +115,11 @@ public function toDiscord(): DiscordMessage
$message->addField('Deployment Logs', '[Link]('.$this->deployment_url.')');
}

$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $this->deployment_uuid)->first();
if ($deployment && $deployment->commit_author) {
$message->addField('Commit Author', $deployment->commit_author, true);
}

return $message;
}

Expand All @@ -121,6 +130,12 @@ public function toTelegram(): array
} else {
$message = 'Coolify: Deployment failed of '.$this->application_name.' ('.$this->fqdn.'): ';
}

$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $this->deployment_uuid)->first();
if ($deployment && $deployment->commit_author) {
$message .= "\nCommit Author: {$deployment->commit_author}";
}

$buttons[] = [
'text' => 'Deployment logs',
'url' => $this->deployment_url,
Expand All @@ -144,6 +159,11 @@ public function toPushover(): PushoverMessage
$message = "Deployment failed for {$this->application_name}";
}

$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $this->deployment_uuid)->first();
if ($deployment && $deployment->commit_author) {
$message .= "\nCommit Author: {$deployment->commit_author}";
}

$buttons[] = [
'text' => 'Deployment logs',
'url' => $this->deployment_url,
Expand Down Expand Up @@ -175,6 +195,11 @@ public function toSlack(): SlackMessage
}
}

$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $this->deployment_uuid)->first();
if ($deployment && $deployment->commit_author) {
$description .= "\n*Commit Author:* {$deployment->commit_author}";
}

$description .= "\n\n*Project:* ".data_get($this->application, 'environment.project.name');
$description .= "\n*Environment:* {$this->environment_name}";
$description .= "\n*<{$this->deployment_url}|Deployment Logs>*";
Expand Down Expand Up @@ -209,6 +234,11 @@ public function toWebhook(): array
$data['fqdn'] = $this->fqdn;
}

$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $this->deployment_uuid)->first();
if ($deployment && $deployment->commit_author) {
$data['commit_author'] = $deployment->commit_author;
}

return $data;
}
}
30 changes: 30 additions & 0 deletions app/Notifications/Application/DeploymentSuccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Notifications\Application;

use App\Models\Application;
use App\Models\ApplicationDeploymentQueue;
use App\Models\ApplicationPreview;
use App\Notifications\CustomEmailNotification;
use App\Notifications\Dto\DiscordMessage;
Expand Down Expand Up @@ -63,11 +64,14 @@ public function toMail(): MailMessage
$fqdn = $this->preview->fqdn;
$mail->subject("Coolify: Pull request #{$pull_request_id} of {$this->application_name} deployed successfully");
}
$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $this->deployment_uuid)->first();

$mail->view('emails.application-deployment-success', [
'name' => $this->application_name,
'fqdn' => $fqdn,
'deployment_url' => $this->deployment_url,
'pull_request_id' => $pull_request_id,
'commit_author' => $deployment?->commit_author,
]);

return $mail;
Expand Down Expand Up @@ -108,6 +112,11 @@ public function toDiscord(): DiscordMessage
$message->addField('Deployment logs', '[Link]('.$this->deployment_url.')');
}

$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $this->deployment_uuid)->first();
if ($deployment && $deployment->commit_author) {
$message->addField('Commit Author', $deployment->commit_author, true);
}

return $message;
}

Expand All @@ -130,6 +139,12 @@ public function toTelegram(): array
];
}
}

$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $this->deployment_uuid)->first();
if ($deployment && $deployment->commit_author) {
$message .= "\nCommit Author: {$deployment->commit_author}";
}

$buttons[] = [
'text' => 'Deployment logs',
'url' => $this->deployment_url,
Expand Down Expand Up @@ -164,6 +179,12 @@ public function toPushover(): PushoverMessage
];
}
}

$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $this->deployment_uuid)->first();
if ($deployment && $deployment->commit_author) {
$message .= "\nCommit Author: {$deployment->commit_author}";
}

$buttons[] = [
'text' => 'Deployment logs',
'url' => $this->deployment_url,
Expand Down Expand Up @@ -194,6 +215,10 @@ public function toSlack(): SlackMessage
$description .= "\nApplication URL: {$this->fqdn}";
}
}
$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $this->deployment_uuid)->first();
if ($deployment && $deployment->commit_author) {
$description .= "\n*Commit Author:* {$deployment->commit_author}";
}

$description .= "\n\n*Project:* ".data_get($this->application, 'environment.project.name');
$description .= "\n*Environment:* {$this->environment_name}";
Expand Down Expand Up @@ -229,6 +254,11 @@ public function toWebhook(): array
$data['fqdn'] = $this->fqdn;
}

$deployment = ApplicationDeploymentQueue::where('deployment_uuid', $this->deployment_uuid)->first();
if ($deployment && $deployment->commit_author) {
$data['commit_author'] = $deployment->commit_author;
}

return $data;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration {
public function up(): void
{
Schema::table('application_deployment_queues', function (Blueprint $table) {
$table->string('commit_author')->nullable()->after('commit_message');
});
}

public function down(): void
{
Schema::table('application_deployment_queues', function (Blueprint $table) {
$table->dropColumn('commit_author');
});
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@
[{{ $fqdn }}]({{ $fqdn }}).
@endif

@if (isset($commit_author))
Commit Author: {{ $commit_author }}
@endif

[View Deployment Logs]({{ $deployment_url }})
</x-emails.layout>
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
[{{ $fqdn }}]({{ $fqdn }}).
@endif

@if (isset($commit_author))
Commit Author: {{ $commit_author }}
@endif

[View Deployment Logs]({{ $deployment_url }})

</x-emails.layout>