Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Update preview application deployment labels and version

Andras Bacsai60cf296f31cd
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index de32ad1fbc..15359f4544 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -119,11 +119,16 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
if ($this->pull_request_id !== 0) {
$this->preview = ApplicationPreview::findPreviewByApplicationAndPullId($this->application->id, $this->pull_request_id);
if ($this->application->fqdn) {
- if (data_get($this->preview, 'fqdn')) {
- $preview_fqdn = getFqdnWithoutPort(data_get($this->preview, 'fqdn'));
+ if (str($this->application->fqdn)->contains(',')) {
+ $url = Url::fromString(str($this->application->fqdn)->explode(',')[0]);
+ $preview_fqdn = getFqdnWithoutPort(str($this->application->fqdn)->explode(',')[0]);
+ } else {
+ $url = Url::fromString($this->application->fqdn);
+ if (data_get($this->preview, 'fqdn')) {
+ $preview_fqdn = getFqdnWithoutPort(data_get($this->preview, 'fqdn'));
+ }
}
$template = $this->application->preview_url_template;
- $url = Url::fromString($this->application->fqdn);
$host = $url->getHost();
$schema = $url->getScheme();
$random = new Cuid2(7);
@@ -770,21 +775,22 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
$labels = collect(generateLabelsApplication($this->application, $this->preview));
}
if ($this->pull_request_id !== 0) {
- $newLabels = collect(generateLabelsApplication($this->application, $this->preview));
- $newHostLabel = $newLabels->filter(function ($label) {
- return str($label)->contains('Host');
- });
- $labels = $labels->reject(function ($label) {
- return str($label)->contains('Host');
- });
+ $labels = collect(generateLabelsApplication($this->application, $this->preview));
- $labels = $labels->map(function ($label) {
- $pattern = '/([a-zA-Z0-9]+)-(\d+)-(http|https)/';
- $replacement = "$1-pr-{$this->pull_request_id}-$2-$3";
- $newLabel = preg_replace($pattern, $replacement, $label);
- return $newLabel;
- });
- $labels = $labels->merge($newHostLabel);
+ // $newHostLabel = $newLabels->filter(function ($label) {
+ // return str($label)->contains('Host');
+ // });
+ // $labels = $labels->reject(function ($label) {
+ // return str($label)->contains('Host');
+ // });
+ // ray($labels,$newLabels);
+ // $labels = $labels->map(function ($label) {
+ // $pattern = '/([a-zA-Z0-9]+)-(\d+)-(http|https)/';
+ // $replacement = "$1-pr-{$this->pull_request_id}-$2-$3";
+ // $newLabel = preg_replace($pattern, $replacement, $label);
+ // return $newLabel;
+ // });
+ // $labels = $labels->merge($newHostLabel);
}
$labels = $labels->merge(defaultLabels($this->application->id, $this->application->uuid, $this->pull_request_id))->toArray();
$docker_compose = [
diff --git a/config/sentry.php b/config/sentry.php
index d52a8a9b43..0416aba031 100644
--- a/config/sentry.php
+++ b/config/sentry.php
@@ -7,7 +7,7 @@ return [
// 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.124',
+ 'release' => '4.0.0-beta.125',
// 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 352ef7c4b3..57e0d48f4d 100644
--- a/config/version.php
+++ b/config/version.php
@@ -1,3 +1,3 @@
<?php
-return '4.0.0-beta.124';
+return '4.0.0-beta.125';
diff --git a/resources/views/livewire/project/application/previews.blade.php b/resources/views/livewire/project/application/previews.blade.php
index 8f78ea517e..b02acc4ab7 100644
--- a/resources/views/livewire/project/application/previews.blade.php
+++ b/resources/views/livewire/project/application/previews.blade.php
@@ -48,7 +48,7 @@
@endif
</div>
@if ($application->previews->count() > 0)
- <h4 class="py-4">Deployed Previews</h4>
+ <div class="pb-4">Previews</div>
<div class="flex gap-6 ">
@foreach ($application->previews as $preview)
<div class="flex flex-col p-4 bg-coolgray-200">
@@ -71,19 +71,19 @@
</a>
</div>
<div class="flex items-center gap-2 pt-6">
- <x-forms.button wire:click="deploy({{ data_get($preview, 'pull_request_id') }})">
+ <x-forms.button class="bg-coolgray-500" wire:click="deploy({{ data_get($preview, 'pull_request_id') }})">
@if (data_get($preview, 'status') === 'exited')
Deploy
@else
Redeploy
@endif
</x-forms.button>
- <x-forms.button wire:click="stop({{ data_get($preview, 'pull_request_id') }})">Remove
+ <x-forms.button class="bg-coolgray-500" wire:click="stop({{ data_get($preview, 'pull_request_id') }})">Remove
Preview
</x-forms.button>
<a
href="{{ route('project.application.deployments', [...$parameters, 'pull_request_id' => data_get($preview, 'pull_request_id')]) }}">
- <x-forms.button>
+ <x-forms.button class="bg-coolgray-500">
Get Deployment Logs
</x-forms.button>
</a>