fix: deployment key based works

This commit is contained in:
Andras Bacsai
2023-07-05 22:10:10 +02:00
parent 1342634907
commit 4f98cef7cb
4 changed files with 9 additions and 5 deletions

View File

@@ -566,7 +566,7 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
if ($this->pull_request_id !== 0) { if ($this->pull_request_id !== 0) {
$pr_branch_name = "pr-{$this->pull_request_id}-coolify"; $pr_branch_name = "pr-{$this->pull_request_id}-coolify";
} }
if ($this->application->deploymentType() === 'source') { if ($this->application->deploymentType() === 'source') {
$source_html_url = data_get($this->application, 'source.html_url'); $source_html_url = data_get($this->application, 'source.html_url');
$url = parse_url(filter_var($source_html_url, FILTER_SANITIZE_URL)); $url = parse_url(filter_var($source_html_url, FILTER_SANITIZE_URL));
@@ -619,4 +619,4 @@ COPY --from=$this->build_image_name /app/{$this->application->publish_directory}
); );
$this->commit = $this->saved_outputs->get('git_commit_sha'); $this->commit = $this->saved_outputs->get('git_commit_sha');
} }
} }

View File

@@ -195,6 +195,9 @@ class Application extends BaseModel
} }
public function deploymentType() public function deploymentType()
{ {
if (data_get($this, 'private_key_id')) {
return 'deploy_key';
}
if (data_get($this, 'source')) { if (data_get($this, 'source')) {
return 'source'; return 'source';
} }
@@ -203,4 +206,4 @@ class Application extends BaseModel
} }
throw new \Exception('No deployment type found'); throw new \Exception('No deployment type found');
} }
} }

View File

@@ -38,4 +38,4 @@ class ServerSeeder extends Seeder
'private_key_id' => $private_key_1->id 'private_key_id' => $private_key_1->id
]); ]);
} }
} }

View File

@@ -14,6 +14,7 @@ class ServerSettingSeeder extends Seeder
public function run(): void public function run(): void
{ {
$server_2 = Server::find(0)->load(['settings']); $server_2 = Server::find(0)->load(['settings']);
$server_2->settings->wildcard_domain = 'http://127.0.0.1.sslip.io';
$server_2->settings->is_build_server = true; $server_2->settings->is_build_server = true;
$server_2->settings->is_reachable = true; $server_2->settings->is_reachable = true;
$server_2->settings->save(); $server_2->settings->save();
@@ -23,4 +24,4 @@ class ServerSettingSeeder extends Seeder
$server_3->settings->is_reachable = false; $server_3->settings->is_reachable = false;
$server_3->settings->save(); $server_3->settings->save();
} }
} }