fixes
This commit is contained in:
parent
25870dadd8
commit
8991de2610
@ -9,6 +9,7 @@ class Deployments extends Component
|
||||
{
|
||||
public int $application_id;
|
||||
public $deployments = [];
|
||||
public int $deployments_count = 0;
|
||||
public string $current_url;
|
||||
public int $skip = 0;
|
||||
public int $default_take = 8;
|
||||
@ -24,15 +25,14 @@ class Deployments extends Component
|
||||
}
|
||||
public function load_deployments(int|null $take = null)
|
||||
{
|
||||
ray('Take' . $take);
|
||||
if ($take) {
|
||||
ray('Take is not null');
|
||||
$this->skip = $this->skip + $take;
|
||||
}
|
||||
|
||||
$take = $this->default_take;
|
||||
$this->deployments = Application::find($this->application_id)->deployments($this->skip, $take);
|
||||
|
||||
['deployments' => $deployments, 'count' => $count] = Application::find($this->application_id)->deployments($this->skip, $take);
|
||||
$this->deployments = $deployments;
|
||||
$this->deployments_count = $count;
|
||||
if (count($this->deployments) !== 0 && count($this->deployments) < $take) {
|
||||
$this->show_next = false;
|
||||
return;
|
||||
|
@ -37,7 +37,6 @@ class Form extends Component
|
||||
{
|
||||
$this->validate();
|
||||
$this->application->preview_url_template = str_replace(' ', '', $this->application->preview_url_template);
|
||||
ray($this->application->preview_url_template);
|
||||
$this->application->save();
|
||||
$this->generate_real_url();
|
||||
}
|
||||
|
@ -41,12 +41,12 @@ class Previews extends Component
|
||||
$this->rate_limit_remaining = $rate_limit_remaining;
|
||||
$this->pull_requests = $data->sortBy('number')->values();
|
||||
}
|
||||
public function deploy(int $pull_request_id, string|null $pull_request_html_url)
|
||||
public function deploy(int $pull_request_id, string|null $pull_request_html_url = null)
|
||||
{
|
||||
try {
|
||||
$this->set_deployment_uuid();
|
||||
$found = ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||
if (!$found) {
|
||||
if (!$found && !is_null($pull_request_html_url)) {
|
||||
ApplicationPreview::create([
|
||||
'application_id' => $this->application->id,
|
||||
'pull_request_id' => $pull_request_id,
|
||||
|
@ -269,7 +269,6 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
|
||||
|
||||
private function next(string $status)
|
||||
{
|
||||
ray($this->application_deployment_queue->status, Str::of($this->application_deployment_queue->status)->startsWith('cancelled'));
|
||||
if (!Str::of($this->application_deployment_queue->status)->startsWith('cancelled')) {
|
||||
$this->application_deployment_queue->update([
|
||||
'status' => $status,
|
||||
@ -522,7 +521,7 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
|
||||
} else {
|
||||
$commandText = collect($command)->implode("\n");
|
||||
}
|
||||
ray('Executing command', $commandText);
|
||||
ray('Executing command: ' . $commandText);
|
||||
$this->activity->properties = $this->activity->properties->merge([
|
||||
'command' => $commandText,
|
||||
]);
|
||||
@ -623,7 +622,6 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
|
||||
$nixpacks_command .= " --install-cmd \"{$this->application->install_command}\"";
|
||||
}
|
||||
$nixpacks_command .= " {$this->workdir}";
|
||||
ray('Build command: ' . $nixpacks_command);
|
||||
return $this->execute_in_builder($nixpacks_command);
|
||||
}
|
||||
private function stop_running_container()
|
||||
|
@ -34,9 +34,8 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeUnique
|
||||
public function handle(): void
|
||||
{
|
||||
try {
|
||||
ray('running ContainerStatusJob', $this->container_name, $this->pull_request_id);
|
||||
$status = get_container_status(server: $this->application->destination->server, container_id: $this->container_name, throwError: false);
|
||||
ray('ContainerStatusJob', $status);
|
||||
ray('Container ' . $this->container_name . ' statuus is ' . $status);
|
||||
if ($this->pull_request_id) {
|
||||
$preview = ApplicationPreview::findPreviewByApplicationAndPullId($this->application->id, $this->pull_request_id);
|
||||
$preview->status = $status;
|
||||
|
@ -146,8 +146,13 @@ class Application extends BaseModel
|
||||
|
||||
public function deployments(int $skip = 0, int $take = 10)
|
||||
{
|
||||
ray('Skip ' . $skip . ' Take ' . $take);
|
||||
return ApplicationDeploymentQueue::where('application_id', $this->id)->orderBy('created_at', 'desc')->skip($skip)->take($take)->get();
|
||||
$deployments = ApplicationDeploymentQueue::where('application_id', $this->id)->orderBy('created_at', 'desc');
|
||||
$count = $deployments->count();
|
||||
$deployments = $deployments->skip($skip)->take($take)->get();
|
||||
return [
|
||||
'count' => $count,
|
||||
'deployments' => $deployments
|
||||
];
|
||||
}
|
||||
public function get_deployment(string $deployment_uuid)
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ function queue_application_deployment(int $application_id, string $deployment_uu
|
||||
]);
|
||||
$queued_deployments = ApplicationDeploymentQueue::where('application_id', $application_id)->where('status', 'queued')->get()->sortByDesc('created_at');
|
||||
$running_deployments = ApplicationDeploymentQueue::where('application_id', $application_id)->where('status', 'in_progress')->get()->sortByDesc('created_at');
|
||||
ray('Q:' . $queued_deployments->count() . 'R:' . $running_deployments->count() . '|Queuing deployment: ' . $deployment_uuid . ' of applicationID: ' . $application_id . ' pull request: ' . $pull_request_id . ' with commit: ' . $commit . ' and is it forced: ' . $force_rebuild);
|
||||
ray('Q:' . $queued_deployments->count() . 'R:' . $running_deployments->count() . '| Queuing deployment: ' . $deployment_uuid . ' of applicationID: ' . $application_id . ' pull request: ' . $pull_request_id . ' with commit: ' . $commit . ' and is it forced: ' . $force_rebuild);
|
||||
if ($queued_deployments->count() > 1) {
|
||||
$queued_deployments = $queued_deployments->skip(1);
|
||||
$queued_deployments->each(function ($queued_deployment, $key) {
|
||||
|
@ -3,13 +3,13 @@
|
||||
<div>
|
||||
<h3>Actions</h3>
|
||||
@if ($show_next)
|
||||
<x-forms.button isHighlighted wire:click="load_deployments({{ $default_take }})">Load More
|
||||
<x-forms.button isHighlighted wire:click="load_deployments({{ $default_take }})">Load Previous
|
||||
Deployments</x-forms.button>
|
||||
@else
|
||||
<x-forms.button disabled>No More Deployments</x-forms.button>
|
||||
@endif
|
||||
</div>
|
||||
<h3>Deployments</h3>
|
||||
<h3>Deployments <span class="text-xs">({{ $deployments_count }})</span></h3>
|
||||
@foreach ($deployments as $deployment)
|
||||
<a @class([
|
||||
'bg-coolgray-200 p-2 border-l border-dashed transition-colors hover:no-underline',
|
||||
@ -28,7 +28,8 @@
|
||||
class="hover:no-underline">
|
||||
<div class="flex flex-col justify-start">
|
||||
<div>
|
||||
{{ $deployment->deployment_uuid }} <span class="text-sm text-warning">></span>
|
||||
{{ $deployment->id }} <span class="text-sm text-warning">></span> {{ $deployment->deployment_uuid }} <span
|
||||
class="text-sm text-warning">></span>
|
||||
{{ $deployment->status }}
|
||||
</div>
|
||||
@if (data_get($deployment, 'pull_request_id'))
|
||||
@ -47,7 +48,6 @@
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="flex flex-col" x-data="elapsedTime('{{ $deployment->deployment_uuid }}', '{{ $deployment->status }}', '{{ $deployment->created_at }}', '{{ $deployment->updated_at }}')">
|
||||
<div>Finished <span x-text="measure_since_started()">0s</span> in <span class="font-bold"
|
||||
x-text="measure_finished_time()">0s</span></div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user