few fixes
This commit is contained in:
@@ -43,7 +43,7 @@ class ApplicationDeploymentJob implements ShouldQueue
|
|||||||
private string $build_image_name;
|
private string $build_image_name;
|
||||||
private string $production_image_name;
|
private string $production_image_name;
|
||||||
private string $container_name;
|
private string $container_name;
|
||||||
private ApplicationPreview|null $preview;
|
private ApplicationPreview|null $preview = null;
|
||||||
|
|
||||||
public static int $batch_counter = 0;
|
public static int $batch_counter = 0;
|
||||||
public $timeout = 10200;
|
public $timeout = 10200;
|
||||||
@@ -66,8 +66,10 @@ class ApplicationDeploymentJob implements ShouldQueue
|
|||||||
|
|
||||||
$this->application = Application::find($this->application_id);
|
$this->application = Application::find($this->application_id);
|
||||||
|
|
||||||
|
ray('pullrequestId: ' . $this->pull_request_id);
|
||||||
if ($this->pull_request_id !== 0) {
|
if ($this->pull_request_id !== 0) {
|
||||||
$this->preview = ApplicationPreview::findPreviewByApplicationAndPullId($this->application->id, $this->pull_request_id);
|
$this->preview = ApplicationPreview::findPreviewByApplicationAndPullId($this->application->id, $this->pull_request_id);
|
||||||
|
ray($this->preview);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
|
$this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
|
||||||
@@ -319,16 +321,10 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
|
|||||||
}
|
}
|
||||||
queue_next_deployment($this->application);
|
queue_next_deployment($this->application);
|
||||||
if ($status === ProcessStatus::FINISHED->value) {
|
if ($status === ProcessStatus::FINISHED->value) {
|
||||||
Notification::send(
|
$this->application->environment->project->team->notify(new DeployedSuccessfullyNotification($this->application, $this->deployment_uuid, $this->preview));
|
||||||
$this->application->environment->project->team,
|
|
||||||
new DeployedSuccessfullyNotification($this->application, $this->deployment_uuid)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if ($status === ProcessStatus::ERROR->value) {
|
if ($status === ProcessStatus::ERROR->value) {
|
||||||
Notification::send(
|
$this->application->environment->project->team->notify(new DeployedWithErrorNotification($this->application, $this->deployment_uuid, $this->preview));
|
||||||
$this->application->environment->project->team,
|
|
||||||
new DeployedWithErrorNotification($this->application, $this->deployment_uuid, $this->preview)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private function execute_in_builder(string $command)
|
private function execute_in_builder(string $command)
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue
|
|||||||
$this->application = $application;
|
$this->application = $application;
|
||||||
$this->deployment_uuid = $deployment_uuid;
|
$this->deployment_uuid = $deployment_uuid;
|
||||||
$this->preview = $preview;
|
$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');
|
||||||
$this->environment_name = data_get($application, 'environment.name');
|
$this->environment_name = data_get($application, 'environment.name');
|
||||||
@@ -55,12 +54,17 @@ class DeployedSuccessfullyNotification extends Notification implements ShouldQue
|
|||||||
public function toMail(Team $team): MailMessage
|
public function toMail(Team $team): MailMessage
|
||||||
{
|
{
|
||||||
$mail = new MailMessage();
|
$mail = new MailMessage();
|
||||||
$mail->subject("✅ New version is deployed of {$this->application_name}");
|
$pull_request_id = data_get($this->preview, 'pull_request_id', 0);
|
||||||
|
if ($pull_request_id === 0) {
|
||||||
|
$mail->subject("✅ New version is deployed of {$this->application_name}");
|
||||||
|
} else {
|
||||||
|
$mail->subject("✅ Pull request #{$pull_request_id} of {$this->application_name} deployed successfully");
|
||||||
|
}
|
||||||
$mail->view('emails.application-deployed-successfully', [
|
$mail->view('emails.application-deployed-successfully', [
|
||||||
'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->preview->pull_request_id,
|
'pull_request_id' => $pull_request_id,
|
||||||
]);
|
]);
|
||||||
return $mail;
|
return $mail;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,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->preview->pull_request_id,
|
'pull_request_id' => data_get($this->preview, 'pull_request_id', 0),
|
||||||
]);
|
]);
|
||||||
return $mail;
|
return $mail;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
Hello,<br><br>
|
@if ($pull_request_id === 0)
|
||||||
|
A new version of <a target="_blank" href="{{ $fqdn }}">{{ $fqdn }}</a> is available.<br><br>
|
||||||
A new version of your application "{{ $name }}"@if ($pull_request_id !== 0)
|
@else
|
||||||
:PR#{{ $pull_request_id }}
|
Pull request #{{ $pull_request_id }} is available for review at <a target="_blank"
|
||||||
@endif has been deployed to <a target="_blank"
|
href="{{ $fqdn }}">{{ $fqdn }}</a><br><br>
|
||||||
href="{{ $fqdn }}">{{ $fqdn }}</a><br><br>
|
@endif
|
||||||
|
<a target="_blank" href="{{ $url }}">View
|
||||||
Click the following link to view the deployment logs: <a target="_blank" href="{{ $url }}">View
|
Deployment Logs</a><br><br>
|
||||||
Deployment</a><br><br>
|
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
Hello,<br><br>
|
Hello,<br><br>
|
||||||
|
|
||||||
Deployment failed of "{{ $name }}"@if ($pull_request_id !== 0)
|
Deployment failed of "{{ $name }}"
|
||||||
:PR#{{ $pull_request_id }}
|
|
||||||
@endif to <a target="_blank" href="{{ $fqdn }}">{{ $fqdn }}</a><br><br>
|
@if ($pull_request_id !== 0)
|
||||||
|
:PR #{{ $pull_request_id }}
|
||||||
|
@endif
|
||||||
|
|
||||||
|
to <a target="_blank" href="{{ $fqdn }}">{{ $fqdn }}</a>.<br><br>
|
||||||
|
|
||||||
Click the following link to view the deployment logs: <a target="_blank" href="{{ $url }}">View
|
Click the following link to view the deployment logs: <a target="_blank" href="{{ $url }}">View
|
||||||
Deployment</a><br><br>
|
Deployment Logs</a><br><br>
|
||||||
|
|||||||
Reference in New Issue
Block a user