fix: compose generator
This commit is contained in:
@@ -130,6 +130,16 @@ class Bitbucket extends Controller
|
|||||||
$deployment_uuid = new Cuid2(7);
|
$deployment_uuid = new Cuid2(7);
|
||||||
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||||
if (!$found) {
|
if (!$found) {
|
||||||
|
if ($application->build_pack === 'dockercompose') {
|
||||||
|
$pr_app = ApplicationPreview::create([
|
||||||
|
'git_type' => 'bitbucket',
|
||||||
|
'application_id' => $application->id,
|
||||||
|
'pull_request_id' => $pull_request_id,
|
||||||
|
'pull_request_html_url' => $pull_request_html_url,
|
||||||
|
'docker_compose_domains' => $application->docker_compose_domains,
|
||||||
|
]);
|
||||||
|
$pr_app->generate_preview_fqdn_compose();
|
||||||
|
} else {
|
||||||
ApplicationPreview::create([
|
ApplicationPreview::create([
|
||||||
'git_type' => 'bitbucket',
|
'git_type' => 'bitbucket',
|
||||||
'application_id' => $application->id,
|
'application_id' => $application->id,
|
||||||
@@ -137,6 +147,7 @@ class Bitbucket extends Controller
|
|||||||
'pull_request_html_url' => $pull_request_html_url,
|
'pull_request_html_url' => $pull_request_html_url,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
queue_application_deployment(
|
queue_application_deployment(
|
||||||
application: $application,
|
application: $application,
|
||||||
pull_request_id: $pull_request_id,
|
pull_request_id: $pull_request_id,
|
||||||
|
|||||||
@@ -165,6 +165,16 @@ class Gitea extends Controller
|
|||||||
$deployment_uuid = new Cuid2(7);
|
$deployment_uuid = new Cuid2(7);
|
||||||
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||||
if (! $found) {
|
if (! $found) {
|
||||||
|
if ($application->build_pack === 'dockercompose') {
|
||||||
|
$pr_app = ApplicationPreview::create([
|
||||||
|
'git_type' => 'gitea',
|
||||||
|
'application_id' => $application->id,
|
||||||
|
'pull_request_id' => $pull_request_id,
|
||||||
|
'pull_request_html_url' => $pull_request_html_url,
|
||||||
|
'docker_compose_domains' => $application->docker_compose_domains,
|
||||||
|
]);
|
||||||
|
$pr_app->generate_preview_fqdn_compose();
|
||||||
|
} else {
|
||||||
ApplicationPreview::create([
|
ApplicationPreview::create([
|
||||||
'git_type' => 'gitea',
|
'git_type' => 'gitea',
|
||||||
'application_id' => $application->id,
|
'application_id' => $application->id,
|
||||||
@@ -172,6 +182,8 @@ class Gitea extends Controller
|
|||||||
'pull_request_html_url' => $pull_request_html_url,
|
'pull_request_html_url' => $pull_request_html_url,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
queue_application_deployment(
|
queue_application_deployment(
|
||||||
application: $application,
|
application: $application,
|
||||||
pull_request_id: $pull_request_id,
|
pull_request_id: $pull_request_id,
|
||||||
|
|||||||
@@ -170,6 +170,16 @@ class Github extends Controller
|
|||||||
$deployment_uuid = new Cuid2(7);
|
$deployment_uuid = new Cuid2(7);
|
||||||
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||||
if (!$found) {
|
if (!$found) {
|
||||||
|
if ($application->build_pack === 'dockercompose') {
|
||||||
|
$pr_app = ApplicationPreview::create([
|
||||||
|
'git_type' => 'github',
|
||||||
|
'application_id' => $application->id,
|
||||||
|
'pull_request_id' => $pull_request_id,
|
||||||
|
'pull_request_html_url' => $pull_request_html_url,
|
||||||
|
'docker_compose_domains' => $application->docker_compose_domains,
|
||||||
|
]);
|
||||||
|
$pr_app->generate_preview_fqdn_compose();
|
||||||
|
} else {
|
||||||
ApplicationPreview::create([
|
ApplicationPreview::create([
|
||||||
'git_type' => 'github',
|
'git_type' => 'github',
|
||||||
'application_id' => $application->id,
|
'application_id' => $application->id,
|
||||||
@@ -177,6 +187,7 @@ class Github extends Controller
|
|||||||
'pull_request_html_url' => $pull_request_html_url,
|
'pull_request_html_url' => $pull_request_html_url,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
queue_application_deployment(
|
queue_application_deployment(
|
||||||
application: $application,
|
application: $application,
|
||||||
pull_request_id: $pull_request_id,
|
pull_request_id: $pull_request_id,
|
||||||
|
|||||||
@@ -180,6 +180,16 @@ class Gitlab extends Controller
|
|||||||
$deployment_uuid = new Cuid2(7);
|
$deployment_uuid = new Cuid2(7);
|
||||||
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
$found = ApplicationPreview::where('application_id', $application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||||
if (!$found) {
|
if (!$found) {
|
||||||
|
if ($application->build_pack === 'dockercompose') {
|
||||||
|
$pr_app = ApplicationPreview::create([
|
||||||
|
'git_type' => 'gitlab',
|
||||||
|
'application_id' => $application->id,
|
||||||
|
'pull_request_id' => $pull_request_id,
|
||||||
|
'pull_request_html_url' => $pull_request_html_url,
|
||||||
|
'docker_compose_domains' => $application->docker_compose_domains,
|
||||||
|
]);
|
||||||
|
$pr_app->generate_preview_fqdn_compose();
|
||||||
|
} else {
|
||||||
ApplicationPreview::create([
|
ApplicationPreview::create([
|
||||||
'git_type' => 'gitlab',
|
'git_type' => 'gitlab',
|
||||||
'application_id' => $application->id,
|
'application_id' => $application->id,
|
||||||
@@ -187,6 +197,7 @@ class Gitlab extends Controller
|
|||||||
'pull_request_html_url' => $pull_request_html_url,
|
'pull_request_html_url' => $pull_request_html_url,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
queue_application_deployment(
|
queue_application_deployment(
|
||||||
application: $application,
|
application: $application,
|
||||||
pull_request_id: $pull_request_id,
|
pull_request_id: $pull_request_id,
|
||||||
|
|||||||
@@ -131,6 +131,10 @@ class Previews extends Component
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function add_and_deploy(int $pull_request_id, ?string $pull_request_html_url = null) {
|
||||||
|
$this->add($pull_request_id, $pull_request_html_url);
|
||||||
|
$this->deploy($pull_request_id, $pull_request_html_url);
|
||||||
|
}
|
||||||
public function deploy(int $pull_request_id, ?string $pull_request_html_url = null)
|
public function deploy(int $pull_request_id, ?string $pull_request_html_url = null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@
|
|||||||
Configure
|
Configure
|
||||||
</x-forms.button>
|
</x-forms.button>
|
||||||
<x-forms.button
|
<x-forms.button
|
||||||
wire:click="deploy('{{ data_get($pull_request, 'number') }}', '{{ data_get($pull_request, 'html_url') }}')">
|
wire:click="add_and_deploy('{{ data_get($pull_request, 'number') }}', '{{ data_get($pull_request, 'html_url') }}')">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning"
|
<svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning"
|
||||||
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"
|
||||||
fill="none" stroke-linecap="round" stroke-linejoin="round">
|
fill="none" stroke-linecap="round" stroke-linejoin="round">
|
||||||
|
|||||||
Reference in New Issue
Block a user