From 60cf296f31cdcbc15c7b456bb92e1f32f69918f4 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 13 Nov 2023 13:20:12 +0100 Subject: [PATCH 1/2] Update preview application deployment labels and version --- app/Jobs/ApplicationDeploymentJob.php | 40 +++++++++++-------- config/sentry.php | 2 +- config/version.php | 2 +- .../project/application/previews.blade.php | 8 ++-- 4 files changed, 29 insertions(+), 23 deletions(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index de32ad1fb..15359f454 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -119,11 +119,16 @@ public function __construct(int $application_deployment_queue_id) 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 @@ private function generate_compose_file() $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 d52a8a9b4..0416aba03 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ // 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 352ef7c4b..57e0d48f4 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ @if ($application->previews->count() > 0) -

Deployed Previews

+
Previews
@foreach ($application->previews as $preview)
@@ -71,19 +71,19 @@
- + @if (data_get($preview, 'status') === 'exited') Deploy @else Redeploy @endif - Remove + Remove Preview - + Get Deployment Logs From f27e00e80e628f97499c3b1472ec687cf25b3e48 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 13 Nov 2023 13:20:28 +0100 Subject: [PATCH 2/2] Update version.json to include v4.0.0-beta.125 --- versions.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/versions.json b/versions.json index 4b4b2f731..e596f13d3 100644 --- a/versions.json +++ b/versions.json @@ -4,7 +4,7 @@ "version": "3.12.36" }, "v4": { - "version": "4.0.0-beta.124" + "version": "4.0.0-beta.125" } } }